Adding video to websites (embed.html)¶
Flussonic Media Server has a special page embed.html, which is intended for video insertion to a website and viewing video via a browser. Technically, embed.html
is the same player that is used in the web interface of Flussonic Media Server.
The page with the player is available via the link:
http://HOSTNAME/STREAMNAME/embed.html
The page automatically detects a browser version and selects a supported video protocol. For the majority of devices it's HLS (the player uses it by default).
Warning
Video might start without sound due to the autoplay policy of browser vendors. The following link explains the policy and conditions for the sound to turn on automatically. See Chrome autoplay policy as an example
There are two ways to use the embed.html player:
- When opening embed.html directly (by entering the link in the address bar), the video will expand to the size of the browser window and start playing automatically.
- Also, you can use
embed.html
to embed the video on a website as a part of a web page. The HTML code for insertion is available on the Overview page of each stream in the web interface.
Example:
<iframe style="width:640px; height:480px;" allowfullscreen src="http://hostname/streamname/embed.html"></iframe>
The code embeds a player window with fixed dimensions (640x480px) to a web page. Playback starts automatically.
Options¶
For most tasks no additional configuration is required, but still embed.html
has parameters that you can specify as part of the URL, for example:
http://FLUSSONIC-IP/STREAM_NAME/embed.html?autoplay=false&play_duration=600
In this example the video will be played without autostart and the playback will stop after 10 minutes.
The detailed description of all available parameters can be found in the Streaming API reference, in the Query parameters section.
If a stream has several audio, video, or subtitle tracks, you can use the filter.tracks
parameter to specify which tracks to play.
Example of accessing the archive to view recorded video
To access a recording of a TV show, use the link with from
and to
parameters:
http://FLUSSONIC-IP/STREAM_NAME/embed.html?from=1511300552&to=1511300852
It is better to generate such links via server-side scripts, based on program guide (EPG), for the organization of a CatchUp service.
DVR player¶
To play a stream's DVR archive, open the player by using the link:
http://FLUSSONIC-IP/STREAM_NAME/embed.html?dvr=true
This DVR player plays recorded video from the archive, and it offers the calendar to navigate large archives in addition to the timeline.
The player interface allows you to set the timeline scale, enable fast playback, and save the specified interval as an MP4 file.
The DVR player supports all additional URL parameters, except ago.
The player interface allows you to automatically generate links in the format embed.html?dvr=true&from=1511300552 without using additional tools. Just click a right time point on the timeline and click on the clock to open the link containing the from parameter.
See also:
- All ways to play an archive are described in the section DVR Playback
Multiwindow mode of DVR player¶
Note
This functionality is available via the experimental streams
parameter that probably will be changed soon. The actual list of embed.html
parameters can be found in the Streaming API reference.
In some situations, it may be necessary to view DVR archives of several streams within one player with one timeline. For example, you may need to watch the recordings from several surveillance cameras synchronously to see the same location from different points of view. In this case you can use DVR player in multiwindow mode.
To do that, you can use the experimental streams
parameter in the DVR player link and list all necessary streams in this parameter:
http://FLUSSONIC-IP/STREAM_NAME/embed.html?dvr=true&streams=cam01,cam02,cam03,cam04
Note
STREAM_NAME
part in the URL may be replaced by the name of any stream, the displayed streams will be taken from the streams
parameter.
This will result in playing all the archives in separate windows withing the DVR player.
Stream authorization¶
Flussonic Media Server has a built-in mechanisms for a basic protection against embedding video players on other websites. Please refer to Domain lock and CORS for player protection sections for detail on those.