This commit is contained in:
@fawn-nine
2024-08-02 16:47:03 +08:00
parent f726ecf29a
commit 6c64c27a5a

View File

@@ -48,6 +48,7 @@
props: ["currentVideo", "currentVideoList","videoTitle"], props: ["currentVideo", "currentVideoList","videoTitle"],
data() { data() {
return { return {
reaquestFlag:false,
show: false, show: false,
platform: null, platform: null,
//当前是否是全屏模式 //当前是否是全屏模式
@@ -235,6 +236,13 @@
}, },
// 获取播放凭证 // 获取播放凭证
async getLive(isChange,newVideoData) { async getLive(isChange,newVideoData) {
if(this.reaquestFlag){
uni.showToast({
title:'操作太快了,歇一下吧',
icon:'none'
})
}
this.reaquestFlag = true
var that = this; var that = this;
this.isfresh = false; this.isfresh = false;
var data = { var data = {
@@ -256,6 +264,7 @@
}, },
}) })
.then(async (res) => { .then(async (res) => {
this.reaquestFlag = false
if (this.$platform == 'ios') { if (this.$platform == 'ios') {
if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo.type == 1 && res.video.m3u8Url == '') { if (this.currentVideo.type == 1 && res.video.m3u8Url == null || this.currentVideo.type == 1 && res.video.m3u8Url == '') {
// 只存在私有加密 // 只存在私有加密
@@ -298,6 +307,12 @@
console.log("是否获取到初始播放值", data); console.log("是否获取到初始播放值", data);
that.$forceUpdate(); that.$forceUpdate();
}).catch(e => {
this.reaquestFlag = false
uni.showToast({
'title': '获取播放地址失败',
icon:'none'
})
}); });
}, },
@@ -533,7 +548,7 @@
                height: '100%', //容器的大小                 height: '100%', //容器的大小
                "qualitySort": "asc",                 "qualitySort": "asc",
                "cover": "",                 "cover": "",
                "autoplay": false,                 "autoplay": true,
            "isLive": false,             "isLive": false,
            "rePlay": false,             "rePlay": false,
            "playsinline": true,             "playsinline": true,
@@ -662,7 +677,7 @@
var player = new Aliplayer(playerOptions, function(player) {}); var player = new Aliplayer(playerOptions, function(player) {});
this.player = player; this.player = player;
myplayer = 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) console.log('是否拿到第一次初始值呢', this.platform, typeof this.firstTime, this.firstTime)
player.on('ready', function() { player.on('ready', function() {
@@ -759,8 +774,15 @@
if(videoData.type == 1){ if(videoData.type == 1){
if(videoData.m3u8Url != '' && videoData.m3u8Url != null){ if(videoData.m3u8Url != '' && videoData.m3u8Url != null){
// myplayer.source(videoData.m3u8Url) // 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,); console.log('可能是切换视频',myplayer,videoData,);