胡斌

video player of AdobeMediaServer Demo,

try to modify to demo liveAssistant
<!--
/*
* (C) Copyright 2011 Adobe Systems Incorporated. All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
* terms of the Adobe license agreement accompanying it. If you have received this file from a
* source other than Adobe, then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
* THIS CODE AND INFORMATION IS PROVIDED "AS-IS" WITHOUT WARRANTY OF
* ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
* PARTICULAR PURPOSE.
*
* THIS CODE IS NOT SUPPORTED BY Adobe Systems Incorporated.
*
*/
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Adobe Flash Media Server</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
td img {display: block;}body {
background-color: #191919;
}
a:link {
text-decoration: none;
color: #F00;
}
a:hover {
text-decoration: underline;
color: #F00;
}
a:visited {
text-decoration: none;
color: #F00;
}
a:active {
text-decoration: none;
color: #F00;
}
.style22 {
color: #666666;
}
.style23 {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.style31 {
font-family: "Arial";
color: #999999;
font-size: 12px;
font-weight: bold;
}
.style34 {
font-family: "Arial";
}
.style24 { font-size: 11px;
color: #999999;
font-family: Arial, Helvetica, sans-serif;
}
.style62 {
font-size: 12px; color: #999999;
font-family: "myriad Pro";
}
.style67 {
font-family: "myriad Pro";
color: #999999;
font-size: 12px;
font-weight: bold;
}
.style69 {
font-family: "Arial";
color: #999999;
font-weight: bold;
}
.style1 {
font-family: Arial, Helvetica, sans-serif;
color: #999999;
font-size: 14px;
font-weight: bold;
}
.style3 {
font-family: "Arial";
font-size: 12px;
line-height: normal;
height: 10px;
}
.style71 {
font-family: "myriad Pro";
}
.style73 {
font-family: Arial;
color: #999999;
font-size: 12px;
font-weight: bold;
}
.style74 {
font-size: 12px;
color: #999999;
font-family: Arial;
}
.style75 {
font-family: Arial;
color: #CCC;
font-size: 12px;
font-weight: bold;
}
.style76 {
font-size: 12px;
font-family: Arial;
color: #FF0000;
}
.style81 {
font-family: Arial;
}
.style82 {
color: #999999;
font-size: 12px;
}
.style83 {
font-size: 12px;
font-weight: bold;
color: #999999;
}
</style>
<!-- functionality -->
<script type="text/javascript" src="scripts/swfobject.js"></script>
<script language="javascript">
var queryParameters = new Array();
var flashVars = "";
var tag = "";
var url = "";
window.onload = function ()
{
document.getElementById( 'inputURL' ).value = queryParameters['source'];
document.getElementById('embedField').innerHTML = tag;
for(var i=1 ; i<=10;i++)
{
var ids = String("sel"+i.toString());
document.getElementById( ids ).style.visibility = "hidden";
document.getElementById( ids ).className = "style76";
}
// mark the entry for that index
if(queryParameters['idx'] != "")
{
document.getElementById("td" + queryParameters['idx'] ).className = "style75";
document.getElementById("sel" + queryParameters['idx'] ).style.visibility = "visible";
}
}
function initialise()
{
function getUrlParam( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return unescape( results[1] );
}
queryParameters['source'] = getUrlParam('source');
queryParameters['type'] = getUrlParam('type');
queryParameters['idx'] = getUrlParam('idx');
if( queryParameters['source'] == "" )
queryParameters['source'] = "rtmp://localhost/vod/mp4:sample1_500kbps.f4v";
if( queryParameters['type'] == "" )
queryParameters['type'] = "recorded";
if( queryParameters['idx'] == "" )
queryParameters['idx'] = "2";
flashVars += "&src=";
flashVars += queryParameters['source'];
flashVars += "&autoHideControlBar=";
flashVars += unescape("true");
flashVars += "&streamType=";
flashVars += queryParameters['type'];
flashVars += "&autoPlay=";
flashVars += unescape("true");
flashVars += "&verbose=";
flashVars += "true";
var soFlashVars = {
src: queryParameters['source'],
streamType: queryParameters['type'],
autoPlay: "true",
controlBarAutoHide: "true",
controlBarPosition: "bottom"
};
tag = "&lt;object width='640' height='377' id='StrobeMediaPlayback' name='StrobeMediaPlayback' type='application/x-shockwave-flash' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' &gt;&lt;param name='movie' value='swfs/StrobeMediaPlayback.swf' /&gt; &lt;param name='quality' value='high' /&gt; &lt;param name='bgcolor' value='#000000' /&gt; &lt;param name='allowfullscreen' value='true' /&gt; &lt;param name='flashvars' value= '"+
flashVars+"'/&gt;&lt;embed src='swfs/StrobeMediaPlayback.swf' width='640' height='377' id='StrobeMediaPlayback' quality='high' bgcolor='#000000' name='StrobeMediaPlayback' allowfullscreen='true' pluginspage='http://www.adobe.com/go/getflashplayer' flashvars='"+ flashVars +"' type='application/x-shockwave-flash'&gt; &lt;/embed&gt;&lt;/object&gt;";
<!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. -->
var swfVersionStr = "10.3.0";
<!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
var xiSwfUrlStr = "swfs/playerProductInstall.swf";
var params = {};
params.quality = "high";
params.bgcolor = "#000000";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "StrobeMediaPlayback";
attributes.name = "StrobeMediaPlayback";
attributes.align = "middle";
swfobject.embedSWF("swfs/StrobeMediaPlayback.swf", "flashContent", "640", "377", swfVersionStr, xiSwfUrlStr, soFlashVars, params, attributes);
<!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
}
function playStream()
{
var url = "source=" + document.getElementById('inputURL').value;
var type;
if(document.getElementById('vodCheckbox').checked==true)
type="vod";
else
type="live";
url += ("&type=" + type);
document.getElementById('playBtn').href="videoplayer.html?" + url;
}
function checkbox(type)
{
if(type=="vod")
{
if(document.getElementById('liveCheckbox').checked==true)
{
document.getElementById('liveCheckbox').checked=false;
}
}
if(type=="live")
{
if(document.getElementById('vodCheckbox').checked==true)
{
document.getElementById('vodCheckbox').checked=false;
}
}
}
initialise();
</script>
</head>
<body>
<table width="100" height="" border="0" align="left" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="080715_fms_splash_fireworks.png" fwbase="index.gif" fwstyle="Dreamweaver" fwdocid = "1526025482" fwnested="0" -->
<tr><td width="41"><img src="images/spacer.gif" width="41" height="1" border="0" alt="" /></td>
<td width="3"><img src="images/spacer.gif" width="3" height="1" border="0" alt="" /></td>
<td width="647"><img src="images/spacer.gif" width="636" height="1" border="0" alt="" /></td>
<td width="361"><img src="images/spacer.gif" width="358" height="1" border="0" alt="" /></td>
<td width="44"><img src="images/spacer.gif" width="43" height="1" border="0" alt="" /></td>
</tr>
<tr valign="top">
<td rowspan="4" bgcolor="#191919"><img src="images/spacer.gif" width="55" height="50" /></td>
<td rowspan="4"></td>
<td height="327" colspan="3" bgcolor="#191919"><map name="index_r4_c3MapMap" id="index_r4_c3MapMap">
<area shape="rect" coords="32,160,308,181" href="fms_adminConsole.htm" target="_blank" />
<area shape="rect" coords="316,161,433,181" href="#" />
</map>
<map name="index_r2_c4MapMap" id="index_r2_c4MapMap">
<area shape="rect" coords="20,21,55,61" href="http://www.adobe.com" target="_blank" />
</map>
<map name="index_r4_c3Map" id="index_r4_c3Map">
<area shape="rect" coords="32,160,308,181" href="fms_adminConsole.htm" target="_blank" />
<area shape="rect" coords="316,161,433,181" href="#" />
</map>
<map name="index_r2_c4Map" id="index_r2_c4Map">
<area shape="rect" coords="20,21,55,61" href="http://www.adobe.com" target="_blank" />
</map>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="61" colspan="4" bgcolor="#191919"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="93%"><table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4" align="left" bgcolor="#191919"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/top_bar_border.gif" width="1000" height="15" /></td>
</tr>
<tr>
<td><img src="images/title.gif" width="1000" height="66" border="0" usemap="#Map" /></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="4" align="left" bgcolor="#191919"><img src="images/canvas.gif" alt="" name="index_r4_c3" width="1000" height="39" border="0" id="index_r4_c3"/></td>
</tr>
<tr>
<td colspan="4" align="left" bgcolor="#191919"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="64%"><table width="65%" border="0" cellspacing="0" cellpadding="0">
<tr>
<!-- Here goes the StrobeMediaPlayback -->
<td valign="top">
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>To view this page ensure that Adobe Flash Player version 10.3.0 or greater is installed.</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<a href="http://www.adobe.com/go/getflashplayer/" style="color:black"><img src="images/ERROR_getFlashPlayer.gif" width="640" height="377" /></a>
</noscript>
</td>
</tr>
</table></td>
<td width="36%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="359" height="186" background="images/upperright_03.gif"><table width="358" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="35" colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td>
<td width="323"><span class="style75">SELECT A VIDEO FROM THE LIST BELOW</span></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td>
<td><span class="style75">SOURCE: /applications/vod/media</span></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel1"><span class="style74">&gt;</span></td>
<td id="td1" class="style76"><a href="videoplayer.html?source=rtmp://localhost/vod/mp4:sample1_150kbps.f4v&type=recorded&idx=1">sample1_150kbps.f4v</a></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="10" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="15" height="5" /></td>
<td id="sel2"><span class="style74">&gt;</span></td>
<td class="style76" id="td2"> <a href="videoplayer.html?source=rtmp://localhost/vod/mp4:sample1_500kbps.f4v&type=recorded&idx=2">sample1_500kbps.f4v</a></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel3"><span class="style74">&gt;</span></td>
<td id="td3" class="style76"><a href="videoplayer.html?source=rtmp://localhost/vod/mp4:sample1_700kbps.f4v&type=recorded&idx=3">sample1_700kbps.f4v</a></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel4"><span class="style74">&gt;</span></td>
<td id="td4" class="style76"><a href="videoplayer.html?source=rtmp://localhost/vod/mp4:sample1_1000kbps.f4v&type=recorded&idx=4">sample1_1000kbps.f4v</a></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel5"><span class="style74">&gt;</span></td>
<td id="td5" class="style76"><a href="videoplayer.html?source=rtmp://localhost/vod/mp4:sample1_1500kbps.f4v&type=recorded&idx=5">sample1_1500kbps.f4v</a></td>
</tr>
<tr>
<td colspan="3"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel6"><span class="style74">&gt;</span></td>
<td id="td6" class="style76"><a href="videoplayer.html?source=rtmp://localhost/vod/sample&type=recorded&idx=6">sample.flv</a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="359" height="114" background="images/middleright_05.gif"><table width="358" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td>
<td width="323" class="style75">SOURCE: /webroot/vod</td>
</tr>
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel7"><span class="style74">&gt;</span></td>
<td id="td7" class="style76"><a href="videoplayer.html?source=hds_sample1_manifest.f4m&type=recorded&idx=7" title="Only works when viewed from localhost.">hds_sample1_manifest.f4m</a></td>
</tr>
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
</tr><tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel8"><span class="style74">&gt;</span></td>
<td id="td8" class="style76"><a href="videoplayer.html?source=rtmp_sample1_manifest.f4m&type=recorded&idx=8" title="Only works when viewed from localhost.">rtmp_sample1_manifest.f4m</a></td>
</tr>
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel9"><span class="style74">&gt;</span></td>
<td id="td9" class="style76"><a href="videoplayer.html?source=http://localhost/vod/sample2_1000kbps.f4v&type=recorded&idx=9">sample2_1000kbps.f4v (http progressive)</a></td>
</tr>
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel10"><span class="style74">&gt;</span></td>
<td id="td10" class="style76"><a href="videoplayer.html?source=rtmp://localhost/vod/mp4:sample2_1000kbps.f4v&type=recorded&idx=10">sample2_1000kbps.f4v (rtmp)</a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="359" height="77" background="images/lowerright_07.gif"><table width="358" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="10" /></td>
<td width="322" class="style75">SOURCE: /applications/live</td>
</tr>
<tr>
<td colspan="2"><img src="images/spacer.gif" width="20" height="5" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="20" height="10" /></td>
<td id="sel11"><span class="style74">&gt;</span></td>
<td id="td11" class="style76"><a href="videoplayer.html?source=rtmp://localhost/live/livestream&type=live&idx=11">livestream</a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="7%">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top" bgcolor="#191919"><table width="100" border="0" align="left" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="080715_fms_splash_fireworks.png" fwbase="index.gif" fwstyle="Dreamweaver" fwdocid = "1526025482" fwnested="0" -->
<tr>
<td colspan="3" valign="top"><img src="images/spacer.gif" width="55" height="40" /></td>
</tr>
<tr>
<td colspan="3" valign="top"><table width="87%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><span class="style69">STREAM YOUR OWN VIDEO</span></td>
</tr>
<tr>
<td bgcolor="#666666"><img src="images/spacer.gif" width="20" height="3" /></td>
</tr>
<tr>
<td><img src="images/spacer.gif" width="55" height="10" /></td>
</tr>
<tr>
<td><table width="1000" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="8%"><table width="86" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left"><span class="style73">STREAM URL:</span></td>
</tr>
</table></td>
<td align="left"></td>
<td align="left"><input name="inputURL" type="text" id="inputURL" size="80" maxlength="80" /></td>
<td width="42%" align="left"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="5%" align="left"><img src="images/spacer.gif" width="10" height="10" /></td>
<td width="7%" align="left"><table width="0" >
<tr>
<td align="left"><div align="center">
<input type="checkbox" name="checkbox" id="vodCheckbox" checked onclick="checkbox('vod');" />
</div></td>
</tr>
</table></td>
<td width="2%" align="left"><img src="images/spacer.gif" width="10" height="10" /></td>
<td width="6%" align="left"><div align="center"><span class="style31">VOD</span></div></td>
<td width="5%" align="left"><img src="images/spacer.gif" width="10" height="10" /></td>
<td width="5%" align="left"><div align="center">
<input type="checkbox" name="checkbox2" id="liveCheckbox" onclick="checkbox('live');" />
</div></td>
<td width="2%" align="left"><img src="images/spacer.gif" width="10" height="10" /></td>
<td width="6%" align="left"><span class="style31">LIVE</span></td>
<td width="5%" align="left"><img src="images/spacer.gif" width="10" height="10" /></td>
<td width="27%" align="left"><a id="playBtn" onclick="javascript:playStream();"><img src="images/playstream_10.gif" width="104" height="25" /></a></td>
<td align="left">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td align="left" class="style74">URL Syntax: [protocol]://[servername]/[application]/[codecID:][streamname][.extension]</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" valign="top"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3"><span class="style73"></span></td>
</tr>
<tr>
<td colspan="3"><span class="style75"></span></td>
</tr>
<tr>
<td colspan="3"><span class="style67"><img src="images/spacer.gif" width="56" height="10" /></span></td>
</tr>
<tr>
<td width="32%" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="style73">RTMP STREAMING</td>
</tr>
<tr>
<td valign="top" class="style75">from the folder: /webroot/vod</td>
</tr>
<tr>
<td valign="top"><img src="images/spacer.gif" width="40" height="5" border="0" /></td>
</tr>
<tr>
<td bgcolor="#666666"><img src="images/spacer.gif" width="490" height="3" /></td>
</tr>
<tr>
<td valign="top"><img src="images/spacer.gif" width="56" height="20" /></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="style34"><table width="490" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" valign="top" class="style74">1)</td>
<td width="93%" class="style74">[<strong>protocol</strong>]: You can use the following protocols: rtmp, rtmpt, rtmpe, rtmpte, rtmps.</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">2)</td>
<td class="style74">[<strong>servername</strong>]: This is the IP Address or the domain name of your server (for example, localhost).</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">3)</td>
<td class="style74">[<strong>application</strong>]: Use "vod" unless you have changed the name of the folder.</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">4)</td>
<td class="style74">[<strong>codecID</strong>]: </td>
</tr>
<tr>
<td colspan="2" valign="top" class="style24"><img src="images/spacer.gif" width="5" height="10" /></td>
</tr>
<tr>
<td valign="top" class="style62">&nbsp;</td>
<td class="style74"><blockquote>
<p> For H264/mov/F4V use "mp4:".<br />
For FLV files, do not specify a codecID.</p>
</blockquote></td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">5)</td>
<td class="style74">[<strong>streamname</strong>]: Use the name of your video file. </td>
</tr>
<tr>
<td colspan="2" class="style24"><img src="images/spacer.gif" width="5" height="10" /></td>
</tr>
<tr>
<td valign="top" class="style74">6)</td>
<td class="style74">[<strong>extension</strong>]: </td>
</tr>
<tr>
<td colspan="2" class="style24"><img src="images/spacer.gif" width="5" height="10" /></td>
</tr>
<tr>
<td valign="top" class="style62">&nbsp;</td>
<td class="style74"><blockquote>
<p>For F4V/MP4 files, specify a file extension.<br />
For MP3 and FLV, do not specify a file extension.</p>
</blockquote></td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style74"><strong>EXAMPLE URLS</strong></td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style74">rtmp://localhost/vod/mp4:mystream.f4v</td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style74">rtmpe://192.168.0.1/vod/myvideo</td>
</tr>
</table></td>
</tr>
</table> <span class="style34"></span></td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
</tr>
</table></td>
<td width="30%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="middle"><img src="images/spacer.gif" width="20" height="50" /></td>
</tr>
</table></td>
<td width="38%" valign="top"><table width="100" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="style67"><span class="style73">HTTP DYNAMIC STREAMING</span><br /></td>
</tr>
<tr>
<td valign="top" class="style75">from the folder: /webroot/vod</td>
</tr>
<tr>
<td valign="top"><img src="images/spacer.gif" width="40" height="5" border="0" /></td>
</tr>
<tr>
<td bgcolor="#666666"><img src="images/spacer.gif" width="490" height="3" /></td>
</tr>
<tr>
<td valign="top"><img src="images/spacer.gif" width="56" height="20" /></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="style34"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" class="style34"><table width="489" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" valign="top" class="style74">1)</td>
<td width="93%" class="style74">[<strong>protocol</strong>]: HTTP</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">2)</td>
<td class="style74">[<strong>server</strong>]: This is the IP Address or the domain name of your server (for example, localhost).</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">3)</td>
<td class="style74">[<strong>application</strong>]: </td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style62">&nbsp;</td>
<td valign="top" class="style74">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="31%" valign="top" class="style74"><strong>For VOD</strong><br /> Flash: "hds-vod"</td>
<td width="69%" valign="top" class="style74"><strong>For LIVE</strong><br /> Flash: "/hds-live/livepkgr/_definst_/liveevent/"</td>
</tr></table>
</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="15" /></td>
</tr>
<tr>
<td valign="top" class="style74">4)</td>
<td class="style74">[<strong>codecID</strong>]: Not required</td>
</tr>
<tr>
<td colspan="2" valign="top" class="style62"><img src="images/spacer.gif" width="5" height="10" /></td>
</tr>
<tr>
<td valign="top" class="style74">5)</td>
<td class="style74">[<strong>streamname</strong>]: The name of the MP4/F4V media file</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="5" height="10" /></td>
</tr>
<tr>
<td valign="top" class="style74">6)</td>
<td class="style74">[<strong>extension</strong>]: The extension of the media file + &quot;.f4m. </td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="5" /></td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style73">EXAMPLE VOD URL</td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style74">http://localhost/hds-vod/sample1_500kbps.f4v.f4m</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="5" /></td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style73">EXAMPLE LIVE URL</td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style74">
http://localhost/hds-live/livepkgr/_definst_/liveevent/livestream.f4m</td>
</tr>
<tr>
<td colspan="2" class="style62"><img src="images/spacer.gif" width="10" height="5" /></td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style73">EXAMPLE LIVE PUBLISHING URLS (IN FLASH MEDIA LIVE ENCODER)</td>
</tr>
<tr>
<td class="style62">&nbsp;</td>
<td class="style74">
a. <strong>FMS Server URL:</strong> rtmp://localhost/livepkgr<br />
&nbsp;&nbsp;&nbsp;&nbsp;<strong>Note:</strong> Publish the stream to the server over the RTMP protocol.<br />
c. <strong>Stream Name (Single Bitrate):</strong>
livestream?adbe-live-event=liveevent<br />
d. <strong>Stream Name (Adaptive Bitrate):</strong>
livestream%i?adbe-live-event=liveevent<br />
</td>
</tr>
</table></td>
</tr>
<tr>
<td class="style34">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
<span class="style34"></span></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="bottom" class="style67"><span class="style1"><span class="style73">EMBED CODE</span><br />
</span></td>
</tr>
<tr>
<td valign="top" class="style67"><span class="style1"><img src="images/spacer.gif" width="40" height="5" /></span></td>
</tr>
<tr>
<td bgcolor="#666666" class="style67"><img src="images/spacer.gif" width="306" height="3" /></td>
</tr>
<tr>
<td class="style67">&nbsp;</td>
</tr>
<tr>
<td class="style74">Copy and paste the following code into an HTML file to embed the video player in a web page. Place the HTML page in the /webroot folder. <br />
TIP: If you enter a Stream URL above, this embed code updates automatically. </td>
</tr>
<tr>
<td><table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="5">&nbsp;</td>
</tr>
<tr>
<td colspan="5" bgcolor="#FFFFFF" class="style3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%"><img src="images/spacer.gif" width="15" height="5" /></td>
<td width="97%" class="style71" id="embedField" >
&lt;object width='640' height='377' id='StrobeMediaPlayback' name='StrobeMediaPlayback' type='application/x-shockwave-flash' classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' &gt;&lt;param name='movie' value='swfs/StrobeMediaPlayback.swf' /&gt; &lt;param name='quality' value='high' /&gt; &lt;param name='bgcolor' value='#000000' /&gt; &lt;param name='allowfullscreen' value='true' /&gt; &lt;param name='flashvars' value='&amp;videoWidth=0&amp;videoHeight=0&amp;dsControl=manual&amp;dsSensitivity=100&amp;serverURL=rtmp://localhost/vod/mp4:sample1_500kbps.f4v&amp;streamType=vod&amp;autoStart=true'/&gt; &lt;embed src='swfs/StrobeMediaPlayback.swf' width='640' height='377' id='StrobeMediaPlayback' quality='high' bgcolor='#000000' name='StrobeMediaPlayback' allowfullscreen='true' pluginspage='http://www.adobe.com/go/getflashplayer 'flashvars='&amp;videoWidth=0&amp;videoHeight=0&amp;dsControl=manual&amp;dsSensitivity=100&amp;serverURL=rtmp://localhost/vod/mp4:sample1_500kbps.f4v&amp;streamType=vod&amp;autoStart=true' type='application/x-shockwave-flash'&gt; &lt;/embed&gt;&lt;/object&gt;</td>
<td width="2%"><img src="images/spacer.gif" width="10" height="5" /></td>
</tr>
</table>
<br /></td>
</tr>
<tr>
<td colspan="5">&nbsp;</td>
</tr>
</table></td>
</tr>
</table> </td>
</tr>
<tr>
<td width="1012" colspan="3" valign="top">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top" bgcolor="#191919"><table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1000" height="24" valign="middle" background="images/footer_bar.gif"><table width="99%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1000"><div align="right" class="style81"><span class="style82">Copyright © 2011 Adobe Systems Incorporated.&nbsp; &nbsp;</span><span class="style83">All rights reserved.</span></div></td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="99%" valign="top"><div align="right" class="style22">
<div align="right"><span class="style23">Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy</span>.</div>
</div></td>
<td width="1%" valign="top"><img src="images/spacer.gif" width="13" height="10" /></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2" valign="top" bgcolor="#191919"><img src="images/spacer.gif" width="55" height="60" /></td>
</tr>
</table>
<map name="Map" id="Map"><area shape="rect" coords="948,12,985,57" href="http://www.adobe.com" target="_blank" />
</map></body>
</html>
... ...
<manifest xmlns="http://ns.adobe.com/f4m/2.0">
<media href="http://localhost/hds-vod/sample1_150kbps.f4v.f4m" bitrate="150"/>
<media href="http://localhost/hds-vod/sample1_500kbps.f4v.f4m" bitrate="500"/>
<media href="http://localhost/hds-vod/sample1_700kbps.f4v.f4m" bitrate="700"/>
<media href="http://localhost/hds-vod/sample1_1000kbps.f4v.f4m" bitrate="1000"/>
<media href="http://localhost/hds-vod/sample1_1500kbps.f4v.f4m" bitrate="1500"/>
</manifest>
\ No newline at end of file
... ...
不能预览此文件类型
<manifest xmlns="http://ns.adobe.com/f4m/1.0">
<id>Dynamic Streaming</id>
<baseURL>rtmp://localhost/vod/</baseURL>
<mimeType>video/mp4</mimeType>
<streamType>recorded</streamType>
<media url="mp4:sample1_150kbps.f4v" bitrate="150"/>
<media url="mp4:sample1_500kbps.f4v" bitrate="500"/>
<media url="mp4:sample1_700kbps.f4v" bitrate="700"/>
<media url="mp4:sample1_1000kbps.f4v" bitrate="1000"/>
<media url="mp4:sample1_1500kbps.f4v" bitrate="1500"/>
</manifest>
\ No newline at end of file
... ...
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
FLASH_MIME_TYPE = "application/x-shockwave-flash",
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
ON_READY_STATE_CHANGE = "onreadystatechange",
win = window,
doc = document,
nav = navigator,
plugin = false,
domLoadFnArr = [main],
regObjArr = [],
objIdArr = [],
listenersArr = [],
storedAltContent,
storedAltContentId,
storedCallbackFn,
storedCallbackObj,
isDomLoaded = false,
isExpressInstallActive = false,
dynamicStylesheet,
dynamicStylesheetMedia,
autoHideShow = true,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
- Is executed directly for optimal performance
*/
ua = function() {
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
u = nav.userAgent.toLowerCase(),
p = nav.platform.toLowerCase(),
windows = p ? /win/.test(p) : /win/.test(u),
mac = p ? /mac/.test(p) : /mac/.test(u),
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
playerVersion = [0,0,0],
d = null;
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
d = nav.plugins[SHOCKWAVE_FLASH].description;
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
plugin = true;
ie = false; // cascaded feature detection for Internet Explorer
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
}
}
else if (typeof win.ActiveXObject != UNDEF) {
try {
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
if (a) { // a will return null when ActiveX is disabled
d = a.GetVariable("$version");
if (d) {
ie = true; // cascaded feature detection for Internet Explorer
d = d.split(" ")[1].split(",");
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
}
catch(e) {}
}
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
}(),
/* Cross-browser onDomLoad
- Will fire an event as soon as the DOM of a web page is loaded
- Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- Regular onload serves as fallback
*/
onDomLoad = function() {
if (!ua.w3) { return; }
if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
callDomLoadFunctions();
}
if (!isDomLoaded) {
if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
}
if (ua.ie && ua.win) {
doc.attachEvent(ON_READY_STATE_CHANGE, function() {
if (doc.readyState == "complete") {
doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
callDomLoadFunctions();
}
});
if (win == top) { // if not inside an iframe
(function(){
if (isDomLoaded) { return; }
try {
doc.documentElement.doScroll("left");
}
catch(e) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
}
if (ua.wk) {
(function(){
if (isDomLoaded) { return; }
if (!/loaded|complete/.test(doc.readyState)) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
addLoadEvent(callDomLoadFunctions);
}
}();
function callDomLoadFunctions() {
if (isDomLoaded) { return; }
try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);
}
catch (e) { return; }
isDomLoaded = true;
var dl = domLoadFnArr.length;
for (var i = 0; i < dl; i++) {
domLoadFnArr[i]();
}
}
function addDomLoadEvent(fn) {
if (isDomLoaded) {
fn();
}
else {
domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
}
}
/* Cross-browser onload
- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- Will fire an event as soon as a web page including all of its assets are loaded
*/
function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
/* Main function
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
*/
function main() {
if (plugin) {
testPlayerVersion();
}
else {
matchVersions();
}
}
/* Detect the Flash Player version for non-Internet Explorer browsers
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
a. Both release and build numbers can be detected
b. Avoid wrong descriptions by corrupt installers provided by Adobe
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
*/
function testPlayerVersion() {
var b = doc.getElementsByTagName("body")[0];
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
var t = b.appendChild(o);
if (t) {
var counter = 0;
(function(){
if (typeof t.GetVariable != UNDEF) {
var d = t.GetVariable("$version");
if (d) {
d = d.split(" ")[1].split(",");
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
else if (counter < 10) {
counter++;
setTimeout(arguments.callee, 10);
return;
}
b.removeChild(o);
t = null;
matchVersions();
})();
}
else {
matchVersions();
}
}
/* Perform Flash Player and SWF version matching; static publishing only
*/
function matchVersions() {
var rl = regObjArr.length;
if (rl > 0) {
for (var i = 0; i < rl; i++) { // for each registered object element
var id = regObjArr[i].id;
var cb = regObjArr[i].callbackFn;
var cbObj = {success:false, id:id};
if (ua.pv[0] > 0) {
var obj = getElementById(id);
if (obj) {
if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
setVisibility(id, true);
if (cb) {
cbObj.success = true;
cbObj.ref = getObjectById(id);
cb(cbObj);
}
}
else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
var att = {};
att.data = regObjArr[i].expressInstall;
att.width = obj.getAttribute("width") || "0";
att.height = obj.getAttribute("height") || "0";
if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
// parse HTML object param element's name-value pairs
var par = {};
var p = obj.getElementsByTagName("param");
var pl = p.length;
for (var j = 0; j < pl; j++) {
if (p[j].getAttribute("name").toLowerCase() != "movie") {
par[p[j].getAttribute("name")] = p[j].getAttribute("value");
}
}
showExpressInstall(att, par, id, cb);
}
else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
displayAltContent(obj);
if (cb) { cb(cbObj); }
}
}
}
else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
setVisibility(id, true);
if (cb) {
var o = getObjectById(id); // test whether there is an HTML object element or not
if (o && typeof o.SetVariable != UNDEF) {
cbObj.success = true;
cbObj.ref = o;
}
cb(cbObj);
}
}
}
}
}
function getObjectById(objectIdStr) {
var r = null;
var o = getElementById(objectIdStr);
if (o && o.nodeName == "OBJECT") {
if (typeof o.SetVariable != UNDEF) {
r = o;
}
else {
var n = o.getElementsByTagName(OBJECT)[0];
if (n) {
r = n;
}
}
}
return r;
}
/* Requirements for Adobe Express Install
- only one instance can be active at a time
- fp 6.0.65 or higher
- Win/Mac OS only
- no Webkit engines older than version 312
*/
function canExpressInstall() {
return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
}
/* Show the Adobe Express Install dialog
- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
*/
function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
isExpressInstallActive = true;
storedCallbackFn = callbackFn || null;
storedCallbackObj = {success:false, id:replaceElemIdStr};
var obj = getElementById(replaceElemIdStr);
if (obj) {
if (obj.nodeName == "OBJECT") { // static publishing
storedAltContent = abstractAltContent(obj);
storedAltContentId = null;
}
else { // dynamic publishing
storedAltContent = obj;
storedAltContentId = replaceElemIdStr;
}
att.id = EXPRESS_INSTALL_ID;
if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + fv;
}
else {
par.flashvars = fv;
}
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
if (ua.ie && ua.win && obj.readyState != 4) {
var newObj = createElement("div");
replaceElemIdStr += "SWFObjectNew";
newObj.setAttribute("id", replaceElemIdStr);
obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
createSWF(att, par, replaceElemIdStr);
}
}
/* Functions to abstract and display alternative content
*/
function displayAltContent(obj) {
if (ua.ie && ua.win && obj.readyState != 4) {
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
var el = createElement("div");
obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
el.parentNode.replaceChild(abstractAltContent(obj), el);
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.replaceChild(abstractAltContent(obj), obj);
}
}
function abstractAltContent(obj) {
var ac = createElement("div");
if (ua.win && ua.ie) {
ac.innerHTML = obj.innerHTML;
}
else {
var nestedObj = obj.getElementsByTagName(OBJECT)[0];
if (nestedObj) {
var c = nestedObj.childNodes;
if (c) {
var cl = c.length;
for (var i = 0; i < cl; i++) {
if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
ac.appendChild(c[i].cloneNode(true));
}
}
}
}
}
return ac;
}
/* Cross-browser dynamic SWF creation
*/
function createSWF(attObj, parObj, id) {
var r, el = getElementById(id);
if (ua.wk && ua.wk < 312) { return r; }
if (el) {
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
attObj.id = id;
}
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
var att = "";
for (var i in attObj) {
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
if (i.toLowerCase() == "data") {
parObj.movie = attObj[i];
}
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
att += ' class="' + attObj[i] + '"';
}
else if (i.toLowerCase() != "classid") {
att += ' ' + i + '="' + attObj[i] + '"';
}
}
}
var par = "";
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
}
}
el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
r = getElementById(attObj.id);
}
else { // well-behaving browsers
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
for (var m in attObj) {
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
o.setAttribute("class", attObj[m]);
}
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
o.setAttribute(m, attObj[m]);
}
}
}
for (var n in parObj) {
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
createObjParam(o, n, parObj[n]);
}
}
el.parentNode.replaceChild(o, el);
r = o;
}
}
return r;
}
function createObjParam(el, pName, pValue) {
var p = createElement("param");
p.setAttribute("name", pName);
p.setAttribute("value", pValue);
el.appendChild(p);
}
/* Cross-browser SWF removal
- Especially needed to safely and completely remove a SWF in Internet Explorer
*/
function removeSWF(id) {
var obj = getElementById(id);
if (obj && obj.nodeName == "OBJECT") {
if (ua.ie && ua.win) {
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.removeChild(obj);
}
}
}
function removeObjectInIE(id) {
var obj = getElementById(id);
if (obj) {
for (var i in obj) {
if (typeof obj[i] == "function") {
obj[i] = null;
}
}
obj.parentNode.removeChild(obj);
}
}
/* Functions to optimize JavaScript compression
*/
function getElementById(id) {
var el = null;
try {
el = doc.getElementById(id);
}
catch (e) {}
return el;
}
function createElement(el) {
return doc.createElement(el);
}
/* Updated attachEvent function for Internet Explorer
- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
*/
function addListener(target, eventType, fn) {
target.attachEvent(eventType, fn);
listenersArr[listenersArr.length] = [target, eventType, fn];
}
/* Flash Player and SWF content version matching
*/
function hasPlayerVersion(rv) {
var pv = ua.pv, v = rv.split(".");
v[0] = parseInt(v[0], 10);
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
v[2] = parseInt(v[2], 10) || 0;
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
}
/* Cross-browser dynamic CSS creation
- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
*/
function createCSS(sel, decl, media, newStyle) {
if (ua.ie && ua.mac) { return; }
var h = doc.getElementsByTagName("head")[0];
if (!h) { return; } // to also support badly authored HTML pages that lack a head element
var m = (media && typeof media == "string") ? media : "screen";
if (newStyle) {
dynamicStylesheet = null;
dynamicStylesheetMedia = null;
}
if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
// create dynamic stylesheet + get a global reference to it
var s = createElement("style");
s.setAttribute("type", "text/css");
s.setAttribute("media", m);
dynamicStylesheet = h.appendChild(s);
if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
}
dynamicStylesheetMedia = m;
}
// add style rule
if (ua.ie && ua.win) {
if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
dynamicStylesheet.addRule(sel, decl);
}
}
else {
if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
}
}
}
function setVisibility(id, isVisible) {
if (!autoHideShow) { return; }
var v = isVisible ? "visible" : "hidden";
if (isDomLoaded && getElementById(id)) {
getElementById(id).style.visibility = v;
}
else {
createCSS("#" + id, "visibility:" + v);
}
}
/* Filter to avoid XSS attacks
*/
function urlEncodeIfNecessary(s) {
var regex = /[\\\"<>\.;]/;
var hasBadChars = regex.exec(s) != null;
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
}
/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
*/
var cleanup = function() {
if (ua.ie && ua.win) {
window.attachEvent("onunload", function() {
// remove listeners to avoid memory leaks
var ll = listenersArr.length;
for (var i = 0; i < ll; i++) {
listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
}
// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
var il = objIdArr.length;
for (var j = 0; j < il; j++) {
removeSWF(objIdArr[j]);
}
// cleanup library's main closures to avoid memory leaks
for (var k in ua) {
ua[k] = null;
}
ua = null;
for (var l in swfobject) {
swfobject[l] = null;
}
swfobject = null;
});
}
}();
return {
/* Public API
- Reference: http://code.google.com/p/swfobject/wiki/documentation
*/
registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
if (ua.w3 && objectIdStr && swfVersionStr) {
var regObj = {};
regObj.id = objectIdStr;
regObj.swfVersion = swfVersionStr;
regObj.expressInstall = xiSwfUrlStr;
regObj.callbackFn = callbackFn;
regObjArr[regObjArr.length] = regObj;
setVisibility(objectIdStr, false);
}
else if (callbackFn) {
callbackFn({success:false, id:objectIdStr});
}
},
getObjectById: function(objectIdStr) {
if (ua.w3) {
return getObjectById(objectIdStr);
}
},
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
var callbackObj = {success:false, id:replaceElemIdStr};
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
setVisibility(replaceElemIdStr, false);
addDomLoadEvent(function() {
widthStr += ""; // auto-convert to string
heightStr += "";
var att = {};
if (attObj && typeof attObj === OBJECT) {
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
att[i] = attObj[i];
}
}
att.data = swfUrlStr;
att.width = widthStr;
att.height = heightStr;
var par = {};
if (parObj && typeof parObj === OBJECT) {
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
par[j] = parObj[j];
}
}
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + k + "=" + flashvarsObj[k];
}
else {
par.flashvars = k + "=" + flashvarsObj[k];
}
}
}
if (hasPlayerVersion(swfVersionStr)) { // create SWF
var obj = createSWF(att, par, replaceElemIdStr);
if (att.id == replaceElemIdStr) {
setVisibility(replaceElemIdStr, true);
}
callbackObj.success = true;
callbackObj.ref = obj;
}
else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
att.data = xiSwfUrlStr;
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
return;
}
else { // show alternative content
setVisibility(replaceElemIdStr, true);
}
if (callbackFn) { callbackFn(callbackObj); }
});
}
else if (callbackFn) { callbackFn(callbackObj); }
},
switchOffAutoHideShow: function() {
autoHideShow = false;
},
ua: ua,
getFlashPlayerVersion: function() {
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
},
hasFlashPlayerVersion: hasPlayerVersion,
createSWF: function(attObj, parObj, replaceElemIdStr) {
if (ua.w3) {
return createSWF(attObj, parObj, replaceElemIdStr);
}
else {
return undefined;
}
},
showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
if (ua.w3 && canExpressInstall()) {
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
}
},
removeSWF: function(objElemIdStr) {
if (ua.w3) {
removeSWF(objElemIdStr);
}
},
createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
if (ua.w3) {
createCSS(selStr, declStr, mediaStr, newStyleBoolean);
}
},
addDomLoadEvent: addDomLoadEvent,
addLoadEvent: addLoadEvent,
getQueryParamValue: function(param) {
var q = doc.location.search || doc.location.hash;
if (q) {
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
if (param == null) {
return urlEncodeIfNecessary(q);
}
var pairs = q.split("&");
for (var i = 0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
}
}
}
return "";
},
// For internal usage only
expressInstallCallback: function() {
if (isExpressInstallActive) {
var obj = getElementById(EXPRESS_INSTALL_ID);
if (obj && storedAltContent) {
obj.parentNode.replaceChild(storedAltContent, obj);
if (storedAltContentId) {
setVisibility(storedAltContentId, true);
if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
}
if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
}
isExpressInstallActive = false;
}
}
};
}();
... ...
不能预览此文件类型
不能预览此文件类型