Using WebRTC for one-to-many streaming makes life easy for users. Because there is no need to install any third party software in stream publishing. In addition, to make life even easier is seamless switch between WebRTC Screen Sharing & Camera. So that we add switch between WebRTC Screen Sharing & Camera to both Community and Enterprise Edition. We mean by seamless is that you can switch between Screen & Camera in the same session.
Try seamless WebRTC Screen Sharing
- Install Ant Media Server to your server in the cloud with Getting Started. In order to download community edition, visit main page or if you want to try Enterprise edition, keep in touch.
- Go to WebRTC publishing web page which is https://FQDN:5443/WebRTCApp (Community E. ) or https://FQDN:5443/WebRTCAppEE (Enterprise E.). By the way, you need to assign a domain to your server and install SSL. Otherwise, chrome does not let you access the camera or screen.
- Install Chrome Extension by clicking on the link or directly from Chrome WebStore. Luckily, source code of the extension is also available on github.
- Return back to WebRTC Publish page and click Screen Share Checkbox
- Screen is going to be shared on the video element
- Click “Start Publishing” and also check/uncheck “Screen Share” box while publishing in the same session. MP4 file or HLS stream will record the screen or your camera according to your preference. You can watch the stream live on web panel via HLS.
Implementing WebRTC Screen Sharing
- Firstly, There is a new callback with “screen_share_extension_available”. If callback function is called with this parameter, it means that Ant Media Server Screen Share extension is ready to use in the Chrome.
- Secondly, if extension is available in the Chrome, you only need to call “webRTCAdaptor.switchDesktopCapture(streamId);” function to switch the Screen Sharing
- Lastly, to switch back to camera, just again call to “webRTCAdaptor.switchVideoCapture(streamId);” function.
Finally, that’s all. I hope this blog post will help some guys. You can use this feature on your project.
If you have any question, please keep in touch.