Video streaming in game using WebRTC

Video streaming in game using WebRTC

Hi guys,

I want to integrate video streaming to game using WebRTC, anyone has any idea how to achieve it?

There are 3 options I can figure out right now:
1, Implement on native, then call show video stream from cocos2d-x
2, Add webview which contains code that can play/stream video (webview support webrtc on android & web)
3, Dispatch frame data from webrtc, then render to RendererTexture

The option 1st and 2nd has pros / cons:

  • Pros: easy to integrate
  • Cons:
    • Stay on top of all elements
    • 1st option: difficult to manage from c++ code
    • 2nd option: Webrtc is not supported native on iOS

The last option:

  • Pros:
    • Easy to control
  • Cons:
    • Difficult to implement
    • Hard to implement texture cache on iOS and Android

Above is some of my thought. Do you have any suggestion or any references to achieve this?
Thank you so much.

P/S: sorry for my English

Depends on your requirement. i’d say 1 or 2 unless your requirement is that the game can be played while watching the video.

I’d like to play game while watching video. Do you have any suggestion?
thank you so much

I haven’t needed to do anything like you want, but I guess my idea would be to choose 1 or 2 and just make sure the video/webview are sized correctly. I believe most of the recent OS versions should allow a webview to play video without going fullscreen.

Will require testing and trial and error probably.

Maybe someone else has done this or has better ideas?!

Can you share your idea for gameplay which watching a video? For me, I am not sure I could focus on both tasks at the same time.

@stevetranby Thank you, I’ll think about your suggestion

Sorry for wrong explanation, ppl can’t play while watching video.
In fact, I wanna add video streaming to my game. People can use it to stream/watch live video, viewers can send gift or message to publishers, and publishers can react to the actions, messages, emotions etc. of viewers.
It’ll be a social network connecting players in game.

I’ve developed 2 live streaming projects 1 use RTMP the other use WebRTC (both on iOS) and there are many good feedback about this feature. So I want to bring this feature to my game which is developed in cocos2d-js.
I choose WebRTC because its latency is quite good and it’s also an open source.

Hi, did you solved that live video streaming problem?

If you have solved the problem for video streaming, do drop the steps in this link.