日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

《转》完美解决微信video视频隐藏控件和内联播放问题

發布時間:2025/3/17 编程问答 18 豆豆
生活随笔 收集整理的這篇文章主要介紹了 《转》完美解决微信video视频隐藏控件和内联播放问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

地址:https://blog.csdn.net/xiao190128/article/details/81025378

var u = navigator.userAgent;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android終端
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios終端
if(isAndroid){
$('.videoBox').hide();
$('.section').css({"background":"url({$_W['siteroot']}addons/db_play/template/mobile/resource/bg_img.jpg)","background-repeat":"no-repeat","background-size":"100% 100%","-moz-background-size":"100% 100%"});
console.log(1);
$("#video").hide();
// $("i.fa").show();
$("i.fa").hide();

}else{
$("i.fa").hide();
$("#canvas").hide();
document.addEventListener("WeixinJSBridgeReady", function () {
document.getElementById('video').play();
}, false);
}

var videoanimate;
canvas = document.getElementById('canvas');
context = canvas.getContext( '2d' );
context.fillStyle = '#fff';
context.fillRect( 0, 0, canvas.width, canvas.height );//繪制1920*1080像素的已填充矩形。
var img=new Image();//新建一個圖片,模仿video里面的poster屬性。
img.src="{$_W['siteroot']}addons/db_play/template/mobile/image/share/STARVOICE.png";
context.drawImage(img,0, 0,canvas.width,canvas.height);//將圖片繪制進canvas。
function animate() {//渲染方法。
if(video.paused){//判斷視頻是否暫停,如果暫停顯示控件。
$(".video i.fa").show();
}
context.drawImage(video,0, 0,canvas.width,canvas.height);//將視頻當中的一幀繪制到canvas當中。
videoanimate = requestAnimationFrame( animate );//每秒60幀渲染頁面。關于此方法具體解釋請自行百度。
}

if (video.paused) {
$('.videoBox').show();
$('.section').css({"background":""});
}

$("#canvas,i.fa").click(function(){

console.log(2);
if(isAndroid){
animate();//在這里調用。
if(!video.paused){//判斷視頻時候暫停。
video.pause();
}else{
video.play();
$(".video i.fa").hide();
}
}
})

轉載于:https://www.cnblogs.com/peipeiyu/p/10007337.html

總結

以上是生活随笔為你收集整理的《转》完美解决微信video视频隐藏控件和内联播放问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。