如何在Apache服务器上播放视频

问题描述:

我已经在Ubuntu机器上安装了Apache服务器,并在Apache中创建了目录

I have installed Apache server on a Ubuntu machine, created directory in Apache

/var/www/html/myvideos/

/var/www/html/myvideos/

并将视频复制到此位置,如何在浏览器中播放?

and copied the videos to this location, how do you play it back on the browser?

我已经在浏览器中打开了URL

I have opened the URL in browser

http://my_server_ip/myvideos/testvideo.mp4

视频无法在浏览器中播放. 我需要在Apache服务器中进行任何配置才能在浏览器中播放视频吗?

The video doesn't get played in the browser. Do I need to make any configuration in Apache server to make the video play in the browser ?

请大家帮我. 谢谢

您应该这样做,将指向视频的链接嵌入到index.html中.

You should embed a link to the video in your index.html by doing this.

<video width="320" height="240" controls>
<source src="/var/www/html/myvideos/[videoname].mp4" type="video/mp4">
</video>

然后,您可以单击index.html中的播放器,并在那里观看视频.

Then, you can click the player in your index.html, and watch your video there.