修复工作
This commit is contained in:
@@ -35,14 +35,17 @@ export default {
|
||||
methods: {
|
||||
createPlayer(url, hasCloseBtn, index) {
|
||||
if (!url) {
|
||||
console.error('播放地址为空');
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.player) {
|
||||
console.log('播放器已存在,切换视频源');
|
||||
this.changeVideo(url);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('创建播放器,URL:', url, 'Element ID:', this.elId);
|
||||
this.isPlay = true;
|
||||
this.player = new FlvJsPlayer({
|
||||
id: this.elId,
|
||||
@@ -71,6 +74,21 @@ export default {
|
||||
autoCleanupMinBackwardDuration: 30 * 60
|
||||
} //flv.js可选配置项 [flv.js配置](https://github.com/bilibili/flv.js/blob/master/docs/api.md#config)
|
||||
});
|
||||
|
||||
// 监听播放器错误
|
||||
this.player.on('error', (error) => {
|
||||
console.error('播放器错误:', error);
|
||||
});
|
||||
|
||||
// 监听播放器就绪
|
||||
this.player.on('ready', () => {
|
||||
console.log('播放器就绪');
|
||||
});
|
||||
|
||||
// 监听播放开始
|
||||
this.player.on('play', () => {
|
||||
console.log('开始播放');
|
||||
});
|
||||
|
||||
// 自定义播放器按钮
|
||||
// let divStr =
|
||||
|
||||
@@ -69,8 +69,10 @@ const getDetails = async (deviceId) => {
|
||||
const res = await getDevice(deviceId);
|
||||
tableData.value = res.data;
|
||||
// 使用当前访问的域名和端口,通过Nginx代理访问视频流
|
||||
// 注意:RTSP URL需要原样传递,不要编码,&&&作为特殊分隔符
|
||||
// 添加ffmpeg=true参数,强制使用FFmpeg转换为FLV格式
|
||||
playUrl.value = `${window.location.origin}/live?url=${tableData.value.url}&&&ffmpeg=true`;
|
||||
console.log('播放地址:', playUrl.value);
|
||||
handlePlay();
|
||||
}
|
||||
|
||||
|
||||
@@ -148,9 +148,9 @@ xss:
|
||||
|
||||
# 流媒体服务端口
|
||||
mediasServer:
|
||||
port: ${MEDIA_SERVER_PORT:8866}
|
||||
# 监听地址,支持环境变量配置
|
||||
address: ${MEDIA_SERVER_ADDRESS:0.0.0.0}
|
||||
port: ${MEDIA_SERVER_PORT:10083}
|
||||
# 监听地址,支持环境变量配置(默认127.0.0.1,只监听本地,通过Nginx代理)
|
||||
address: ${MEDIA_SERVER_ADDRESS:127.0.0.1}
|
||||
# 网络超时,15秒
|
||||
netTimeout: 15000000
|
||||
# 读写超时,15秒
|
||||
|
||||
Reference in New Issue
Block a user