SMIL files PHP query examples for the Wowza Streaming Engine REST API

Wowza Streaming Engine media server software includes a REST Application Programming Interface (API) that you can use to configure, manage, and monitor the media server through HTTP requests. This article describes how to list, create, and remove Synchronized Multimedia Integration Language (SMIL) file configurations in a Wowza Streaming Engine media server by using PHP to query the Wowza Streaming Engine REST service.



Get a list of SMIL files
Create a SMIL file
Remove a SMIL file
For developers

Get a list of SMIL files

To get a list of all configured SMIL files associated with a given application, use the following request. This example requests SMIL file information for an application named live.
$sf = new Com\Wowza\SmilFile("live");
$response = $sf->getAll();

Create a SMIL file

The following example shows how to create a SMIL file named newsmil that's associated with an application named live:
$stream0 = new stdClass();
$stream0->systemLanguage = "en";
$stream0->systemBitrate = "50000";
$stream0->src = "myfile_750.mp4";
$stream0->type = "video";
$stream0->audioBitrate = "44100";
$stream0->videoBitrate = "750000";
$stream0->width = 640;
$stream0->height = 360;

$stream1 = new stdClass();
$stream1->systemLanguage = "en";
$stream1->systemBitrate = "50000";
$stream0->src = "myfile_1100.mp4";
$stream1->type = "video";
$stream1->audioBitrate = "44100";
$stream1->videoBitrate = "1100000";
$stream1->width = 640;
$stream1->height = 360;

$streams = array();
$streams[] = $stream0;
$streams[] = $stream1;

$sf = new Com\Wowza\SmilFile("live");
$response = $sf->create("newsmil", $streams);
This request creates a SMIL file (newsmil.smil) similar to the following:
<?xml version="1.0" encoding="UTF-8"?>
<smil title="">
			<video height="360" src="myfile_1100.mp4"
                systemLanguage="en" width="640">
				<param name="videoBitrate" value="750000" valuetype="data"></param>
				<param name="audioBitrate" value="44100" valuetype="data"></param>
			<video height="360" systemLanguage="en" width="640">
				<param name="videoBitrate" value="1100000" valuetype="data"></param>
				<param name="audioBitrate" value="44100" valuetype="data"></param>

Remove a SMIL file

When you're done with a SMIL file, delete it with the following request. This example deletes the newsmil SMIL file from the live application.
$sf = new Com\Wowza\SmilFile("live");
$response = $sf->remove("newsmil");

For developers

Source code is available on GitHub.

Wowza Media Systems™ provides developers with a platform to create streaming applications and solutions. See Wowza Developer Tools to learn more about our APIs and SDK.