From 6c64c27a5ac2404464b1275d0ea5f6844e870b8b Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Fri, 2 Aug 2024 16:47:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commonComponents/video/index.vue | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/pages/component/commonComponents/video/index.vue b/pages/component/commonComponents/video/index.vue index 762a1e0..cea46a4 100644 --- a/pages/component/commonComponents/video/index.vue +++ b/pages/component/commonComponents/video/index.vue @@ -48,6 +48,7 @@ props: ["currentVideo", "currentVideoList","videoTitle"], data() { return { + reaquestFlag:false, show: false, platform: null, //当前是否是全屏模式 @@ -235,6 +236,13 @@ }, // 获取播放凭证 async getLive(isChange,newVideoData) { + if(this.reaquestFlag){ + uni.showToast({ + title:'操作太快了,歇一下吧', + icon:'none' + }) + } + this.reaquestFlag = true var that = this; this.isfresh = false; var data = { @@ -256,6 +264,7 @@ }, }) .then(async (res) => { + this.reaquestFlag = false if (this.$platform == 'ios') { if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo.type == 1 && res.video.m3u8Url == '') { // 只存在私有加密 @@ -298,6 +307,12 @@ console.log("是否获取到初始播放值", data); that.$forceUpdate(); + }).catch(e => { + this.reaquestFlag = false + uni.showToast({ + 'title': '获取播放地址失败', + icon:'none' + }) }); }, @@ -533,7 +548,7 @@                 height: '100%', //容器的大小                 "qualitySort": "asc",                 "cover": "", -                 "autoplay": false, +                 "autoplay": true,             "isLive": false,             "rePlay": false,             "playsinline": true, @@ -662,7 +677,7 @@ var player = new Aliplayer(playerOptions, function(player) {}); this.player = player; myplayer = player; - console.log('myplayer------------',myplayer); + // console.log('myplayer------------',myplayer.loadByUrl('https://www.w3schools.com/html/movie.mp4')); console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime) player.on('ready', function() { @@ -759,8 +774,15 @@ if(videoData.type == 1){ if(videoData.m3u8Url != '' && videoData.m3u8Url != null){ // myplayer.source(videoData.m3u8Url) - console.log('走了吗?'); + myplayer.loadByUrl(videoData.m3u8Url) + console.log('切换走了吗?m3u8'); + }else{ + myplayer.replayByVidAndPlayAuth(videoData.videoId,videoData.playAuth) + console.log('切换走了吗?私有加密'); } + }else{ + myplayer.loadByUrl(videoData.m3u8Url) + console.log('切换常规视频'); } } console.log('可能是切换视频',myplayer,videoData,);