Note: For Wowza Media Server 3.x.
Contents
Basic setup
Video on demand playback example
Live playback example
nDVR playback example
How to playback content in a folder inside of the [install-dir]/content folder
Live adaptive bitrate playback with SMIL file example
Flash security restriction
Basic setup
- Download and install Wowza Media Server.
- Download FlowPlayer Flash and extract the contents from the downloaded compressed (zipped) file.
- Download the RTMP Streaming Plugin .swf and copy it to the unzipped Flowplayer folder. (Be sure to copy it to the inner flowplayer folder that contains the flowplayer-3.x.x.swf file.)
Video on demand playback example
In this example, an application named vod is used to stream pre-recorded video content from the [install-dir]/content folder. The vod application is installed and configured as part of the Wowza Media Server installation.
- Edit the flowplayer/example/index.html file in the root directory of the zipped archive, and make the following changes to the <script> section:
Note: Change "x.x" in the Flowplayer filename for the current version of Flowplayer and in the RTMP Streaming Plugin filename for the current version of the plugin.
From:
To:Code:<script> flowplayer("player", "../flowplayer-3.x.x.swf"); </script>
where:Code:<script type="text/javascript"> flowplayer("player", "../flowplayer-3.x.x.swf", { clip: { url: 'mp4:sample.mp4', provider: 'rtmp' }, plugins: { rtmp: { url: '../flowplayer.rtmp-3.x.x.swf', netConnectionUrl: 'rtmp://[wowza-ip-address]/vod' } } } ); </script>
- [wowza-ip-address] is the IP address of your server running Wowza Media Server.
- vod is the name of the Wowza Media Server application.
- mp4:sample.mp4 is the name of the sample video that ships with Wowza Media Server.
- To playback, copy the flowplayer folder to a web server and open the following URL in a browser:
Code:http://[webserver-address]/flowplayer/example/index.html
Live playback example
- Set up an application for live streaming by following one of our live streaming tutorials.
- Edit the flowplayer/example/index.html in the root directory of the zipped archive, and make the following changes to the <script> section:
Note: Change "x.x" in the player filename for the current version of Flowplayer and in the RTMP Streaming Plugin filename for the current version of the plugin.
Note: Set live: true, in the clip section.
From:
To:Code:<script> flowplayer("player", "../flowplayer-3.x.x.swf"); </script>
where:Code:<script type="text/javascript"> flowplayer("player", "../flowplayer-3.x.x.swf", { clip: { url: 'myStream', live: true, provider: 'rtmp' }, plugins: { rtmp: { url: '../flowplayer.rtmp-3.x.x.swf', netConnectionUrl: 'rtmp://[wowza-ip-address]/live' } } } ); </script>
- [wowza-ip-address] is the IP address of your server running Wowza Media Server.
- live is the name of the Wowza Media Server application.
- myStream is the stream name of the live stream.
How to playback content in a folder inside of the [install-dir]/content folder
To play H.264 or MP3 content that is in a folder inside of the [install-dir]/content folder, prepend mp4: and mp3: respectively to the folder name. For example, to play the media file:
Code:
[install-dir]/content/myvideos/sample.mp4
Code:
<script type="text/javascript">
flowplayer("player", "../flowplayer-3.x.x.swf",
{
clip: {
url: 'mp4:myvideos/sample.mp4',
provider: 'rtmp'
},
plugins: {
rtmp: {
url: '../flowplayer.rtmp-3.x.x.swf',
netConnectionUrl: 'rtmp://[wowza-ip-address]/vod'
}
}
}
);
</script>
Windows (default): C:\Program Files\Wowza Media Systems\Wowza Media Server [version]
Mac OS X: /Library/WowzaMediaServer
Linux: /usr/local/WowzaMediaServer
Live adaptive bitrate playback with SMIL file example
This section describes a more advanced live streaming example that uses multiple Flowplayer plugins and works for single bitrate RTMP streaming and adaptive bitrate streaming using a SMIL file.
For testing adaptive bitrate streaming, overlay text will alert you to a switch to a different bitrate stream by displaying text such as: Switched to: mp4:Live1
- Follow the instructions in Instructions for basic setup.
- Download SMIL plugin .swf file and copy into the unzipped FlowPlayer folder (inside the inner flowplayer folder that contains flowplayer-3.x.x.swf).
- Download Content plugin .swf file and copy into the unzipped FlowPlayer folder (inside the inner flowplayer folder that contains flowplayer-3.x.x.swf).
- Download bandwidth detection plugin .swf file and copy into the unzipped FlowPlayer folder (inside the inner flowplayer folder that contains flowplayer-3.x.x.swf).
- Create a SMIL file and copy to [install-dir]/content.
This example uses a SMIL file named live-smil.smil
Code:<smil> <head> </head> <body> <switch> <video src="live1" system-bitrate="700000"/> <video src="live2" system-bitrate="500000"/> <video src="live3" system-bitrate="350000"/> </switch> </body> </smil> - Edit the flowplayer/example/index.html in root directory of the zip archive.
The following example player code for live adaptive bitrate streaming uses live-smil.smil. Replace [wowza-ip-address] with the IP address of your Wowza Media Server.
Code:<html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Flowplayer RTMP and SMIL setup</title> </head><body> <script type="text/javascript" src="flowplayer-3.2.6.min.js"></script> <a href="bbb_480x270" style="display:block;width:480px;height:270px" id="smilbw"> </a> <script language="JavaScript" type="text/javascript"> // To avoid sandbox violation the .swf has to be on your website not flowplayers. flowplayer("smilbw", "flowplayer-3.2.7.swf", { // The playlist is loaded from the RSS file clip: { url: "http://[wowza-ip-address]:1935/live/smil:live-smil.smil/medialist.smil ", autoPlay: false, provider: 'rtmp', // use smil and bwcheck when resolving the clip URL urlResolvers: [ 'smil', 'bwcheck' ] }, plugins: { // the SMIL plugin reads in and parses the SMIL, and provides // the bitrates info to the bw detection plugin smil: { url: 'flowplayer.smil-3.2.2.swf' }, // bandwidth check plugin bwcheck: { url: 'flowplayer.bwcheck-3.2.5.swf', // HDDN uses Wowza servers serverType: 'wowza', // we use dynamic switching, the appropriate bitrate is switched on the fly dynamic: true, netConnectionUrl: 'rtmp://[wowza-ip-address]/live', // show the selected file in the content box. This is not used in real installations. onStreamSwitchBegin: function (newItem, currentItem) { $f().getPlugin('content').setHtml("Will switch to: " + newItem.streamName + " from " + currentItem.streamName); }, onStreamSwitch: function (newItem) { $f().getPlugin('content').setHtml("Switched to: " + newItem.streamName); } }, // RTMP streaming plugin rtmp: { url: 'flowplayer.rtmp-3.2.3.swf', netConnectionUrl: 'rtmp://[wowza-ip-address]/live' }, // a content box so that we can see the selected bitrate. This is not normally // used in real installations. content: { url: 'flowplayer.content-3.2.0.swf', top: 0, left: 0, width: 400, height: 150, backgroundColor: 'transparent', backgroundGradient: 'none', border: 0, textDecoration: 'outline', style: { body: { fontSize: 14, fontFamily: 'Arial', textAlign: 'center', color: '#ffffff' } } } } }); </script> </body></html> - Copy the flowplayer folder to a web server and open in a browser:
where:Code:http://[webserver-address]/flowplayer/example/index.html
[wowza-ip-address]: is the IP address of your server running Wowza Media Server.
live: is the name of the Wowza Media Server application.
live-smil.smil: is the name of the SMIL file located in [install-dir]/content.
nDVR Playback
This configuration shows how to play Wowza nDVR streams. This is the basic guide for configuring Wowza nDVR. See this Flowplayer page for reference.
Code:
<html>
<head>
<script src="flowplayer-3.2.11.min.js"></script>
</head>
<body>
<h1>Flowplayer Wowza nDVR playback</h1>
<div id="httpstreaming-dvr" style="display:block;width:425px;height:300px;"></div>
<script>
flowplayer("httpstreaming-dvr", "http://releases.flowplayer.org/swf/flowplayer-3.2.15.swf", {
plugins: {
f4m: {
url: "http://releases.flowplayer.org/swf/flowplayer.f4m-3.2.9.swf",
dvrBufferTime: 5,
liveBufferTime: 5
},
httpstreaming: {
url: "http://releases.flowplayer.org/swf/flowplayer.httpstreaming-3.2.9.swf"
}
},
clip: {
url: "http://[wowza-address]:1935/dvr/Stream1/manifest.f4m?DVR",
urlResolvers: ['f4m'],
provider: 'httpstreaming',
autoPlay: false
}
});
</script>
</body>
</html>
Flash security restriction
Due to a security restriction in Flash, you must host the Flowplayer files on your web server. The easiest solution is to copy all of the files inside of the flowplayer folder (including sub-folders) to your web server. To play, open a web browser and enter the url for the index.html file.
If you want to play the video locally without hosting the file at your a web server, use the following instructions to add the flowplayer-3.x.x.swf, flowplayer.controls-3.x.x.swf, and flowplayer.rtmp-3.x.x.swf files to your list of trusted SWF files.
- Right click on the flash movie below the title single file, with preview image, and then select Settings from the popup menu.
- Click the Advanced button. A browser window will be displayed.
- Click the Global Security Settings Panel link. A new webpage will open with a Flash swf file in the upper-right corner.
- In this Flash movie, select Add location from the Edit locations popup.
- Click Browse for files, find and select flowplayer-3.x.x.swf, and then click Open. Do this for each of the three files.
- To play, close all open web browsers windows and double-click flowplayer/examples/index.html.
- Click here, if you are having problems or would like to discuss this article.
- Leave a comment below, if there is some aspect of this article you would like to see changed or improved.


Article List
Categories
Wowza Media