Manage stream files by using the Wowza Streaming Engine

Posted By : Vipin Pokhriyal | 30-Nov-2017

You can use the Wowza Streaming Engine media server software REST API to manage, add and identify stream files in a Wowza Streaming Engine instance.A stream file is better then complex, URI-based stream name from a source such as an IP camera or MPEG-TS encoder.

For example, a stream might have a name like udp://0.0.0.0:xxxx. You can replace that with a stream file such as test.stream. Players can then use test.stream in playback URLs insted of url. Stream files are stored in the /Library/WowzaStreamingEngine/content folder and have a .stream file extension.

1).Get a list of stream files

Using this comand you can view list of stram files (test, in this example)

curl -X GET --header "Accept:application/json; charset=utf-8" --header "Content-Type:application/json; charset=utf-8" http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/streamfiles

The command should return response like this:

<?xml version="1.0" encoding="UTF-8" ?>
<StreamFiles serverName="_defaultServer_">
    <StreamFile id="myStreme" href="/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/myStreme"/>
    <StreamFile id="vipin" href="/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/vipin"/>
    <StreamFile id="Testing_File" href="/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/Testing_File"/>
    <StreamFile id="Test" href="/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/live/streamfiles/Test"/>
</StreamFiles>

 

2).View the details of a stream file (test, in this example):

curl -X GET --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/streamfiles/metallica

 The command should return response like this:

<?xml version="1.0" encoding="UTF-8" ?>
<StreamFile serverName="_defaultServer_">
    <Version>1512038251000</Version>
    <Name>Test</Name>
    <URI>rtsp://admin:[email protected]:xxxx/cam/realmonitor?channel=1&amp;subtype=1</URI>
</StreamFile>

3).Add a stream file


Add a stream file (demo, in this example):

curl -X POST --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8'  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/streamfiles
{  
"name": "demo", 
"serverName": "_defaultServer_", 
"uri": "udp://1.2.3.4:10000"
}

The command should return response like this:

<?xml version="1.0" encoding="UTF-8" ?>
<wmsResponse>
    <success>true</success>
    <message></message>
</wmsResponse>rName": "_defaultServer_", 
"uri": "udp://1.2.3.4:XXXX"
}

4).Update a stream file:

Update a stream file (demo, in this example):

curl -X PUT --header 'Accept: application/json; charset=utf-8' --header 'Content-Type: application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/streamfiles/demo/adv 
{
"sourceControlDriver": "",
    "advancedSettings": [{
        "sectionName": "Common",
        "canRemove": false,
        "defaultValue": "null",
        "documented": false,
        "name": "uri",
        "section": "null",
        "type": "string",
        "value": "rtsp://admin:[email protected]:xxxx/cam/realmonitor?channel=1&subtype=1",
        "enabled": false
    }, {
        "sectionName": "Common",
        "canRemove": true,
        "defaultValue": "12000",
        "documented": true, 
        "name": "streamTimeout",
        "section": "null",
        "type": "integer",
        "value": "0",
        "enabled": true
    }, {
        "sectionName": "Common",
        "canRemove": false,
        "defaultValue": "3000",
        "documented": true, 
        "name": "reconnectWaitTime",
        "section": "null",
        "type": "integer",
        "value": "0",
        "enabled": true
    }],
    "serverName": "_defaultServer_",
    "saveFieldList": [
        ""
    ],
    "version": ""
}

The command should return response like this:

<?xml version="1.0" encoding="UTF-8" ?>
<wmsResponse>
    <success>true</success>
    <message></message>
</wmsResponse>

5).Connect a stream file

This command used to connect a stream file (demo, in this example):

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/streamfiles/demo/actions/connect?connectAppName=test&appInstance=_definst_&mediaCasterType=rtp

6).Disconnect a stream file


This command used to disconnect a stram file(demo, in this example):

curl -X PUT --header 'Accept:application/json; charset=utf-8' --header 'Content-Type:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/instances/_definst_/incomingstreams/demo.stream/actions/disconnectStream

7).Remove a stream file

For delete stream file it must be disconnect

This command used to disconnect a stram file(demo, in this example):

curl -X DELETE --header 'Accept:application/json; charset=utf-8' http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/test/streamfiles/demo

About Author

Author Image
Vipin Pokhriyal

Vipin is Qualified in Master in computer Applicatins. He is an Active team player & having skills as Java Developer.

Request for Proposal

Name is required

Comment is required

Sending message..