fix: webcam no longer throws if no frames are recorded

This commit is contained in:
Paul Frazee 2015-09-29 12:50:01 -05:00
förälder b5c5600b93
incheckning aa864e01d0
1 ändrade filer med 13 tillägg och 7 borttagningar

Visa fil

@ -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
blob = encoder.compile()
console.log('Webm video encoded:', blob.size, 'bytes')
outvideo.src = URL.createObjectURL(blob, 'video/webm')
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()
}