This document is meant to provide you with information to setup Web Media Live Encoder on your own site and help you with with general configuration details of the application.
Step 1: Unzip the archive downloaded.
Step 2: Edit the service file FXBroadcaster.php, which can be found at the amfphp/services/ folder, in your favorite text editor.
Step 3: Locate the following lines of code and change as necessary
Server Types:
save the edited information in editor and exit.
Step 4: Copy the amfphp folder to your site/domain. Its preferred that you upload the entire folder to your site root eg: http://www.yourdomain.com/amfphp/ , You may also choose to rename the folder to something else eg: http://www.yourdomain.com/flashservices/
Note: You may also download amfphp from its sourceforge page. In that case make sure you delete the the browser folder -> amfphp/browser and the amfphp folder in services -> services/amfphp for security.
Step 5: On the client side we simply embed the swf in the page that we wish to use the recorder in. To do so the recommended approach is using swfobject. You can read more about swfobject at its google code page. Below is a sample implementation of embedding with swfobject JavaScript.
The following is the basic javascript required to get the recorder running on your page. It contains embedding swf with swfobject, adding event listeners to recorder via javascript and configuring the amfphp path for your recorder. This way of embedding is particularly necessary to get the addListeners methods to register properly.
flashvars is the object through which a swf receives input from the html page. These inputs are typically application specific variables. In our case we use one variable called gatewayURL. This variable contains the path of amfphp gateway which will be used by the application for all server side communications
params is a object used for providing config information to the flash player.This info is generic to flash player. In our case we provide 3 config infos:
wmode : Tell flash player to use a specified wmode
allowscriptaccess: Enable all communications with javascript
base: Path to your swf folder where FXBroadcaster.swf can be found. This is used to look up the core flex swf libraries when loading for the first time. Once loaded the flex framework is cached to client's flash player (not browser cache). Hence subsequent load times are short.
attributes is used to provide a name to the swf item in the HTML page. this object will contain the swf identification name in two parts: id and name. id corresponds to IE and name corresponds to Netscape type browsers.
After embed is successful using swfobject's embedSWF function the swfs begins loading. Once the swf has completely loaded it triggers the onBroadcasterReady function along with its id/name property. This is where we attach Event handlers to the application so that it can notify its events to the HTML DOM. We will see a list of event notifications that the recorder broadcasts a little later in this article. In the basic embed example we handle the SESSIONSAVESUCCESS and SESSIONSAVEFAILED events.
| Variable Name | Variable Value |
| serviceLocation | Path to your amfphp installation (Not required if amfphp is installed at root by default foldername) ** |
| skin | Path to skin swf file |
** By default the name for amfphp folder is "amfphp". If this is not the folder name you want to use, or if you want amfgphp installed inside a sub folder , then you need to use the serviceLocation flashvars as shown below:
or
| Event Name | Callback parmeters |
| SESSIONSAVESUCCESS | Stream Name, Duration |
| SESSIONSAVEFAILED | Stream Name, Duration |
| CAMERAINITIALIZE | Camera name |
| CONNECTSUCCESS | NULL |
| CONNECTFAILED | NULL |
| MICROPHONEINITIALIZE | Microphone name |
| BROADCASTBEGIN | Stream Name |
| BROADCASTEND | Stream Name |
Note: To capture a single parameter use: eval(params)[0] and for multiple parameters use eval(params)[0],eval(params)[1],eval(params)[2] etc: The first parameter,objid always refers to the id/name of the swf item invoking the function.
Example:
| Variable Name | Value Type | Default | Description |
| licencekey | YOUR-LICENCE-KEY | Your product license | |
| publishName | demo | NULL | Stream Name |
| destination | rtmp://server/appname/instance | NULL |
RTMP/RTMPT/RTMPS/RTMFP url for publishing |
| broadcastTime | 500 | 0 | Broadcast duration limit in seconds. (set 0 for unlimited) |
| bwcheck | NA | NA | NA |
| server | RED5 | RED5 | Server Type (RED5/FMS/WOWZA) |
| broadcastMode | duplex | duplex | audio/video/duplex |
| debug | true | false | Show debug panel or not (true/false) |
| logo | path/to/mycompanylogo.png | NULL | path to your logo in gif or png format preferred. (35 x 100) MAX |
| autoSnapInterval | 15 | 0 |
WMLE auto snaps webcam image in specified seconds. This can be used to show preview of broadcast in webpage |
| playback | rtmp://server/appname/instance | NULL | RTMP/RTMPT/RTMPS/RTMFP url for playback |
| enableAutoSense | true/false | false | Enables/Disables Streaming intelligence program |
| controlFrameDrop | true/false | false | Specifies whether streaming intelligence should control frame drops or not |
| forceQuality | Quality constant from BroadcastQuality Class | BroadcastQuality.AVERAGE | Preset quality setting selector |
| disableInteraction | true/false | false | Locks out user from making any manual changes in quality settings |
Usage in php service file - FXBroadcaster.php
| Resolution Label | Resolution Width | Resolution Height |
| WEB LOW | 80 | 60 |
| WEB BASIC | 100 | 75 |
| WEB AVERAGE | 120 | 90 |
| WEB GOOD | 140 | 105 |
| WEB HIGH | 160 | 120 |
| WEB BEST | 176 | 144 |
| STANDARD CIF/SIF | 352 | 288 |
| STANDARD SIF | 320 | 240 |
| 480P | 640 | 480 |
The flex architecture opens up a whole new world of options for skinning your application. Flex skins work pretty much the same way as css in ordinary html. But unlike the open css document, flex skins are compiled into swfs which can be loaded/unloaded at runtime, thus making your deployment hassle free. You no longer have to store the images used in the flex skin on your server, The single compiled skin swf will contain every graphic asset required by the application.
To use the skinning option, simply use the skin variable in flashvars to pass in the url of your skin swf and wath the magic.
WMLE is the only product online today which supports RTMP as well as RTMFP out of the box. RTMFP is a relatively new protocol by adobe's flash player 10 which forms a baseline for p2p communication. Meaning you can broadcast video/audio to clients without the need of any server.
For handshaking although Adobe cirrus rendezvous service may be used. You can get more info on RTMFP and your cirrus key from Adobe's webpage:
http://labs.adobe.com/technologies/cirrus/
Once you have the key, you can follow the steps below to setup p2p streaming using WMLE and our very own free p2p multicast player.
URL: rtmfp://p2p.rtmfp.net/xxxxxxxxxxxxxxxxxxxxxxxxxxx/channel
sampleplayer.php
services/PeerToPeer
services/lib/cryptlib.php
swf/viewer.swf
Edit the file services/PeerToPeer.php and make necessary changes to the section shown below. You can add more streams by duplicating this line and making changes.
"idcode" => An aphanumeric id code to help retrieve playback details
"channelname" => The channel name. Same as used in WMLE when broadcasting
"password" => protection password (Not required)
"stream" => The stream name as used in WMLE when broadcasting
"rtmfp" => Your RTMFP url
Once the stream setup is complete you need to set the domains that are allowed to read data from this service. This provides greater level of security for your broadcast. To add/remove domains edit the following:
Note: For allowing a domain, it must be added to both html domains and swf domains.
Edit the file, sampleplayer.php as shown below and set the same idcode that you did in backend service. This helps the player to retrieve the playback details from service by matching the idcode.
"idcode" => An aphanumeric id code to help retrieve playback details
Note: The password for encryption is "PASSWORD" by default, and can be changed. To change this you need to make changes in PeerToPeer.php and sampleplayer.php where-ever it occurs.