canvas中播放mp4视频文件代码

代码语言:html

所属分类:多媒体

代码描述:canvas中播放mp4视频文件代码

代码标签: canvas 播放 MP4 视频

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=640,user-scalable=0,target-densitydpi=device-dpi" />
        <style>
            * {
                margin: 0;
                padding: 0;
            }
        </style>
    </head>

    <body>
        <div id="container">

        </div>
    </body>
    <script>
        !(function(doc) {
            var cont = doc.getElementById("container");
            var cw = window.innerWidth;
            var ch = window.innerHeight;

            var canvas = document.createElement('canvas');
            canvas.width = cw;
            canvas.height = ch;
            canvas.style.zIndex = 8;
            canvas.style.position = "absolute";
            cont.appendChild(canvas);
            var cont2D = canvas.getContext("2d");

            var video = document.createElement('video');
            video.preload = "auto";
            video.volume = 0.3;
            video.se.........完整代码请登录后点击上方下载按钮下载查看

网友评论0