aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-08-31 17:58:42 -0700
committerJesús <heckyel@hyperbola.info>2021-08-31 20:16:17 -0500
commit12561c0ed350aa2c4720f2f0e5fce6f8cbea223f (patch)
treed78447aaf7255643de2f03960a9e32a79ec89544 /youtube
parent5bf4c284a5da4e7cc3bc76af2093cdc0e04f9d4e (diff)
downloadyt-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')
-rw-r--r--youtube/static/js/av-merge.js24
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']);
}
}