php 網頁播放器用來播放線上視頻的代碼(自動判斷並選擇視頻檔案類型)

來源:互聯網
上載者:User

在web開發中經常會碰到一些簡單的視頻播放功能,但現在的視頻格式不同,並且可以動態增加,所以我們就必須把視頻儲存到資料哦,好了下面我們來看我寫的段簡單的 php視頻網頁播放器代碼吧。 複製代碼 代碼如下:<?PHP
include './admin/connect.php';
@extract($db->get_one("select * from movieinfo where id='".$_GET['id']."'"));
$db->query("update movieinfo set playnum=playnum+1 where id='".$_GET['id']."' ");
//控制下載
$url2="admin/";//存放軟體的路徑
if($localaddress)
{
$newname=$localaddress;
$movieurl=$url2.$newname;
}
?>
<html>
<head>
<title><?=$title?>-線上播放 jb51.net</title>
</head>

<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">
<?php
//MediaPlayer播放
if (eregi(".mid$",$movieurl) || eregi(".avi$",$movieurl) || eregi(".asf$",$movieurl) ||eregi(".asx$",$movieurl) || eregi(".wmv$",$movieurl) || eregi(".wma$",$movieurl))
{
?>
<object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="application/x-oleobject" width=350 height=280 align="middle" standby="Loading Microsoft?Windows?Media Player components..." id="MediaPlayer1">
<param name="transparentAtStart" value="True">
<param name="transparentAtStop" value="True">
<param name="AnimationAtStart" value="Ture">
<param name="AutoStart" value="True">
<param name="AutoRewind" value="true">
<param name="DisplaySize" value="0">
<param name="AutoSize" value="false">
<param name="ShowDisplay" value="false">
<param name="ShowStatusBar" value="ture">
<param name="ShowControls" value="ture">
<param name="FileName" value="<?=$movieurl?>">
<param name="Volume" value="0">
<embed src="" width="350" height=280 autostart="True" align="middle" transparentatstart="True" transparentatstop="True" animationatstart="Ture" autorewind="true" displaysize="0" autosize="false" showdisplay="False" showstatusbar="-1" showcontrols="ture" filename="<?=$movieurl?>" volume="0">
</embed>
</object>
<?php
}elseif(eregi(".ra$",$movieurl)|| eregi(".mp3$",$movieurl) || eregi(".rm$",$movieurl) || eregi(".ram$",$movieurl) ){
//RealPlayer播放的
?>
<object ID="video" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="280" WIDTH="350" align="center">
<param name="_ExtentX" value="9260">
<param name="_ExtentY" value="6350">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="0">
<param name="SRC" value="<?=$movieurl?>">
<param name="CONTROLS" value="ImageWindow">
<param name="CONSOLE" value="Clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000"><embed SRC="4.rpm" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ImageWindow" HEIGHT="240" WIDTH="352" AUTOSTART="false">
</object><br>
<object ID="video" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="40" WIDTH="350" align="center">
<param name="_ExtentX" value="9260">
<param name="_ExtentY" value="1058">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="0">
<param name="CONTROLS" value="ControlPanel,StatusBar">
<param name="CONSOLE" value="Clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000"><embed type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ControlPanel,StatusBar" HEIGHT="60" WIDTH="275" AUTOSTART="false">
</object>

<?php

}elseif(eregi(".swf$",$movieurl)) {
//flashplayer播放的
?>
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="350" height="280">
<param name="movie" value="<?=$movieurl?>">
<param name="quality" value="High">
<embed src="<?=$movieurl?>" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="350" height="280">
</object>
<?
}
?>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.