Cleanup unsupported codec detection (#569)

Review: @dcposch
This commit is contained in:
Feross Aboukhadijeh
2016-05-22 23:35:29 -07:00
committed by DC
parent fca1d9dae4
commit ffce76a9b1

View File

@@ -125,15 +125,18 @@ function renderMedia (state) {
} }
function onCanPlay (e) { function onCanPlay (e) {
var video = e.target var elem = e.target
if (video.webkitVideoDecodedByteCount > 0 && if (state.playing.type === 'video') {
video.webkitAudioDecodedByteCount === 0) { if (elem.webkitVideoDecodedByteCount === 0) {
dispatch('mediaError', 'Video codec unsupported')
} else if (elem.webkitAudioDecodedByteCount === 0) {
dispatch('mediaError', 'Audio codec unsupported')
}
} else if (state.playing.type === 'audio' &&
elem.webkitAudioDecodedByteCount === 0) {
dispatch('mediaError', 'Audio codec unsupported') dispatch('mediaError', 'Audio codec unsupported')
} else if (state.playing.type === 'video' &&
video.webkitVideoDecodedByteCount === 0) {
dispatch('mediaError', 'Video codec unsupported')
} else { } else {
video.play() elem.play()
} }
} }
} }