header_graphic
header_gradient
 
  • Posted by ESA
  • Comments Off

The HD Media Player supports the use of FlashVars in the html “Flash Object and Embed Tags” for dynamic media loading. To enable the use of FlashVars, the embed script must be set up as shown below, the “mediaSource” parameter in the MediaPlayer’s Component Inspector must be blank prior to publishing the SWF (should be blank by default), and the action script in this post must be in the actions panel (included in all skins).

Embed Script:
Below is a typical set of object and embed tags used to embed one of our players into a webpage (notice the FlashVars in red). If you are not familiar with our recommended embed script, please see the “Simple Embed” tutorial for more details.

<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″
codebase=”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0″
width=”640″ height=”390″ id=”ESAHDMP” >
<param name=”movie” value=”default.swf” />
<param name=”allowfullscreen” value=”true”/>
<param name=”allowscriptaccess” value=”always”/>
<param name=”FlashVars” value=”media=media.xml” />
<param name=”wmode” value=”transparent” />
<embed src=”default.swf” width=”640″ height=”390″ FlashVars=”media=media.xmlallowfullscreen=”true”
allowscriptaccess=”always” type=”application/x-shockwave-flash” wmode=”transparent”
pluginspage=”http://www.macromedia.com/go/getflashplayer” name=”ESAHDMP” />
</object>

With all of our default players (starting v.1.5.3), you can use following FlashVars to configure the player on pageload:

  • autoplay – Options: “Yes-always”, “Yes-on first video”, “No-always”, “No-on first video”.
  • image - Absolute or relative path to an image file to be used as a preloader, pause image, or in support of an audio file. If you use a relative path it must be relative to the location of the page where the SWF is displayed, not the location of the SWF on your server.
  • link – URL where user will be directed if they click the screen.
  • instance – Options: “application” or ”stream”. Determines if the first instance in a rtmp path should be attributed to the application or stream name. For example: if your rtmp path is rtmp://www.server.com/application/instance/stream, and /instance/ is part of the stream name choose “stream”; or if /instance/ is part of the application name choose “application”.
  • media – Absolute or relative path to a single audio/video file or a XML playlist file that has the “.xml” extension. In the above example, the player would load “media.xml”. If you use a relative path it must be relative to the location of the page where the SWF is displayed, not the location of the SWF on your server. Progressive (http) and streaming (rtmp or rtmpe) protocols are supported for audio and video files, meaning you can host your media files on any standard web server, Flash Media Server 3/4 (FMS or FMIS), Wowza, Red5, or YouTube.
  • xml - Absolute or relative path to a XML playlist file that does not have the “.xml” extension (e.g. xml generated with ASP or PHP). If you use a relative path it must be relative to the location of the page where the SWF is displayed, not the location of the SWF on your server.
  • wizard – (v.2 or later) wizard settings array; this variable should only be used with the Skin Wizard.

You must choose either the “media” or “xml” FlashVars to load your media item(s) – you can not use both at the same time. Typically, when you load a XML file the other FlashVars are unnecessary, because those variables can be defined in the XML. When loading single media items, you can define multiple FlashVars using the “&” symbol as a separator, and the “media” FlashVars should be defined last, as shown below:

“autoplay=No-always&image=image.jpg&link=http://www.domain.com&media=video.flv”

Action Script 3.0:
The following action script detects the FlashVars (red text) in the embed code upon pageload and passes those variables into the MediaPlayer component at run-time. This script is included in our default player FLA (v.2 or later; differs slightly in previous version numbers and other skins), and can be accessed in the actions panel (scene 1, frame 1).

//—Load Media Using FlashVars—
if(myMediaPlayer.mediaSource == “”){
try {
var media:String;
var id:*;
var xml:Boolean;
var keyStr:String;
var valueStr:*; //String
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
if(keyStr == “autoplay“) myMediaPlayer.mediaAutoPlay = valueStr;
if(keyStr == “image“) myMediaPlayer.imageSource = valueStr;
if(keyStr == “link“) myMediaPlayer.mediaLink = valueStr; //must set link target in fla or xml
if(keyStr == “instance“) myMediaPlayer.mediaSourceInstance = valueStr;
if(keyStr == “media” && media == “”) media = valueStr;
if(keyStr == “id” && id == 0) id = valueStr;
if(keyStr == “xml” && media == “”){
xml = true;
media = valueStr;
}
if(keyStr == “wizard“){
config(valueStr.split(”,”));
}
}
} catch (error:Error) {
trace(”Undefined Media”);
}
if(id != 0){
myMediaPlayer.loadXMLAtID(media,id);
} else if(id == 0 && xml){
myMediaPlayer.loadXML(media);
} else {
myMediaPlayer.loadMedia(media);
}
}

Working with a Flash Media Server?
If you are loading media files that are hosted on a Flash Media Server you should refer to our tutorial, “Working With A Flash Media Server” for instructions.

Comments are closed.

footer_graphic

Support - Documentation - Skin Wizard - Sample Skins - Tutorials
Copyright © 2003-2011 Earth Science Agency, LLC - All Rights Reserved