微信视频全屏播放--测试

<!-- http://itakeo.com/down/video/ -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>Examples</title>
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" name="viewport"/>
    <meta name="description" content="">
    <meta name="keywords" content="">
    <link href="" rel="stylesheet">
</head>
<style>
    *{margin:0;padding: 0}
    html,body,video{width: 100%;height: 100%; position: relative;overflow: hidden;}
    video{ object-fit: cover;}
    div,#endBtn,#exitBtn{ position: absolute; width: 60px;height: 60px; left: 50%;top: 50%; margin-left: -50px;margin-top: -50px; background: red;z-index: 100;color: #fff;text-align: center;font-size: 14px; line-height: 60px;border:none;
        transition: all 1s ease;-webkit-transition: all 1s ease;
      }
    div.move{
        transform: translate3d(0,-688px,0);
        -webkit-transform: translate3d(0,-688px,0);
    }
    #endBtn,#exitBtn{
    transition: all 1s ease;-webkit-transition: all 1s ease;
    transform: translate3d(0,688px,0);
        -webkit-transform: translate3d(0,688px,0);
    }
    #endBtn.move,#exitBtn.move{
        transform: translate3d(0,0px,0);
        -webkit-transform: translate3d(0,0,0);
    }
    #endBtn{left:45%;}
    #exitBtn{left:55%;}
</style>
<body>
    <div id="div">点击播放</div>
    <video id="video" src="http://itakeo.com/down/video/mp4.mp4" poster="http://itakeo.com/down/video/poster.jpg" muted x-webkit-airplay="true" playsinline  webkit-playsinline="true"  x5-video-player-type="h5"  ></video>
    <button id="endBtn">再次播放</button>
    <button id="exitBtn">退出播放</button>
</body>


<script>


     //一般情况下,这样就可以自动播放了,但是一些奇葩iPhone机不可以
    document.getElementById('video').play();
    //必须在微信Weixin JSAPI的WeixinJSBridgeReady才能生效
    // document.addEventListener("WeixinJSBridgeReady", function () {
    //     document.getElementById('video').play();
    // }, false);


    document.addEventListener("WeixinJSBridgeReady", function onBridgeReady() {
        // document.getElementById('video').play();
        WeixinJSBridge.call('hideOptionMenu');
    });




// document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
//     WeixinJSBridge.call('hideToolbar');
//     WeixinJSBridge.call('hideOptionMenu');
// });


    div.ontouchend = div.onclick = function(){
        this.classList.add('move')
        video.play()
    }
    endBtn.ontouchend = endBtn.onclick = function(){
        this.classList.remove('move')
        video.play()
    }
    exitBtn.ontouchend = exitBtn.onclick = function(){
        // this.classList.remove('move')
        // video.play()
        //close window
        WeixinJSBridge.call('closeWindow');
        //hidden toolbar
        // WeixinJSBridge.call('hideToolbar');
        //hide menu
        // WeixinJSBridge.call('hideOptionMenu');
        //location.href = "http://www.luxi.ren";
    }
    video.addEventListener('ended',function(){
       endBtn.classList.add('move')
    })
    video.addEventListener('ended',function(){
       exitBtn.classList.add('move')
    })
</script>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值