类型:开发
描述:
This commit is contained in:
@@ -168,8 +168,12 @@
|
||||
this.hls = new WebRTCWhep({
|
||||
url: this.url, // WHEP 服务器地址
|
||||
container: this.video, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
this.hls.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
this.initializePlayer();
|
||||
}
|
||||
})
|
||||
}else{
|
||||
|
||||
@@ -132,8 +132,12 @@ const createPlayer = (cameraIndexCode,videoElement) => {
|
||||
const player = new WebRTCWhep({
|
||||
url:url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
player.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
createPlayer(cameraIndexCode,videoElement)
|
||||
}
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
|
||||
@@ -102,8 +102,12 @@ let isCollect = ref(0)
|
||||
const player = new WebRTCWhep({
|
||||
url:url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
player.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
createPlayer(cameraIndexCode,videoElement);
|
||||
}
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
|
||||
@@ -290,8 +290,12 @@
|
||||
const player = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
player.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
createPlayer(cameraIndexCode,videoElement);
|
||||
}
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
|
||||
@@ -347,8 +347,12 @@
|
||||
const player = new WebRTCWhep({
|
||||
url:url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',Username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
player.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
createPlayer(cameraIndexCode,videoElement);
|
||||
}
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
@@ -428,11 +432,19 @@
|
||||
cameraIndexCode.value = code
|
||||
setTimeout(() => {
|
||||
if (url.startsWith('http://192.168.77.200:8050/')) {
|
||||
hlsRef = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoRef.value, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
if(hlsRef){
|
||||
hlsRef.updateUrl(url);
|
||||
}else{
|
||||
hlsRef = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoRef.value, // 视频播放容器
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
}
|
||||
hlsRef.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
handleItemVideo(url, type, code, item);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
|
||||
@@ -374,11 +374,20 @@ const handleItemVideo = async (url, type, code, item) => {
|
||||
cameraIndexCode.value = code
|
||||
setTimeout(() => {
|
||||
if (url.startsWith('http://192.168.77.200:8050/')) {
|
||||
hlsRef = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoRef.value, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
if(hlsRef){
|
||||
hlsRef.updateUrl(url);
|
||||
}else{
|
||||
hlsRef = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoRef.value, // 视频播放容器
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
|
||||
}
|
||||
hlsRef.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
handleItemVideo(url, type, code, item);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
@@ -499,8 +508,12 @@ const createPlayer = (cameraIndexCode,videoElement) => {
|
||||
const player = new WebRTCWhep({
|
||||
url: url, // WHEP 服务器地址
|
||||
container: videoElement, // 视频播放容器
|
||||
onError: (error) => {
|
||||
console.error('播放错误:', error)
|
||||
iceservers: [{ urls: 'turn:192.168.77.200:3478',username: 'ZLMediaKit',credential: 'ZLMediaKit'}]
|
||||
})
|
||||
player.on('error', (error) => {
|
||||
console.error('错误:', error.message, error.type)
|
||||
if(error.type ==='REQUEST_ERROR' || error.type ==='NOT_FOUND_ERROR'){
|
||||
createPlayer(cameraIndexCode,videoElement)
|
||||
}
|
||||
})
|
||||
webrtcRefs.push(player)
|
||||
|
||||
Reference in New Issue
Block a user