在web开发中经常会碰到一些简单的视频播放功能,但现在的视频格式不同,并且可以动态增加,所以我们就必须把视频保存到数据哦,好了下面我们来看我写的段简单的 php视频网页播放器代码吧。
复制代码 代码如下:
<?PHP
include './admin/connect.php';
@extract($db->get_one("select * from movieinfo whereid']."'"));
$db->query("update movieinfo set playnum=playnum+1 whereid']."' ");
//控制下载
$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 standby="Loading Microsoft?Windows?Media Player components...">
<param value="True">
<param value="True">
<param value="Ture">
<param value="True">
<param value="true">
<param value="0">
<param value="false">
<param value="false">
<param value="ture">
<param value="ture">
<param value="https://www.jb51.net/<?=$movieurl?>">
<param value="0">
<embed src="" height=280 autostart="True" transparentatstart="True" transparentatstop="True" animationatstart="Ture" autorewind="true" displaysize="0" autosize="false" showdisplay="False" showstatusbar="-1" showcontrols="ture" filename="https://www.jb51.net/<?=$movieurl?>" volume="0">
</embed>
</object>
<?php
}elseif(eregi(".ra$",$movieurl)|| eregi(".mp3$",$movieurl) || eregi(".rm$",$movieurl) || eregi(".ram$",$movieurl) ){
//RealPlayer播放的
?>
<object CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<param value="9260">
<param value="6350">
<param value="-1">
<param value="0">
<param value="0">
<param value="0">
<param value="https://www.jb51.net/<?=$movieurl?>">
<param value="ImageWindow">
<param value="Clip1">
<param value="0">
<param value="0">
<param value="0">
<param value="0">
<param value="#000000"><embed SRC="https://www.jb51.net/article/4.rpm" type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ImageWindow" AUTOSTART="false">
</object><br>
<object CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA">
<param value="9260">
<param value="1058">
<param value="-1">
<param value="0">
<param value="0">
<param value="0">
<param value="ControlPanel,StatusBar">
<param value="Clip1">
<param value="0">
<param value="0">
<param value="0">
<param value="0">
<param value="#000000"><embed type="audio/x-pn-realaudio-plugin" CONSOLE="Clip1" CONTROLS="ControlPanel,StatusBar" AUTOSTART="false">
</object>
<?php
}elseif(eregi(".swf$",$movieurl)) {
//flashplayer播放的
?>
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">
<param value="https://www.jb51.net/<?=$movieurl?>">
<param value="High">
<embed src="https://www.jb51.net/<?=$movieurl?>" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash">
</object>
<?
}
?>
您可能感兴趣的文章: