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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

JS视频播放

發(fā)布時間:2023/12/18 javascript 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 JS视频播放 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1.HTML頁面中視頻播放支持方法一

觸發(fā)代碼: <a href="javascript:void(0)" class="act-video" onclick="playVideo('e01608xXXX')"><strong class="hide">視頻</strong></a> //'e01608xXXX' 視頻ID彈出框代碼: <article class="mod-game-dialog cus-dialog-video hide" id="video"><div class="mod-game-dialog-content"><div class="mod-wrap"><div class="mod-content"><div class="mod-txt"><div class="v1"><div class="video_player"></div></div> <a href="javascript:void(0)" class="close" style="z-index: 9;"><strong class="hide">關(guān)閉</strong></a></div></div></article> 加載組件: <script type="text/javascript" src="http://imgcache.qq.com/tencentvideo_v1/tvp/js/tvp.player_v2_zepto.js"></script>使用方法:function playVideo(vid) {$('#video').removeClass('hide').addClass('show');var player_content = $('.video_player'),$b,cid = 'video_player' + (+new Date);if(!player_content) return;$b = $('#video').find('.mod-txt');player_content.attr('id', cid);var video = new tvp.VideoInfo(),config;window.player =new tvp.Player();video.setVid(vid);config = {width: $b.width(),height: 200,video: video,modId: cid,isHtml5UseFakeFullScreen: false,vodFlashSkin: 'http://imgcache.qq.com/minivideo_v1/vd/res/skins/TencentPlayerMiniSkin.swf',autoplay: true, //自動播放選項isShowDurationLimit : false,oninited : function(){$('.tvp_overlay_loading', player_content).addClass('tvp_none');$('.tvp_overlay_play', player_content).removeClass('tvp_none');}}if(/ mi /.test(navigator.userAgent.toLowerCase())){ //小米手機(jī)特殊處理config.playerType = 'html5';}window.player.create(config);}關(guān)閉視頻: $(".close").click(function(){window.player.pause();$(this).parent().parent().parent().removeClass("show").addClass("hide"); });

2.方法二

加載組件: <script src="http://qzs.qq.com/tencentvideo_v1/js/tvp/tvp.player.js" charset="utf-8"></script>調(diào)用方法:var video = new tvp.VideoInfo();video.setVid("j0158oej1lt");//視頻vidvar player = new tvp.Player(320, 190);//視頻高寬player.setCurVideo(video);player.addParam("autoplay","0");//是否自動播放,1為自動播放,0為不自動播放player.addParam("wmode","opaque");player.addParam("pic","http://ossweb-img.qq.com/images/chanpin/moba/public/a20150716qmcsQ/video.jpg");//默認(rèn)圖片地址player.addParam("flashskin", "http://imgcache.qq.com/minivideo_v1/vd/res/skins/TencentPlayerMiniSkin.swf");//是否調(diào)用精簡皮膚,不使用則刪掉此行代碼player.write("videoCon");$("body").on("tap", ".videoBtn", function() {$("#dialogVideo").show(); }); $("body").on("tap", ".videoClose", function() {player.pause();$("#dialogVideo").hide(); }); 觸發(fā)事件 <a class="videoBtn" href="javascript:;"></a><!--視頻 彈窗--> <div class="dialogVideo none" id="dialogVideo"><a class="videoClose " href="javascript:;"></a><div id="videoCon" class="video"></div> </div>

總結(jié)

以上是生活随笔為你收集整理的JS视频播放的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。