修复工作

This commit is contained in:
2025-10-01 22:38:48 +08:00
parent fc88a11af3
commit 144fa7b423
3 changed files with 23 additions and 3 deletions

View File

@@ -35,14 +35,17 @@ export default {
methods: { methods: {
createPlayer(url, hasCloseBtn, index) { createPlayer(url, hasCloseBtn, index) {
if (!url) { if (!url) {
console.error('播放地址为空');
return; return;
} }
if (this.player) { if (this.player) {
console.log('播放器已存在,切换视频源');
this.changeVideo(url); this.changeVideo(url);
return; return;
} }
console.log('创建播放器URL:', url, 'Element ID:', this.elId);
this.isPlay = true; this.isPlay = true;
this.player = new FlvJsPlayer({ this.player = new FlvJsPlayer({
id: this.elId, id: this.elId,
@@ -71,6 +74,21 @@ export default {
autoCleanupMinBackwardDuration: 30 * 60 autoCleanupMinBackwardDuration: 30 * 60
} //flv.js可选配置项 [flv.js配置](https://github.com/bilibili/flv.js/blob/master/docs/api.md#config) } //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 = // let divStr =

View File

@@ -69,8 +69,10 @@ const getDetails = async (deviceId) => {
const res = await getDevice(deviceId); const res = await getDevice(deviceId);
tableData.value = res.data; tableData.value = res.data;
// 使用当前访问的域名和端口通过Nginx代理访问视频流 // 使用当前访问的域名和端口通过Nginx代理访问视频流
// 注意RTSP URL需要原样传递不要编码&&&作为特殊分隔符
// 添加ffmpeg=true参数强制使用FFmpeg转换为FLV格式 // 添加ffmpeg=true参数强制使用FFmpeg转换为FLV格式
playUrl.value = `${window.location.origin}/live?url=${tableData.value.url}&&&ffmpeg=true`; playUrl.value = `${window.location.origin}/live?url=${tableData.value.url}&&&ffmpeg=true`;
console.log('播放地址:', playUrl.value);
handlePlay(); handlePlay();
} }

View File

@@ -148,9 +148,9 @@ xss:
# 流媒体服务端口 # 流媒体服务端口
mediasServer: mediasServer:
port: ${MEDIA_SERVER_PORT:8866} port: ${MEDIA_SERVER_PORT:10083}
# 监听地址,支持环境变量配置 # 监听地址,支持环境变量配置默认127.0.0.1只监听本地通过Nginx代理
address: ${MEDIA_SERVER_ADDRESS:0.0.0.0} address: ${MEDIA_SERVER_ADDRESS:127.0.0.1}
# 网络超时15秒 # 网络超时15秒
netTimeout: 15000000 netTimeout: 15000000
# 读写超时15秒 # 读写超时15秒