Edge Application - Storm Streaming Server

An Edge-type application is used to redistribute streams to end viewers using various protocols such as RTMP, HLS, or those dedicated to the stormLibrary and stormPlayer. This guide provides all the necessary information about configuring this type of application.

Sample Configuration

An edge application is the basis for creating a video streaming cluster. It is very similar to a live application. A single edge application will connect to an origin application (or multiple ones) and copy its streams when requested. You cannot push streams into an edge-type application.

The basic edge-type application configuration stored in config/preferences.xml looks as follow:

                        
<Application name="edge" type="edge">

    <!--
        Cluster Connection Settings
    -->
	<StreamingClusterSettings>
        <SupervisorList>
            <ClusterManager host="mydomain.com" port="443" isSSL="true">
                <Priority>1</Priority>
                <Secret>qwerty*1234556</Secret>
            </ClusterManager>
        </SupervisorList>
        <CopyOnPublish>true</CopyOnPublish>
    </StreamingClusterSettings>

    <!--
        General configuration settings related to this application and its streams.
    -->
    <GeneralSettings>
		<Description>Default application</Description>
		<BroadcastLimit>unlimited</BroadcastLimit>
	    <StatInterval>2</StatInterval>
	</GeneralSettings>

    <!--
        Settings related to video playback for connected clients.
    -->
    <PlaybackSettings>
		<AllowedHarnesses>
            <Harness type="storm-hls"/>
            <Harness type="storm-mse"/>
            <Harness type="generic-hls"/>
            <Harness type="rtmp"/>
        </AllowedHarnesses>
		<TotalViewerLimit>unlimited</TotalViewerLimit>
		<StreamViewerLimit>unlimited</StreamViewerLimit>
		<FrameBufferSize>0</FrameBufferSize>
	</SecureStream>

    <!--
        Access control settings for WebSocket and HTML-based endpoints (Storm Library & Storm Player).
    -->
	<StreamSecuritySettings>
		<TokenProtection enabled="false">
            <Password>qwerty</Password>
            <CheckViewerIP>true</CheckViewerIP>
            <TokenLifespan>10</TokenLifespan>
        </TokenProtection>
		<DomainAccessRights>
            <AccessRight type="allow" domain="*" />
            <AccessRight type="deny" domain="acme.com" />
        </DomainAccessRights>
	</SecureStream>

    <!--
        Basic MP4 muxing settings.
    -->
	<MP4MuxerSettings>
		<VariableFPS>true</VariableFPS>
		<KeyFrameCompensation>false<KeyFrameCompensation>
	</MP4MuxerSettings>

    <!--
        nDVR settings for live streaming.
    -->
	<DVRSettings enabled="false">
		<CacheSize>100</CacheSize>
	</DVRSettings>

    <!--
        Recording configuration for saving live streams to disk.
    -->
	<RecordingSettings enabled="false">
		<FileFormat>fMP4</FileFormat>
		<SavePath>/Users/szymon/Desktop</SavePath>
        <MaxFileSize>10</MaxFileSize>
        <MaxFileDuration>10</MaxFileDuration>
        <CacheSize>1</CacheSize>
        <MaxStorageSize>1500</MaxStorageSize>
        <RemoveOldFiles>true</RemoveOldFiles>
	</RecordingSettings>

    <!--
        List of enabled live transcoding presets for this application.
    -->
	<LiveTranscoding enabled="true">
		<Preset name="360p" />
		<Preset name="480p" />
        <Preset name="720p" />
	</LiveTranscoding>

</Application>
                    

Main Parameters Explanation

Application:name Name of this application. If there are more applications within your config/preferences.xml they all must have unique names.
Application:type This value must be set to edge for this type of Application. Other types are live (which you can learn more about here), origin (which you can learn more about here) and transcode (which you can learn more about here).
Table 1. Main parameters table

StreamingClusterSettings

This block defines a list of ClusterManagers to which information about streams and their status within the cluster is sent. Later, edge or transcode-type applications connected to these same ClusterManager will be able to locate the stream on the appropriate server with an origin-type application.

It is possible to define more than one ClusterManager in the list for the purpose of redundancy.

ClusterManager:host URL or IP to a server hosting ClusterManagers instance.
ClusterManager:port Port for ClusterManagers connection.
ClusterManager:isSSL True/false depending on whenever SSL layer is required.
Secret A secret for connection authorization
Priority Priority for ClusterManagers (if more available). Higher the number, higher the priority
CopyOnPublish Whenever stream from an origin or transcode application should be immediately copied to this Edge application, otherwise it'll wait for a first request from a viewer.
Table 2. Streaming cluster settings table

PlaybackSettings

This block defines how streams can be played back within the application.

AllowedHarnesses List of allowed connection types (called harnesses) that are permitted to connect to this application.
  • <Harness type="storm-hls"/> HLS connection generated by the Storm Player.
  • <Harness type="storm-mse"/> WebSocket/Media Source Extension connection used by the Storm Player.
  • <Harness type="generic-hls"/> Standard HLS connection.
  • <Harness type="rtmp"/> RTMP protocol connection.
TotalViewerLimit Maximum number of total viewers allowed for the application. Use "unlimited" for no limit.
StreamViewerLimit Maximum number of viewers per individual stream. Use "unlimited" for no limit.
FrameBufferSize Minimum sever frame buffer size used during video reception (default is 0).
Table 3. PlaybackSettings table

StreamSecuritySettings

This block defines access protection mechanisms for streams, as well as domain-level playback restrictions. These settings apply exclusively to stormLibrary and stormPlayer. If you wish to exclude other types (generic hls, rtmp), please check PlaybackSettings section and disable these harnesses.

TokenProtection:enabled If set to true, token-based authorization is required for players (stormLibrary & stormPlayer) using this application.
Password A password used as part of the generated hash.
CheckViewerIP Specifies whether the viewer's IP address should be included in the hash calculation.
TokenLifespan Defines the token’s validity period, in minutes.
Table 4. StreamSecuritySettings table

To enable secure playback, a valid hash must be generated and passed to the Storm JavaScript Library. Below is a sample implementation in PHP:

                        
$password = "qwerty";                        // Your security password
$unixTime = strtotime(date('Y-m-d H:i:00')); // Current time, rounded to the nearest minute
$token = md5($unixTime . $password);         // Basic token (without IP)
$token = md5($unixTime . $password . $ip);   // Token including viewer IP
                    
A complete explanation of the secure stream mechanism is available in our dedicated guide: Secure Stream. The configuration process for stormLibrary is covered in the Security Settings – Storm JavaScript Library guide.
DomainAccessRights

Defines a list of domain-level access control rules for stream playback.

Examples:

  1. Allow only a specific domain:
                            
    <AccessRight type="deny" domain="*" />
    <AccessRight type="allow" domain="acme.com" />
                        
  2. Block a specific domain:
                            
    <AccessRight type="allow" domain="*"  />
    <AccessRight type="deny" domain="acme.com"  />
                        
  3. Block all subdomains:
                            
    <AccessRight type="deny" domain="*.acme.com"  />
                        

MP4 Muxer Settings

MP4MuxerSettings block defines basic options for MP4 packager that is used for MSE/HLS connections

VariableFPS If the source stream has no const frame rate (e.g. WebRTC-based source) muxer will try to fix the stream by adjusting composition times for selected frames.
KeyFrameCompensation Enables mechanism where “empty” frames are inserted into a stream if Audio/Video desynchronization is detected.
Table 5. MP4 muxer settings table

DVR Settings

DVR function allows for short live-stream rewind mechanism based on cached stream.

DVRSettings:enabled Defines whenever DVR is enabled.
CacheSize Number of MB within memory for storing video stream. Length of stored video material will depend on resolution and bitrate.
Table 6. DVR settings table

RecordingSettings

Recording option allows for recording video streams into media files.

RecordingSettings:enabled Defines whenever recording is enabled.
SavePath Path were MP4 files should be saved.
CacheSize Defines how much of a video stream should be kept in memory before being flushed to a file.
MaxFileSize Maximum video file size. If a stream reaches this size, it will be split into additional files. This parameter is optional, and if not present or set to zero, no limit will be in effect.
MaxFileDuration Maximum video file duration (time). If a stream exceeds this duration, it will be split into multiple files. This parameter is optional, and if not specified or set to zero, there will be no limit in effect.
MaxStorageSize Storm will calculate sum of all saved video files in particular folder and either stop saving new ones, or it'll start overwriting older files if RemoveOldFiles is set to true. This parameter is optional and if not present or set to 0 no limitation will be added.
RemoveOldFiles If set to true and combined with MaxStorageSize, older video files will be removed to make space for new ones.
Table 7. RecordingSettings table

LiveTranscoding

For each individual application a set of presets for transcoding can be selected. Please keep in mind that presets must be already defined in your config/preferences.xml file. If you would like to define your own presets and learn more about transcoding check our Transcoding Guide.

LiveTranscoding:enabled If set to false, no video stream will be transcoded.
preset:name Name of a template, previously defined in main Transcoder tag.
Table 8. LiveTranscoding table
Support Needed?

Create a free ticket and our support team will provide you necessary assistance.