阿里云播放器重写....未完成

This commit is contained in:
@fawn-nine
2024-08-02 16:26:50 +08:00
parent 7ee7b52c93
commit f726ecf29a
3 changed files with 28 additions and 10 deletions

View File

@@ -48,7 +48,6 @@ export default {
}, },
handleClick(data) { handleClick(data) {
console.log("data at line 35:", data); console.log("data at line 35:", data);
this.$emit("open", data); this.$emit("open", data);
}, },

View File

@@ -126,11 +126,13 @@
this.isChange = false; this.isChange = false;
}, },
async changeVideo(data) { async changeVideo(data) {
console.log('changeVideo',);
this.currentTime = ""; this.currentTime = "";
this.firstTime = 0; this.firstTime = 0;
this.isSetFirstTime = false; this.isSetFirstTime = false;
this.isChange = false; this.isChange = false;
await this.init(data, true); this.getLive(true, this.currentVideo)
// await this.init(data, true);
}, },
screenChange(data) { screenChange(data) {
console.log( console.log(
@@ -232,13 +234,17 @@
uni.setStorageSync("videoOssList", JSON.stringify(list)); uni.setStorageSync("videoOssList", JSON.stringify(list));
}, },
// 获取播放凭证 // 获取播放凭证
async getLive(isChange) { async getLive(isChange,newVideoData) {
var that = this; var that = this;
this.isfresh = false; this.isfresh = false;
var data = { var data = {
...this.options, ...this.options,
}; };
if(isChange && newVideoData){
data = {
...newVideoData,
};
}
await $http await $http
.request({ .request({
url: `sociology/course/checkVideo`, url: `sociology/course/checkVideo`,
@@ -358,7 +364,7 @@
var _seconds = 0 var _seconds = 0
var curStatus = null var curStatus = null
var diff = 0 var diff = 0
var myplayer = undefined
import $ from 'jquery' import $ from 'jquery'
export default { export default {
components: { components: {
@@ -654,7 +660,9 @@
} }
var player = new Aliplayer(playerOptions, function(player) {}); var player = new Aliplayer(playerOptions, function(player) {});
this.player = player; this.player = player;
myplayer = player;
console.log('myplayer------------',myplayer);
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() {
@@ -747,6 +755,15 @@
receiveMsg(newValue, oldValue, ownerVm, vm) { receiveMsg(newValue, oldValue, ownerVm, vm) {
//数据变化 //数据变化
videoData = newValue videoData = newValue
if(videoData){
if(videoData.type == 1){
if(videoData.m3u8Url != '' && videoData.m3u8Url != null){
// myplayer.source(videoData.m3u8Url)
console.log('走了吗?');
}
}
}
console.log('可能是切换视频',myplayer,videoData,);
}, },
receiveWinWidth(newValue, oldValue, ownerVm, vm) { receiveWinWidth(newValue, oldValue, ownerVm, vm) {
//数据变化 //数据变化

View File

@@ -280,14 +280,16 @@ export default {
}); });
}, },
changeVideo(data) { changeVideo(data) {
console.log("data at line 370:", data); console.log("data at line 370:", data);
if (data.id != this.currentVideo.id) { if (data.id != this.currentVideo.id) {
// handleEnd // handleEnd
this.$refs.commonVideo.handleEnd(); // this.$refs.commonVideo.handleEnd();
setTimeout(() => { setTimeout(() => {
this.currentVideo = data; this.currentVideo = data;
this.initVideo(); this.$refs.commonVideo.changeVideo();
// this.changeVideo()
// this.initVideo();
this.isOpenMp3 = false; this.isOpenMp3 = false;
}, 500); }, 500);
} else { } else {
@@ -296,7 +298,7 @@ export default {
this.isOpenMp3 = false; this.isOpenMp3 = false;
} }
console.log("data at line 380111111111111111111:", data.type); // console.log("data at line 380111111111111111111:", data.type);
}, },
hancleModalCancel() { hancleModalCancel() {
this.show = false; this.show = false;