Peer to Peer streaming uses the EvoStream HTML5 Streaming capabilities. It is recommended you also review the HTML5 Streaming section.
Using Demo Player
Starting release 2.0, the HTML5 web player of EMS or what we’ve called the evoplayers, can now play different streams such as:
- Pulled RTMP/RTSP streams
- Lazy pulled streams
- Playlist files
Follow the instructions below on how to use WebRTC for streaming:
WebRTC Streaming
-
To play streams from EMS using webRTC, the
startWebrtc
command needs to be executed first. SeestartWebRTC
API here:startwebrtc ersip=52.6.14.61 ersport=4545 roomid=MyRoom
Note: The room name should be unique as much as possible, especially when using the public ERS to prevent room name conflicts. If the room name is already taken, EMS would return an error on the console logs to indicate such scenario.
-
Access the test page
demo/evoplayers.html
http://<WEBSERVER_IP_ADDRESS>/demo/evoplayers.html
-
Enter the EMS IP, Room Name and Stream Name
Note: The Stream Name can be a pulled stream, a lazypulled file or a playlist file. Lazy pull and playlist files should be in the media folder.
-
Hit Play to start streaming!
Playing RTMP/RTSP Pulled Streams:
Playing Lazy Pulled File:
Playing Playlist File:
Note:
There are two players available for WebRTC. You can stream the same source or stream two different sources at the same time!
WebRTC using SRTP
This player uses SRTP as transport instead of fragmented MP4. To stream using this player, just follow the same steps as above but use the WebRTC SRTP player.
Note:
- In case your stream audio is not working, it means that the browser does not support WebRTC AAC
WebRTC ERS connections using SSL
Connections to ERS, from the client (browser) and server (EMS), can now also use SSL to prevent any sniffing of the traffic. To enable SSL connections:
-
On the ERS, modify the following in default.json configuration file
"secure": true, "key": "/path/to/server.key", "cert": "/path/to/server.cert"
-
In EMS, add
ersOverSsl
parameter in webrtc in config.luawebrtc={ ersOverSsl=true, --> Add parameter sslKey="/path/to/server.key", sslCert="/path/to/server.cert", },
-
In the JS player, modify this value in the “opts” object that is used to configure the player
ersOverSsl: true
-
Restart EMS and start streaming!