Media Source Extensions (MSE) is a browser API that allows playing audio and video using the corresponding HTML5 tags <audio> and <video>. While WebRTC is intended for both playing and publishing streams in real time, MSE is for playing only. Therefore, the MSE technology can be used when you only need to play a stream on the page and there are no strict requirements to latency.
Supported platforms and browsers
- Video: H.264
- Audio: AAC
- The browser connects to the server via the Websocket protocol and sends the publish command.
- The browser captures the microphone and the camera and sends the WebRTC stream to the server.
- The second browser establishes a connection also via Websockets and sends the play command.
- The second browser receives the H.264 + AAC stream via Websocket and plays this stream on the page using MSE.
Quick manual on testing
Publishing a video stream on the server and playing it in a browser via MSE
1. For this test we use:
- the demo server at demo.flashphoner.com;
- the Two Way Streaming web application for publishing the stream
- the Player web application to play the stream via MSE
2. Open the Two Way Streaming application. Click Connect, then Publish. Copy the identifier of the stream:
3. Open the Player web application and specify MSE in the parameters of the URL
4. Set the identifier of the stream in the Stream field:
5. Click the Start button. The stream starts playing:
Below is the call flow when using the Player example to play a stream via MSE
1. Establishing a connection to the server.
2. Receiving from the server an event confirming successful connection.
ConnectionStatusEvent ESTABLISHED code
3. Playing the stream.
4. Receiving from the server an event confirming successful playing of the stream.
StreamStatusEvent, status PLAYING code
5. Receiving the audio-video stream via Websocket and playing via MSE
6. Stopping the playback of the stream.
7. Receiving from the server and event confirming the playback of the stream is stopped.
StreamStatusEvent, status STOPPED code
1. When stream is published from Flash client with low framerate and played via MSE in MS Edge and Internet Explorer 11 browsers with mseCutByIFrameOnly=true setting and transcoding enabled, video freezes are possible.
Symptoms: when stream is published from Flash client and played in Player web appliucation with mseCutByIFrameOnly=true setting enabled and resolution explicitly set, for example freezes often occur in MS Edge or IE 11 browsers.
a) FPS must not be lower then 25 when stream is published from Flash client, trenscoding has also to be escaped;
б) If FPS cannot be higher or transcoding is necessary, the following parameter in flashphoner.properties file should be reduced, for example