2023年10月24日 删除超时退出的逻辑,修改主播放界面和子播放界面播放不了的问题

This commit is contained in:
bai 2023-10-24 09:31:25 +08:00
parent f15a09b94f
commit c08f36d16d
4 changed files with 76 additions and 72 deletions

View File

@ -73,9 +73,10 @@ export const transform: AxiosTransform = {
switch (code) { switch (code) {
case ResultEnum.TIMEOUT: case ResultEnum.TIMEOUT:
timeoutMsg = t('sys.api.timeoutMessage'); timeoutMsg = t('sys.api.timeoutMessage');
const userStore = useUserStoreWithOut(); //请求超时,不再退出登录。
userStore.setToken(undefined); // const userStore = useUserStoreWithOut();
userStore.logout(true); // userStore.setToken(undefined);
// userStore.logout(true);
break; break;
default: default:
if (message) { if (message) {

View File

@ -68,69 +68,69 @@ function init(){
player.value = playerMain; player.value = playerMain;
playerMain.ready(function() { // playerMain.ready(function() {
// playerMain.controlBar.addChild('TitleBar', { // // playerMain.controlBar.addChild('TitleBar', {
// // text: '退', // // // text: '退',
// el: videojs.createEl('button', { // // el: videojs.createEl('button', {
// title: '退', // // title: '退',
// className: 'vjs-icon-previous-item vjs-fast-replay-button vjs-control vjs-button', // // className: 'vjs-icon-previous-item vjs-fast-replay-button vjs-control vjs-button',
// innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text" aria-live="polite">退</span>' // // innerHTML: '<span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text" aria-live="polite">退</span>'
// }), // // }),
// clickHandler: function() { // // clickHandler: function() {
// playerMain.currentTime(playerMain.currentTime() - 10); // // playerMain.currentTime(playerMain.currentTime() - 10);
// } // // }
// }); // // });
// console.log('videojs ->',videojs); // // console.log('videojs ->',videojs);
// let buttonList:Array<String> = []; // // let buttonList:Array<String> = [];
let currentSources:any = playerMain.currentSources(); // let currentSources:any = playerMain.currentSources();
// currentSources?.forEach(x => { // // currentSources?.forEach(x => {
// buttonList.push(`<option value ="" style="color: black;"></option>`); // // buttonList.push(`<option value ="" style="color: black;"></option>`);
// }) // // })
let currentSource = currentSources[0]; // let currentSource = currentSources[0];
let _playerMain: any = playerMain; // let _playerMain: any = playerMain;
let _videojs: any = videojs; // let _videojs: any = videojs;
return; // return;
_playerMain.controlBar.addChild('Button', { // _playerMain.controlBar.addChild('Button', {
text: '选择清晰度', // text: '',
el: _videojs.createEl('button', { // el: _videojs.createEl('button', {
title: '选择清晰度', // title: '',
className: 'vjs-control', // className: 'vjs-control',
innerHTML: ` // innerHTML: `
<select class="changeDefinitionBtn" style="-webkit-appearance: none;background-color: rgba(0,0,0,0);border-radius: 0px" data-url="${currentSource || ''}"> // <select class="changeDefinitionBtn" style="-webkit-appearance: none;background-color: rgba(0,0,0,0);border-radius: 0px" data-url="${currentSource || ''}">
<option value ="" style="color: black;">原画</option> // <option value ="" style="color: black;"></option>
<option value ="_hi" style="color: black;">高清</option> // <option value ="_hi" style="color: black;"></option>
<option value ="_mid" style="color: black;">流畅</option> // <option value ="_mid" style="color: black;"></option>
<option value="_low" style="color: black;">标清</option> // <option value="_low" style="color: black;"></option>
</select> // </select>
` // `
}), // }),
clickHandler: function() { // clickHandler: function() {
let el:any = playerMain.el().querySelector('.changeDefinitionBtn'); // let el:any = playerMain.el().querySelector('.changeDefinitionBtn');
let currentSources:any = playerMain.currentSources(); // let currentSources:any = playerMain.currentSources();
let oldUrl = currentSources[0]?.src; // let oldUrl = currentSources[0]?.src;
if(el){ // if(el){
let suffix = el.options[el.options.selectedIndex].value; // let suffix = el.options[el.options.selectedIndex].value;
let url = el.dataset.url; // let url = el.dataset.url;
if(url){ // if(url){
if(suffix){// // if(suffix){//
url = url.replaceAll('.m3u8',''); // url = url.replaceAll('.m3u8','');
url += suffix + '.m3u8'; // url += suffix + '.m3u8';
} // }
if(oldUrl != url){// // if(oldUrl != url){//
playerMain.src([{ type: 'application/x-mpegURL', src: url}]); // playerMain.src([{ type: 'application/x-mpegURL', src: url}]);
playerMain.play(); // playerMain.play();
} // }
} // }
} // }
} // }
}); // });
}); // });
} }

View File

@ -6,7 +6,7 @@
<headerPage/> <headerPage/>
<!-- 主体部分 --> <!-- 主体部分 -->
<a-layout-content> <a-layout-content>
<div style="width:100%;height: 100%;margin-top: 1rem;" v-if="isError"> <div style="width:100%;height: 100%;margin-top: 1rem;" v-if="!isError">
<a-row :gutter="[16,16]"> <a-row :gutter="[16,16]">
<a-col :xs="{ span: 24 }" :sm="{ span: 19 }" :lg="{ span: 19 }"> <a-col :xs="{ span: 24 }" :sm="{ span: 19 }" :lg="{ span: 19 }">
<div> <div>
@ -161,10 +161,9 @@ onMounted(() => {
getSuibi(); getSuibi();
getKcxx(); getKcxx();
// //
isError.value = true;
}else{
isError.value = false; isError.value = false;
}else{
isError.value = true;
} }
}); });
@ -203,13 +202,17 @@ function changeLive(item:any){
console.log(`🚀 --------------------------------------------------------------------------------🚀`); console.log(`🚀 --------------------------------------------------------------------------------🚀`);
console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player); console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player);
console.log(`🚀 --------------------------------------------------------------------------------🚀`); console.log(`🚀 --------------------------------------------------------------------------------🚀`);
let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn'); // let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
//URL //URL
if(buttonEl){ // if(buttonEl){
buttonEl.dataset.url = url; // buttonEl.dataset.url = url;
} // }
curentPlayerVideo.value = item; curentPlayerVideo.value = item;
// nextTick(() => {
//
//mainVideo?.player?.play();
// })
} }
function mainVideoLoadEnd(player){ function mainVideoLoadEnd(player){

View File

@ -194,11 +194,11 @@ function changeLive(item:any){
console.log(`🚀 --------------------------------------------------------------------------------🚀`); console.log(`🚀 --------------------------------------------------------------------------------🚀`);
console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player); console.log(`🚀 ~ file: viewPage.vue:164 ~ changeLive ~ mainVideo?.player:`, mainVideo?.player);
console.log(`🚀 --------------------------------------------------------------------------------🚀`); console.log(`🚀 --------------------------------------------------------------------------------🚀`);
let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn'); // let buttonEl = mainVideo?.player.el().querySelector('.changeDefinitionBtn');
//URL //URL
if(buttonEl){ // if(buttonEl){
buttonEl.dataset.url = url; // buttonEl.dataset.url = url;
} // }
curentPlayerVideo.value = item; curentPlayerVideo.value = item;
} }