如何使用播放和全屏按钮在 php 中创建视频播放器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4538369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to create video player in php with play & fullscreen button?
提问by Pratik Gujarathi
I have got the below code from internet for embedding a video player but it doesn't have play/pause button or fullscreen option.
我从互联网上获得了以下用于嵌入视频播放器的代码,但它没有播放/暂停按钮或全屏选项。
Here is the code:
这是代码:
<OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=342
CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">
<PARAM NAME="movie" VALUE="<?php echo $path.'/'.$_POST['file']; ?>">
<EMBED TYPE="application/x-mplayer2"
SRC="<?php echo $path.'/'.$_POST['file'];?>"
NAME="MediaPlayer"
WIDTH=320
HEIGHT=342>
</EMBED>
</OBJECT>
Any code fix please?
请问有什么代码修复吗?
回答by PAblo
<OBJECT ID="MediaPlayer" WIDTH="300" HEIGHT="200" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject">
<PARAM NAME="FileName" VALUE="<?php echo $path.'/'.$POST_['file']; ?>">
<EMBED TYPE="application/x-mplayer2" SRC="<?php echo $path.'/'.$POST_['file']; ?>" NAME="MediaPlayer" WIDTH="200" HEIGHT="200" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"></EMBED></OBJECT>
回答by Slawek
Better use some free flash based player and embed this on the website, this code you have pasted here - with windows media player - works very badly.
最好使用一些免费的基于 Flash 的播放器并将其嵌入到网站上,您在此处粘贴的代码 - 使用 windows 媒体播放器 - 效果非常糟糕。
Beside it's very insecure. Easy to do cross site scripting if you don't filter _POST/_GET/
旁边很不安全。如果您不过滤 _POST/_GET/,则易于进行跨站点脚本编写
回答by Ergec
Users may need plugin to display media player in other browsers other than internet explorer. I recommend you to use a flash based player.
用户可能需要插件才能在 Internet Explorer 以外的其他浏览器中显示媒体播放器。我建议您使用基于 Flash 的播放器。
回答by weng
{
<video width="720" height="430" autoplay *controls preload="none*">
<source src="" type="video/mp4">
<source src="" type="video/ogg">
//Your browser does not support the video tag.
</video>enter code here
}
add controls
添加控件