fix: webcam no longer throws if no frames are recorded
This commit is contained in:
parent
b5c5600b93
commit
aa864e01d0
@ -241,17 +241,23 @@ module.exports = function (rootMsg, branchMsg, opts) {
|
||||
// stop capture
|
||||
clearInterval(recordInterval)
|
||||
|
||||
// show output stream
|
||||
invideo.classList.add('hide')
|
||||
outvideo.classList.remove('hide')
|
||||
|
||||
// remove 'recording' border
|
||||
invideo.classList.remove('recording')
|
||||
|
||||
// produce output
|
||||
if (encoder.frames && encoder.frames.length) {
|
||||
blob = encoder.compile()
|
||||
console.log('Webm video encoded:', blob.size, 'bytes')
|
||||
outvideo.src = URL.createObjectURL(blob, 'video/webm')
|
||||
|
||||
// show output stream
|
||||
invideo.classList.add('hide')
|
||||
outvideo.classList.remove('hide')
|
||||
} else {
|
||||
// show input stream
|
||||
invideo.classList.remove('hide')
|
||||
outvideo.classList.add('hide')
|
||||
}
|
||||
enable()
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user