Skip to content
Last updated

Create a live app

The first step to using Wowza Streaming Engine™ media server software is to create a live streaming application. This article demonstrates how to create and manage a streaming app using the Wowza Streaming Engine (WSE) REST API.

Prerequisites

WSE 4.3.0 or later

Create an app

To create a new live app, send a POST request to the create app endpoint. Authenticate the request with your username and password. Include the app name as a path parameter and set the appType to Live in the body of the request. In the example below, we create a new live app called myLiveApp.

Example cURL request
curl -X POST \
  -H 'Accept:application/json; charset=utf-8' \
  -H 'Content-Type:application/json; charset=utf-8' \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/myLiveApp \
  -u {username}:{password} \
  -d '
    {
      "restURI": "http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/myLiveApp",
      "name": "testlive",
      "appType": "Live",
      "clientStreamReadAccess": "*",
      "clientStreamWriteAccess": "*",
      "description": "A basic live application",
      "streamConfig": {
        "restURI": "http://localhost:8087/v2/servers/{serverName}/vhosts/{vhostName}/applications/testlive/streamconfiguration",
        "streamType": "live"
      }
    }'
Example 201 response
{
  "success": true,
  "message": "Application (myLiveApp) created successfully."
}

Add password authentication

To create a live password-authenticated app, send a POST request to the create app endpoint. Authenticate the request with your username and password. Include the app name as a path parameter and the securityConfig object and the ModuleCoreSecurity module in the body of the request. The example below creates a new live app called secureLiveApp.

Example cURL request
curl -X POST \
  -H 'Accept:application/json; charset=utf-8' \
  -H 'Content-Type:application/json; charset=utf-8' \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/secureLiveApp \
  -u {username}:{password} \
  -d '{
    "appType": "Live",
    "securityConfig": {
      "clientStreamWriteAccess" : "*",
      "publishRequirePassword": true,
      "publishAuthenticationMethod": "digest"
    },
    "modules": {
      "moduleList": [
        {
          "order": 0,
          "name": "ModuleCoreSecurity",
          "description": "Core Security Module for Applications",
          "class": "com.wowza.wms.security.ModuleCoreSecurity"
        }
      ]
    }
  }'
Example 201 response
{
  "success": true,
  "message": "Application (secureLiveApp) created successfully."
}

Enable live stream packetizer

To create a live-stream app, send a POST request to the create app endpoint. Authenticate the request with your username and password. Include the app name as a path parameter and the streamConfig object in the body of the request. The example below creates a new app called liveStreamApp using the cupertinostreamingpacketizer live-stream packetizer.

Example request
curl -X POST \
  -H 'Accept:application/json; charset=utf-8' \
  -H 'Content-Type:application/json; charset=utf-8' \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp \
  -u {username}:{password} \
    -d'
    {
      "name": "testlive",
      "appType": "Live",
      "description": "A live application with password authentication and packetizers",
      "streamConfig": {
      "streamType": "live",
      "liveStreamPacketizer": \[
          "cupertinostreamingpacketizer"
        \]
      },
      "securityConfig": {
        "secureTokenVersion": 0,
        "clientStreamWriteAccess": "*",
        "publishRequirePassword": true,
        "publishPasswordFile": "",
        "publishRTMPSecureURL": "",
        "publishIPBlackList": "",
        "publishIPWhiteList": "",
        "publishBlockDuplicateStreamNames": false,
        "publishValidEncoders": "",
        "publishAuthenticationMethod": "digest",
        "playMaximumConnections": 0,
        "playRequireSecureConnection": false,
        "secureTokenSharedSecret": "",
        "secureTokenUseTEAForRTMP": false,
        "secureTokenIncludeClientIPInHash": false,
        "secureTokenHashAlgorithm": "",
        "secureTokenQueryParametersPrefix": "",
        "secureTokenOriginSharedSecret": "",
        "playIPBlackList": "",
        "playIPWhiteList": "",
        "playAuthenticationMethod": "none"
      },
    "modules": {
      "moduleList": \[
        {
          "order": 0,
          "name": "base",
          "description": "Base",
          "class": "com.wowza.wms.module.ModuleCore"
        }, {
          "order": 1,
          "name": "logging",
          "description": "Client Logging",
          "class": "com.wowza.wms.module.ModuleClientLogging"
        }, {
          "order": 2,
          "name": "flvplayback",
          "description": "FLVPlayback",
          "class": "com.wowza.wms.module.ModuleFLVPlayback"
        }, {
          "order": 3,
          "name": "ModuleCoreSecurity",
          "description": "Core Security Module for Applications",
          "class": "com.wowza.wms.security.ModuleCoreSecurity"
      }\]
    }
  }'
Example 201 response
{
  "success": true,
  "message": "Application (liveStreamApp) created successfully."
}

Retrieve app list

To retrieve a list of all existing applications send a GET request to the get app list endpoint.

Example request
curl -X GET \
  -H 'Accept:application/json; charset=utf-8' \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications \
  -u {username}:{password}

A successful request will return a response similar to the one below.

Example 200 response
{
  "serverName": "_defaultServer_",
  "applications": [
    {
      "id": "liveStreamApp",
      "href": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp",
      "appType": "live",
      "dvrEnabled": false,
      "drmEnabled": false,
      "transcoderEnabled": false,
      "streamTargetsEnabled": false
    },
    {
      "id": "secureLiveApp",
      "href": "/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/secureLiveApp",
      "appType": "live",
      "dvrEnabled": false,
      "drmEnabled": false,
      "transcoderEnabled": false,
      "streamTargetsEnabled": false
    }
  ]
}

Update an app

To update an existing application, send a PUT request to the update app endpoint. Authenticate the request with your username and password. Include the name of the app to be updated as a path parameter and any updated settings in the body of the request. The example below updates the liveStreamApp application to include the MPEG-DASH packetizer.

Example request

curl -X PUT \
  -H 'Accept:application/json; charset=utf-8' \
  -H 'Content-Type:application/json; charset=utf-8' \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp \
  -d'
  {
    "name":" liveStreamApp",
    "appType": "Live",
    "streamConfig": {
      "streamType": "live",
      "liveStreamPacketizer": \[
        "cupertinostreamingpacketizer",
        "mpegdashstreamingpacketizer"
      \]
    }
  }'
Example 200 response
{
  "success": true,
  "message": "Saved"
}

Add custom properties to an application

To add a custom module to an application, send a PUT request to the advanced update app endpoint. The example below updates the liveStreamApp application to include a custom module called MyCustomModule and a custom property called myCustomProperty.

Example request
curl -X PUT \
  -H 'Accept:application/json; charset=utf-8' \
  -H 'Content-Type:application/json; charset=utf-8' \
  -u {username}:{password} \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp/adv \
  -d '{
  "version": "1430682096000",
  "modules": [
    {
      "class" : "com.wowza.wms.module.ModuleCore",
      "description" : "Base",
      "name" : "base",
      "order" : 0
    },
    {
      "class" : "com.wowza.wms.module.ModuleClientLogging",
      "description" : "Client Logging",
      "name" : "logging",
      "order" : 1
    },
    {
      "class" : "com.wowza.wms.module.ModuleFLVPlayback",
      "description" : "FLVPlayback",
      "name" : "flvplayback",
      "order" : 2
    },
    {
      "class" : "com.wowza.wms.security.ModuleCoreSecurity",
      "description" : "Core Security Module for Applications",
      "name" : "ModuleCoreSecurity",
      "order" : 3
    },
    {
      "class": "com.my.custom.path.MyCustomModule",
      "description": "Module Custom Module",
      "name": "MyCustomModule",
      "order": 4
    }
  ],
  "advancedSettings": [
    {
        "enabled": false,
        "canRemove": true,
        "name": "debugAACTimecodes",
        "value": "false",
        "defaultValue": "false",
        "type": "Boolean",
        "sectionName": "cupertinostreamingpacketizer",
        "section": "/Root/Application/LiveStreamPacketizer",
        "documented": true
    },
    {
      "enabled": false,
      "canRemove": true,
      "name": "debugMP3Timecodes",
      "value": "false",
      "defaultValue": "false",
      "type": "Boolean",
      "sectionName": "cupertinostreamingpacketizer",
      "section": "/Root/Application/LiveStreamPacketizer",
      "documented": true
    },
    {
      "enabled": false,
      "canRemove": true,
      "name": "cupertinoChunkDurationTarget",
      "value": "0",
      "defaultValue": "10000",
      "type": "Integer",
      "sectionName": "cupertinostreamingpacketizer",
      "section": "/Root/Application/LiveStreamPacketizer",
      "documented": true
    },
    {
      "enabled": true,
      "canRemove": false,
      "name": "myCustomProperty",
      "value": "myValue",
      "defaultValue": null,
      "type": "String",
      "sectionName": "Application",
      "section": "/Root/Application",
      "documented": false
    }
  ]
}'

A successful request will update your app's Application.xml file to include the custom modules and properties shown below.

Application.xml snippet
<Modules>
    <Module>
        <Name>MyCustomModule</Name>
        <Description>Module Custom Module</Description>
        <Class>com.my.custom.path.MyCustomModule</Class>
    </Module>
</Modules>
<!-- Properties defined here will be added to the IApplication.getProperties() and IApplicationInstance.getProperties() collections -->
<Properties>
    <Property>
        <Name>myCustomPropertyName</Name>
        <Value>myValue</Value>
        <Type>String</Type>
    </Property>
</Properties>

Delete an app

To delete an existing application, send a DELETE request to the delete app endpoint. Authenticate the request with your username and password. Include the name of the app to be deleted as a path parameter and any updated settings in the body of the request. The example below deletes the liveStreamApp application.

Example request
curl -X DELETE \
  -H 'Accept:application/json; charset=utf-8' \
  -H 'Content-Type:application/json; charset=utf-8' \
  -u {username}:{password} \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp
Example 200 response
{
  "success": true,
  "message": "Application (liveStreamApp) deleted successfully"
}

Start, shutdown, restart or copy an app

With the application action endpoint you can start, shutdown, restart or copy an existing application.

The example below will restart the application called liveStreamApp.

Example request
curl -X PUT \
  -H 'Accept:application/json; charset=utf-8' \
  http://localhost:8087/v2/servers/_defaultServer_/vhosts/_defaultVHost_/applications/liveStreamApp/actions/restart \
  -u {username}:{password}