码迷,mamicode.com
首页 > 其他好文 > 详细

canvas 在视频中的用法

时间:2017-06-22 23:51:44      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:phone   max   width   height   code   auto   har   cal   init   

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>model</title>
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <style>
        *{margin:0;}
    </style>
</head>
<body>
    <div>
        <canvas id="mycanvas" width="640" height="1039"></canvas>
    </div>

    <video class="" id="video" width="640" autoplay style=" display:none;">
        <source src="images/video.mp4" type=‘video/mp4‘>
    </video>
<script type="text/javascript" src="js/setviewport.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script>
    function playVideo() {
        var myvideo=document.getElementById("video");

        var c=document.getElementById(mycanvas);
        var ctx=c.getContext("2d");

        ctx.clearRect(0,0,640,1039);
        ctx.drawImage(myvideo,0,0,640,1039);

        stopCanvas = setInterval(function () {
            ctx.clearRect(0,0,640,1039);
            ctx.drawImage(myvideo,0,0,640,1039);
        },30)
    }
    playVideo();
</script>

</body>
</html>

 

canvas 在视频中的用法

标签:phone   max   width   height   code   auto   har   cal   init   

原文地址:http://www.cnblogs.com/chiangyibo/p/7067641.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!