diff options
author | James Taylor <user234683@users.noreply.github.com> | 2021-08-31 17:58:42 -0700 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2021-08-31 20:16:17 -0500 |
commit | 12561c0ed350aa2c4720f2f0e5fce6f8cbea223f (patch) | |
tree | d78447aaf7255643de2f03960a9e32a79ec89544 /youtube/static/js | |
parent | 5bf4c284a5da4e7cc3bc76af2093cdc0e04f9d4e (diff) | |
download | yt-local-12561c0ed350aa2c4720f2f0e5fce6f8cbea223f.tar.lz yt-local-12561c0ed350aa2c4720f2f0e5fce6f8cbea223f.tar.xz yt-local-12561c0ed350aa2c4720f2f0e5fce6f8cbea223f.zip |
av-merge: Specify which of MediaSource, audio, or video are unsupported
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/static/js')
-rw-r--r-- | youtube/static/js/av-merge.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/youtube/static/js/av-merge.js b/youtube/static/js/av-merge.js index 8a1deb8..dfbf3c9 100644 --- a/youtube/static/js/av-merge.js +++ b/youtube/static/js/av-merge.js @@ -39,16 +39,26 @@ function AVMerge(video, srcPair, startTime){ this.setup(); } AVMerge.prototype.setup = function() { - if ('MediaSource' in window - && MediaSource.isTypeSupported(this.audioSource['mime_codec']) - && MediaSource.isTypeSupported(this.videoSource['mime_codec'])) { + if (!('MediaSource' in window)) { + reportError('MediaSource not supported.'); + return; + } + var audioSupported = MediaSource.isTypeSupported( + this.audioSource['mime_codec'] + ) + var videoSupported = MediaSource.isTypeSupported( + this.videoSource['mime_codec'] + ) + if (!audioSupported) + reportError('Unsupported MIME type or codec: ', + this.audioSource['mime_codec']); + if (!videoSupported) + reportError('Unsupported MIME type or codec: ', + this.videoSource['mime_codec']); + if (audioSupported && videoSupported) { this.mediaSource = new MediaSource(); this.video.src = URL.createObjectURL(this.mediaSource); this.mediaSource.onsourceopen = this.sourceOpen.bind(this); - } else { - reportError('Unsupported MIME type or codec: ', - this.audioSource['mime_codec'], - this.videoSource['mime_codec']); } } |