hauk0101 / video-hls-encrypt

一个基于hls协议的视频加密Demo
515 stars 124 forks source link

本地测试ok,vps测试app crashed - waiting for file changes before starting... #19

Closed EvenCu closed 1 year ago

EvenCu commented 1 year ago

环境相同 请大佬帮忙看看 错误日志


begin encrypt Fun
Stderr output: ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers
/home/debian/video-hls-encrypt/app/controllers/encrypt.js:59
                socket.emit('encrypt-event',{msg:stderrLine});
                       ^

TypeError: Cannot read property 'emit' of undefined
    at FfmpegCommand.<anonymous> (/home/debian/video-hls-encrypt/app/controllers/encrypt.js:59:24)
    at FfmpegCommand.emit (events.js:400:28)
    at /home/debian/video-hls-encrypt/app/node_modules/fluent-ffmpeg/lib/processor.js:511:22
    at /home/debian/video-hls-encrypt/app/node_modules/fluent-ffmpeg/lib/utils.js:387:34
    at Array.forEach (<anonymous>)
    at emit (/home/debian/video-hls-encrypt/app/node_modules/fluent-ffmpeg/lib/utils.js:387:11)
    at Object.append (/home/debian/video-hls-encrypt/app/node_modules/fluent-ffmpeg/lib/utils.js:412:13)
    at Socket.<anonymous> (/home/debian/video-hls-encrypt/app/node_modules/fluent-ffmpeg/lib/processor.js:203:20)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:293:12)
[nodemon] app crashed - waiting for file changes before starting...
hauk0101 commented 1 year ago

TypeError: Cannot read property 'emit' of undefined 看着像是 websocket 连接有问题,导致 socket 对象没有传入,可以在 app.io.on('connection', function (socket) { mysocket = socket; }); 的逻辑里面加一些 error 处理