There is a lot of information out there about browser to browser WebRTC streaming, but surprisingly there is not much coverage on how to stream video from a native application to the browser. Hopefully this example will be of some use to those of you out there who are looking to use WebRTC in native applications.
We have repackaged the
peerconnection_server projects from the WebRTC repository with a few modifications, and included a
native-to-browser-test.html page which you can use to view the native video stream in your browser.
Follow the steps below to get the sample working:
- Checkout and build the WebRTC repository as per the official guide
- Clone or download the example repository from Github:
git clone https://github.com/auscaster/webrtc-native-to-browser-peerconnection-example.git
- Copy the
peerconnectionfolder into the
webrtc/trunk/talk/examplesfolder, ensuring to rename and backup the existing
- Build the WebRTC solution again
- Run the
peerconnection_clientexecutables located in
- Fire up the
native-to-browser-test.htmlpage in Chrome
- Select the “myclient” entry from the
peerconnection_clientwindow to begin broadcasting video to the browser page
- If all went according to plan you should see your sexy self in the browser!
Note that this example only works in Chrome, as the DTLS SRTP signalling which is required by Firefox is not implemented. If you want to stream to both Chrome and Firefox then take a look at the Symple project, which features a native C++ server sample that streams live video to the browser using a Node.js server for signalling. Also check out the Anionu SDK, which features a native WebRTC plugin for cross-browser video streaming using Anionu’s Spot client.
Hopefully you found this information useful. Keep sharing the love!