HLS player example
This example can be used for HLS playback of the following types of streams published on Web Call Server
The example uses HLS player built in a browser and should be used with browsers supporting HLS, e.g. iOS Safari and Android Chrome.
Stream transcoding to HLS will start automatically when client requests the stream published on server by HLS URL, for example,for the stream e442 on screenshot below
In the URL on the screenshot, demo.flashphonr.com is the address of the WCS server.
Port 8445 is used for HLS over HTTPS.
Code of the example
The path to the source code of the example on WCS server is:
hls-player.css - file with styles
video-js.css - file with HLS player styles
hls-player.html - page of the player
hls-player.js - script or running the player
video.js - script providing functionality of the player (http://videojs.com/, Apache License Version 2.0)
videojs-hls.min.js - script providing functionality of the player (minimized version)
This example can be tested using the following address:
Here host is the address of the WCS server.
Work with code of the example
To analyze the code, let's take the version of file hls-player.js with hash c306c1bbf49bfcbd8e24be927ae95f63b7dbaaba, which is available here and can be downloaded with corresponding build 0.5.28.2747.
1. Forming HLS server URL.
2. Player initializing
<div>-element name to play the stream passed to the player
3. Stream name definition (the stream must be published on server)
4. Forming HLS stream URL and player starting