Two code samples of a player to embed into the page
Two versions of the HTML code to display the RTSP content in a browser – the code for Chrome / Firefox and the code for Safari
Preparation steps
To organize broadcasting of an RTSP stream directly to a browser, such as Chrome / Firefox or Safari, it is sufficient to perform the following steps:
-
Correctly install (or access to the already installed) Web Call Server.
-
Download the build that contains HTML and JS files of the player code from here.
-
Deploy the build on an available Web server keeping all relative links between files.
-
Insert code elements from the examples to the created HTML page.
Code example for a WebRTC browser –Chrome / Firefox
If you use Chrome / Firefox, you should insert the code from the following example:
The WebRTC player code in the build is in the file named Streaming-min.html
Sample player embedded into the HTML file shown in Chrome / Firefox browser
The result of using the sample code (from the above example) is shown below:
Code example to the Websocket browser – Safari
If you are using Safari it is necessary to insert the code from the example below:
The Websocket player code in the build is in the file named vow-player-min.html
Sample player embedded to the HTML file shown in Safari browser
The result of using sample code (from the HTML example) is shown below:
More ways to use the HTML code from the above examples
Note that in example files there are more tags for event handling, connection status, entering URLs and other functional add-ons to the player. For example: on the screenshot above you can see the current status (connected, playing, etc) displayed at the bottom, below the content. In the same manner events are handled in Chrome / Firefox.
Therefore, we have successfully reached the goal stated at the beginning of this page – namely, to create a new page using the HTML code samples, open it in a WebRTC / Websocket browser and display the RTSP content on it.
To successfully embed the proposed HTML code samples it is enough to have Web Call Server running and a specific build (see the link above) carefully deployed to the Web server keeping all relative paths to script files.
Download Web Call Server 5
System requirements: Linux x86_64, 1 core CPU, 2 Gb RAM, Java
Installation:
- wget https://flashphoner.com/download-wcs5.2-server.tar.gz
- Unpack and install using 'install.sh'
- Launch server using command 'service webcallserver start'
- Open the web interface https://host:8444 and activate your license
If you are using Amazon EC2, you don't need to download anything.