播放器微调

This commit is contained in:
@fawn-nine
2024-10-16 11:52:33 +08:00
parent b085aafbf3
commit 9e5fc93acf

View File

@@ -579,7 +579,7 @@
}, },
// renderjs阿里云播放器引入与配置 // renderjs阿里云播放器引入与配置
getLive() { getLive() {
console.log('这是这只只是666666:', this.firstTime, this.videoData) console.log('阿里云播放器引入与配置:', this.firstTime, videoData)
$('#url-player-test').empty(); $('#url-player-test').empty();
@@ -715,18 +715,17 @@
} }
if (this.videoData.type == 1) { if (videoData.type == 1) {
if (this.videoData.m3u8Url == null || this.videoData.m3u8Url == '') { if (videoData.m3u8Url == null || videoData.m3u8Url == '') {
console.log('这是私有加密的视频'); console.log('这是私有加密的视频');
if (this.$platform == 'ios') { if (this.$platform == 'ios') {
this.$refs.videoContent5.click() this.$refs.videoContent5.click()
} else { } else {
playerOptions = { playerOptions = {
...playerOptions, ...playerOptions,
"vid": this.videoData "vid": videoData.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
.videoId, // 必选参数,可以通过点播控制台(路径:媒资库>音/视频查询。示例1e067a2831b641db90d570b6480f****。
"playauth": this.videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。 "playauth": videoData.playAuth, // 必选参数参数值可通过调用GetVideoPlayAuth接口获取。
"encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。 "encryptType": 1, // 必选参数当播放私有加密流时需要设置本参数值为1。其它情况无需设置。
"playConfig": { "playConfig": {
"EncryptType": 'AliyunVoDEncryption' "EncryptType": 'AliyunVoDEncryption'
@@ -734,19 +733,19 @@
} }
console.log('这是私有加密的视频'); console.log('这是私有加密的视频');
} }
} else if (this.videoData.m3u8Url != null || this.videoData.m3u8Url != '') { } else if (videoData.m3u8Url != null || videoData.m3u8Url != '') {
playerOptions = { playerOptions = {
...playerOptions, ...playerOptions,
source: this.videoData.m3u8Url, source: videoData.m3u8Url,
// "playConfig": {"EncryptType": "HLSEncryption"} // "playConfig": {"EncryptType": "HLSEncryption"}
} }
console.log('这是标准加密的视频', this.videoData.id, this.videoData.m3u8Url); console.log('这是标准加密的视频', videoData.id, videoData.m3u8Url);
} }
} else { } else {
playerOptions = { playerOptions = {
...playerOptions, ...playerOptions,
source: this.videoData.videoUrl source: videoData.videoUrl
} }
console.log('这是没有加密的视频'); console.log('这是没有加密的视频');
} }
@@ -874,25 +873,8 @@
// 监听视频参数变化,并赋值给常量 // 监听视频参数变化,并赋值给常量
receiveMsg(newValue, oldValue, ownerVm, vm) { receiveMsg(newValue, oldValue, ownerVm, vm) {
//数据变化 //数据变化
videoData = newValue videoData = newValue
if (videoData) {
return
console.log('切换后的播放数据videoData', videoData.type);
if (videoData.type == 1) {
if (videoData.m3u8Url != '' && videoData.m3u8Url != null) {
// myplayer.source(videoData.m3u8Url)
myplayer.loadByUrl(videoData.m3u8Url)
console.log('切换走了吗m3u8');
} else {
myplayer.replayByVidAndPlayAuth(videoData.videoId, videoData.playAuth)
console.log('切换走了吗?私有加密');
}
} else {
myplayer.loadByUrl(videoData.videoUrl)
console.log('切换常规视频');
}
}
// console.log('可能是切换视频', videoData, );
}, },
receiveWinWidth(newValue, oldValue, ownerVm, vm) { receiveWinWidth(newValue, oldValue, ownerVm, vm) {
//数据变化 //数据变化
@@ -904,8 +886,8 @@
}, },
// 检测是否传入播放参数 // 检测是否传入播放参数
checkValue() { checkValue() {
console.log(this.videoId, this.authId, this.videoData, "1111888888") console.log(this.videoId, this.authId, videoData, "1111888888")
if ((!this.videoData.playAuth || !this.currentVideoList)) { if ((!videoData.playAuth || !this.currentVideoList)) {
setTimeout(() => { setTimeout(() => {
this.checkValue(); this.checkValue();
}, 1000); }, 1000);