温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

html5播放mp4视频代码

发布时间:2020-07-11 20:10:41 来源:网络 阅读:7649 作者:guowang327 栏目:移动开发

1.nginx支持flv和mp4格式播放

默认yum安装nginx

centos7安装nginx时候应该是默认安装nginx_mod_h364_streaming模块的

# nginx -V查看是否安装nginx_mod_h364_streaming模块

nginx在新版本中已经支持了--with-http_mp4_module --with-http_flv_module这2个模块即可

# vi /etc/nginx/nginx.conf

server {

        listen       80 default_server;

        listen       [::]:80 default_server;

        server_name  _;

        root         /usr/share/nginx/html;

        #guowang add

        limit_rate_after 5m;   #在flv视频文件下载了5M以后开始限速

        limit_rate 512k;      #速度限制为512K


        # Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;


        location / {

        }


        #guowang add

        location ~ \.flv {

            flv;

        }

        location ~ \.mp4$ {

            mp4;

        }


        error_page 404 /404.html;

            location = /40x.html {

        }


        error_page 500 502 503 504 /50x.html;

            location = /50x.html {

        }

}


2.html5播放mp4视频代码

<!DOCTYPE html>

<html>

<head>

    <meta charset="utf-8">

    <title>公司宣传片</title>

</head>

<body>

    <h3>公司宣传片</h3>

    <video width="320" height="240" controls autoplay>

        <source src="gs.mp4" type="video/mp4">

        <source src="gs.ogg" type="video/ogg">

        <source src="gs.webm" type="video/webm">

        <object data="gs.mp4" width="320" height="240">

          <embed src="gs.swf" width="320" height="240"><p>如果你播放不了该视频,

那是你的设备不支持该文件格式</p>

        </object>

    </video>

</body>

</html>

3.参考:

http://www.runoob.com/html/html-videos.html

http://www.runoob.com/try/try.php?filename=tryhtml_video_html5_4


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI