如何使用php在浏览器中播放所有视频文件?
亲爱的大家,我想在浏览器中播放大部分视频文件,可以吗?有哪位朋友可以帮帮我吗。
提前致谢。
Dear all, i want to play most of all video files in browser, is it possible? can any buddy help me out.
thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
PHP 是一种用于动态生成内容的服务器端编程语言。这不会帮助您为最终用户播放视频。为此,您要么需要流式传输视频并依赖拥有插件的用户,要么需要使用某种最终用户视频播放器(可能使用 Flash)。 PHP 并不是您真正需要的,因为它只是生成发送到浏览器的内容。
PHP is a server-side programming language for dynamically generating content. This will not help you play videos for the end-user. For that, you will either need to stream the video and count on the user having a plugin, or you will need to use some sort of end-user video player, perhaps using Flash. PHP isn't really what you're looking for here, as it just generates content to send to the browser.
在工作中我们就是这样做的。假设您正在谈论网络服务器,那么设置起来非常容易。我赞同 http://www.flowplayer.org 之前对 flowplayer 的推荐。
将您的视频加载到网络服务器可访问的目录中,使用 php 生成视频列表,然后使用该列表激活 flowplayer,该播放器可以使用 javascript 进行控制。
At work we do just this. Assuming that you're talking about a webserver, it's pretty easy to set up. I second the earlier recommendation of flowplayer from http://www.flowplayer.org.
Load your videos into a webserver-accessible directory, generate a list of them with php, and use that list to activate the flowplayer, which can be controlled with javascript.
我假设您正在谈论网络服务器,并且您希望所有服务器都出现在您的浏览器窗口中?
您将需要 JavaScript 或 Flash 视频播放器才能在浏览器中播放文件。我过去使用过的一些是 http://flowplayer.org/ 和 http://ajaxian.com/archives/jsonvid-pure-javascript-video-player
您如果您打算使用 PHP,可能想使用 PHP 来列出您的服务器(我假设是 Linux)上的所有视频文件。我想您会想要使用 UNIX 实用程序而不是构建自己的实用程序;可能是递归查找命令。所以你的 PHP 代码将类似于:
I assume you're talking about a web server, and you want all of them to appear in your browser window?
You're going to need a JavaScript or Flash video player to play the files in the browser. Some that I've used in the past are http://flowplayer.org/ and http://ajaxian.com/archives/jsonvid-pure-javascript-video-player
You probably want to use PHP, if you're going to use PHP, to list all the video files on your server (which I am assuming is Linux). You're going to want to use UNIX utilities instead of building your own, I'd imagine; probably a recursive find command. So your PHP code will look something like:
在任何浏览器中,您只能播放该浏览器支持的格式。对于视频,mp4 是大多数浏览器支持的格式,因此您需要在播放之前将上传的视频转换为 mp4 格式。
In any browser you can play only those formats which are supported by that browser. In case of video, mp4 is the format supported by maximum browsers, so you need to convert any uploaded video to mp4 format before playing.