修复工作

This commit is contained in:
2025-10-02 15:06:35 +08:00
parent 89535c9a5c
commit 1deafab5b3
4 changed files with 99 additions and 38 deletions

View File

@@ -120,16 +120,31 @@ export default {
// 如果找到了 flv 实例,绑定事件
if (flvInstance && typeof flvInstance.on === 'function') {
console.log('✅ flv.js 实例已找到,开始绑定事件');
console.log('🔍 flv.js 配置:', flvInstance._config);
// 监听 flv.js 的统计信息
let statsCount = 0;
flvInstance.on('statistics_info', (stats) => {
console.log('📈 flv.js 统计:', {
speed: stats.speed,
videoBufferSize: stats.videoBufferSize,
audioBufferSize: stats.audioBufferSize,
decodedFrames: stats.decodedFrames,
droppedFrames: stats.droppedFrames
});
statsCount++;
// 只输出前几次和有变化的统计
if (statsCount <= 3 || stats.decodedFrames > 0 || statsCount % 20 === 0) {
console.log('📈 flv.js 统计 #' + statsCount + ':', {
speed: stats.speed.toFixed(2) + ' KB/s',
videoBufferSize: stats.videoBufferSize,
audioBufferSize: stats.audioBufferSize,
decodedFrames: stats.decodedFrames,
droppedFrames: stats.droppedFrames
});
}
// 如果收到了很多数据但没有解码任何帧,说明格式有问题
if (statsCount > 10 && stats.decodedFrames === 0) {
console.error('❌ 已接收数据但无法解码!可能的原因:');
console.error(' 1. FLV 流缺少元数据onMetaData');
console.error(' 2. 视频编码格式不支持(需要 H.264');
console.error(' 3. FLV 封装格式错误');
console.error(' 建议:检查后端 FFmpeg 日志是否有错误');
}
});
// 监听 flv.js 的错误

View File

@@ -70,10 +70,10 @@ const getDetails = async (deviceId) => {
tableData.value = res.data;
// 直接访问后端视频流服务器10083端口绕过Nginx反代避免缓冲问题
// 注意RTSP URL需要原样传递不要编码&&&作为特殊分隔符
// 使用 ffmpeg=true系统 FFmpeg 包含完整的编码器支持(包括 libx264
// 🔧 测试:使用 JavaCV 方案(不使用 FFmpeg
const videoServerUrl = 'http://49.232.154.205:10083';
playUrl.value = `${videoServerUrl}/live?url=${tableData.value.url}&&&ffmpeg=true`;
console.log('📺 播放地址(直连后端:', playUrl.value);
playUrl.value = `${videoServerUrl}/live?url=${tableData.value.url}`; // 不加 &&&ffmpeg=true
console.log('📺 播放地址(JavaCV 方案:', playUrl.value);
handlePlay();
}