ffmpeg-service/server/ffmpeg/monitor.mjs

27 lines
568 B
JavaScript
Raw Permalink Normal View History

2022-05-25 18:47:38 +00:00
import { EventEmitter } from 'events'
export default class Monitor extends EventEmitter {
constructor(wss, db, encoder, opts = {}) {
super()
this.wss = wss
this.db = db
this.encoder = encoder
this.encoder.on('stdout', (data) => {
console.log('stdout', { data })
})
this.encoder.on('stderr', (data) => {
console.log('stderr', { data })
})
this.encoder.on('status', (status) => {
this.emit('status', status)
})
}
start() {
this.encoder.start()
}
status() {
return this.encoder.status()
}
}