html5播放mp4視頻代碼

來源:互聯網
上載者:User

標籤:video   html5   

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

預設yum安裝nginx

centos7安裝nginx時候應該是預設安裝nginx_mod_h264_streaming模組的

# nginx -V查看是否安裝nginx_mod_h264_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>

    <h2>公司宣傳片</h2>

    <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


html5播放mp4視頻代碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.