This commit is contained in:
yangjun 2023-04-23 18:45:09 +08:00
parent 1eb83893d1
commit 7afe7a0f65
2 changed files with 30 additions and 15 deletions

View File

@ -105,7 +105,7 @@ const videoOption = reactive({
muted: true, // muted: true, //
playsinline: true, playsinline: true,
webFullScreen: false, webFullScreen: false,
speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], // // speedRate: ["0.75", "1.0", "1.25", "1.5", "2.0"], //
autoPlay: false, // autoPlay: false, //
loop: false, // loop: false, //
mirror: false, // mirror: false, //
@ -174,11 +174,8 @@ function playerVideo(item){
//rtsp://admin:admin@10.250.116.235:8554/live //rtsp://admin:admin@10.250.116.235:8554/live
console.log('bVideoRefs ->',bVideoRefs,Object.values(bVideoRefs.value)); console.log('bVideoRefs ->',bVideoRefs,Object.values(bVideoRefs.value));
(Object.values(bVideoRefs.value)).forEach((x: any) => { (Object.keys(bVideoRefs.value)).forEach((key) => {
console.log(`🚀 ~ file: index.vue:180 ~ key:`, key)
console.log(`🚀 ----------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:148 ~ playerVideo ~ x:`, x);
console.log(`🚀 ----------------------------------------------🚀`);
// x.connectFn('rtsp://admin:admin@10.250.116.235:8554/live','external') // x.connectFn('rtsp://admin:admin@10.250.116.235:8554/live','external')
// if(Number(Number(Math.random()).toFixed(1))*10 >= 5){ // if(Number(Number(Math.random()).toFixed(1))*10 >= 5){
// x.connectFn('rtsp://127.0.0.1:8554/video','external'); // x.connectFn('rtsp://127.0.0.1:8554/video','external');
@ -186,12 +183,29 @@ function playerVideo(item){
// x.connectFn(`rtsp://${x.ip}/live`,'external') // x.connectFn(`rtsp://${x.ip}/live`,'external')
// } // }
// return; // return;
if(x.changshang == '奥威亚'){ let videoRef = bVideoRefs.value[key];
x.connectFn(`rtsp://${x.ip}/stream/0?config.login=web`,'external') console.log(`🚀 ~ file: index.vue:187 ~ videoRef:`, videoRef)
}else if(x.changshang == '卓智'){
x.connectFn(`rtsp://${x.ip}/live`,'external') let childItem = currentItem.value.child[key];
console.log(`🚀 ~ file: index.vue:189 ~ childItem:`, childItem)
if(!childItem){
console.log('无法找到视频链接对象currentItem.value.child[key] ->',currentItem,key);
return;
} }
if(childItem.changshang == '奥威亚'){
videoRef.connectFn(`rtsp://${childItem.ip}/stream/0?config.login=web`,'external')
}else if(childItem.changshang == '卓智'){
videoRef.connectFn(`rtsp://${childItem.ip}/live`,'external')
}else{
videoRef.connectFn(`rtsp://${childItem.ip}/stream/0?config.login=web`,'external')
}
}); });
// (Object.values(bVideoRefs.value)).forEach((videoRef: any) => {
// console.log(`🚀 ~ file: index.vue:148 ~ playerVideo ~ videoRef:`, videoRef);
// });
setTimeout(() => { setTimeout(() => {
switchVideoToMain(); switchVideoToMain();
},1000); },1000);
@ -211,11 +225,7 @@ function calcOtherVideo() :any{
} }
function switchVideoToMain(){ function switchVideoToMain(){
console.log(`🚀 ~ file: index.vue:188 ~ switchVideoToMain ~ switchVideoToMain: 自动切换第一个子界面到主界面`);
console.log(`🚀 ------------------------------------------------------------------------------------🚀`);
console.log(`🚀 ~ file: index.vue:188 ~ switchVideoToMain ~ switchVideoToMain:`);
console.log(`🚀 ------------------------------------------------------------------------------------🚀`);
nextTick(() => { nextTick(() => {
let mainVideo = <HTMLVideoElement> document.querySelector('#mainVideo'); let mainVideo = <HTMLVideoElement> document.querySelector('#mainVideo');
let firstVideo = <HTMLVideoElement> document.querySelector('.videoMax video'); let firstVideo = <HTMLVideoElement> document.querySelector('.videoMax video');
@ -225,6 +235,7 @@ function switchVideoToMain(){
} }
function bVideoClick(e){ function bVideoClick(e){
console.log(`bVideoClick: 切换至主界面`);
let mainVideo = <HTMLVideoElement> document.querySelector('#mainVideo'); let mainVideo = <HTMLVideoElement> document.querySelector('#mainVideo');
let currentVideo = <HTMLVideoElement> e.srcElement; let currentVideo = <HTMLVideoElement> e.srcElement;
mainVideo.srcObject = currentVideo.srcObject mainVideo.srcObject = currentVideo.srcObject

View File

@ -47,6 +47,7 @@ nextTick(() => {
onMounted(() => { onMounted(() => {
console.log('连接流!入口');
webRtcServer.value = initWebRtcStreamer(props.videoKey); webRtcServer.value = initWebRtcStreamer(props.videoKey);
}) })
@ -54,16 +55,19 @@ function getVideo(){
return document.querySelector('#'+props.videoKey) return document.querySelector('#'+props.videoKey)
} }
function initWebRtcStreamerFn(){ function initWebRtcStreamerFn(){
console.log('连接流!');
webRtcServer.value = initWebRtcStreamer(props.videoKey); webRtcServer.value = initWebRtcStreamer(props.videoKey);
return webRtcServer.value; return webRtcServer.value;
} }
function closeWebRtcStreamerFn(){ function closeWebRtcStreamerFn(){
console.log('关闭流!');
closeWebRtcStreamer(webRtcServer.value); closeWebRtcStreamer(webRtcServer.value);
webRtcServer.value = null webRtcServer.value = null
} }
function connectFn(url:string,type?){ function connectFn(url:string,type?){
console.log(`🚀 ~ file: video.vue:67 ~ connectFn ~ url:`, url)
// let _path = `rtsp://${url}/stream/0?config.login=web`; // let _path = `rtsp://${url}/stream/0?config.login=web`;
// if(type == 'external'){ // if(type == 'external'){
// } // }