In the next step you'll learn more about events and listeners in Events Basics guide.
Storm Library for Android can be feed with video data in two distinctive way. The first one requires you to embed all stream data directly inside your code with help of StormMediaItem objects. By creating and removing these objects the library can be populated with multiple quality version of the same stream. The main drawback for this approach is that you have to manage both sources and servers on your own.
Alternatively a Storm Streaming Gateway can be used, which generates an pre-emptive request for video data already pushed to the server. Thanks to this approach all multi-source streams can be defined within the Storm Streaming Server and shared among all edge servers within a cluster. This method also enables you to use Storm's load-balancing functionality.
StormMediaItem can be added to a Storm Library. For streams ingested into the Storm Server creating new source object will look as follow:
StormMediaItem stormMediaItem = new StormMediaItem("mydomain.com",443,true,,"live","test_stream_320p","320p");
... and the version for external RTMP source (additional parameters):
StormMediaItem stormMediaItem = new StormMediaItem("mydomain.com",443,true,"live","test_stream_320p","320p","somertmpserver.com","live");
StormMediaItem constructor parameters
Name | Type | Required | Description |
host | String | Yes | Domain address to a StormStreaming Server. |
port | int | Yes | Port to a StormStreaming Server. The value should match WebSocket configuration for the server (443 port is set by default). |
isSSL | boolean | Yes | Whenever the WebSocket connection should be established with SSL (true) or not (false). |
streamName | String | Yes | A name of a stream. |
label | String | Yes | If more sources must be added to the library, the labels is used to identify separate streams. Labels are also used on quality list. |
rtmpHost | String | No | If the source is located on an external RTMP server, rtmpHosts tells the server where to look it. |
rtmpApplicationName | String | No | If the source is located on an external RTMP server, rtmpApplication tells the server what application it should connect to. |
In order to use the Gateway approach in the Storm Android Library, a new StormGateway object containing our streamGroup name must be created first. In the we attach StormGatewayServer instances to it.
StormLibrary stormLibrary = new StormLibrary();
stormLibrary.initExoPlayer(this, findViewById(R.id.exoPlayerView));
StormGateway stormGateway = stormLibrary.initStormGateway("test");
StormGatewayServer primary = new StormGatewayServer("sub1.yourdomain.com","live", 443, true);
stormGateway.addStormGatewayServer(primary);
StormGatewayServer secondary = new StormGatewayServer("sub2.yourdomain.com","live", 443, true);
stormGateway.addStormGatewayServer(secondary);
try {
stormLibrary.prepare(true);
} catch(Exception e){
e.printStackTrace();
}
stormLibrary.initStormGateway constructor parameters.
Name | Type | Required | Description |
groupName | String | Yes | Name of a stream group. |
StormGatewayServer constructor parameters.
Name | Type | Required | Description |
host | String | Yes | Domain address to a StormStreaming Server (with Gateway server enabled). |
application | String | Yes | Name of the application where a stream is published. |
port | int | Yes | Port to a StormStreaming Server. The value should match WebSocket configuration for the server (443 port is set by default). |
isSSL | boolean | Yes | Whenever the WebSocket connection should be established with SSL (true) or not (false). |
Create a free ticket and our support team will provide you necessary assistance.