Feb 5

php操作mediaplayer播放asx列表 不指定

bkkkd , 09:02 , 开发应用 , 评论(0) , 引用(0) , 阅读(4144) , Via 本站原创 | |
为了能准确的播放asx文件,我们必须用js对mediaplayer进行控制。


<?


//asx的格式:
function channelprogramlist($filename){
$str="";
$str.="<ASX version="3.0">rn";
$str.="t<ENTRY>rn";
$str.="tt<AUTHOR>".$filename;   //节目名
$str.="</AUTHOR>rn";
  $filename=urlencode($filename); //把节目名转换
  $filepath="http://".192.168.0.1"/".$filename;  //192.168.0.1是服务器的ip
  $str.= "tt<REF HREF="$filepath" />rn";
  $str.= "t</ENTRY>rn";
 }
$str.= "</ASX>";
return $str;
}


//写asx文件
function writeFile($str){        
 $file="mms.asx";
 $fp = fopen($file,"w+");
 fwrite($fp,$str);
 fclose($fp);
 return  $file;
}


//控制mediaplayer每次从新读取文件
function PlayChannel($urlstr){
echo "<script language="javascript">n";
echo "function change(){n";
echo "t"."document.mediaPlayer.file=".$urlstr.";n";
echo "}n";
echo "</script>n";
}


?>


<html>
<head>
<title>播放器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<?php
$filename="神话";
PlayChannel(writeFile(channelprogramlist($filename)));
?>
</head>
<body leftmargin="0" topmargin="0" onLoad="change()" bgcolor="#000000">
<object id="mediaPlayer" width="554" height="380" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft Media Player components..." type="application/x-oleobject">
<PARAM NAME="animationatStart" VALUE="true">
<PARAM NAME="transparentatStart" VALUE="true">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="CanSeek" VALUE="FALSE">
<PARAM NAME="showControls" VALUE="FALSE">
<param name="FileName" value="mms.asx">
<embed type="application/x-mplayerO" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" autostart="1" width="500" height="400">
</embed>
</object>
</body>
</html>

发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]