shaka-player 4.8.3 → 4.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/CONTRIBUTORS +1 -0
- package/dist/deps.js +2 -2
- package/dist/locales.js +34 -34
- package/dist/shaka-player.compiled.debug.js +351 -345
- package/dist/shaka-player.compiled.debug.map +3 -3
- package/dist/shaka-player.compiled.js +813 -811
- package/dist/shaka-player.compiled.map +3 -3
- package/dist/shaka-player.ui.debug.js +361 -355
- package/dist/shaka-player.ui.debug.map +3 -3
- package/dist/shaka-player.ui.js +864 -861
- package/dist/shaka-player.ui.map +3 -3
- package/externs/ima.js +2 -0
- package/lib/ads/client_side_ad_manager.js +5 -3
- package/lib/cea/cea_decoder.js +3 -0
- package/lib/hls/hls_parser.js +19 -10
- package/lib/media/closed_caption_parser.js +7 -1
- package/lib/media/media_source_engine.js +6 -9
- package/lib/media/segment_utils.js +1 -1
- package/lib/player.js +17 -1
- package/lib/polyfill/media_capabilities.js +150 -133
- package/lib/transmuxer/ts_transmuxer.js +6 -24
- package/lib/util/platform.js +46 -12
- package/lib/util/stream_utils.js +24 -11
- package/package.json +6 -1
package/lib/util/platform.js
CHANGED
|
@@ -197,6 +197,17 @@ shaka.util.Platform = class {
|
|
|
197
197
|
return Platform.isChromecast() && Platform.isAndroid();
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Check if the current platform is a Google Chromecast with Fuchsia
|
|
202
|
+
* (i.e. Google Nest Hub).
|
|
203
|
+
*
|
|
204
|
+
* @return {boolean}
|
|
205
|
+
*/
|
|
206
|
+
static isFuchsiaCastDevice() {
|
|
207
|
+
const Platform = shaka.util.Platform;
|
|
208
|
+
return Platform.isChromecast() && Platform.isFuchsia();
|
|
209
|
+
}
|
|
210
|
+
|
|
200
211
|
/**
|
|
201
212
|
* Returns a major version number for Chrome, or Chromium-based browsers.
|
|
202
213
|
*
|
|
@@ -459,6 +470,15 @@ shaka.util.Platform = class {
|
|
|
459
470
|
return shaka.util.Platform.userAgentContains_('Android');
|
|
460
471
|
}
|
|
461
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Return true if the platform is a Fuchsia, regardless of the browser.
|
|
475
|
+
*
|
|
476
|
+
* @return {boolean}
|
|
477
|
+
*/
|
|
478
|
+
static isFuchsia() {
|
|
479
|
+
return shaka.util.Platform.userAgentContains_('Fuchsia');
|
|
480
|
+
}
|
|
481
|
+
|
|
462
482
|
/**
|
|
463
483
|
* Return true if the platform is controlled by a remote control.
|
|
464
484
|
*
|
|
@@ -574,7 +594,8 @@ shaka.util.Platform = class {
|
|
|
574
594
|
return false;
|
|
575
595
|
}
|
|
576
596
|
// Older chromecasts without GoogleTV seem to not support SMOOTH properly.
|
|
577
|
-
if (Platform.isChromecast() && !Platform.isAndroidCastDevice()
|
|
597
|
+
if (Platform.isChromecast() && !Platform.isAndroidCastDevice() &&
|
|
598
|
+
!Platform.isFuchsiaCastDevice()) {
|
|
578
599
|
return false;
|
|
579
600
|
}
|
|
580
601
|
// See: https://chromium-review.googlesource.com/c/chromium/src/+/4577759
|
|
@@ -611,19 +632,32 @@ shaka.util.Platform = class {
|
|
|
611
632
|
|
|
612
633
|
if (Platform.isChromecast()) {
|
|
613
634
|
// In our tests, the original Chromecast seems to have trouble decoding
|
|
614
|
-
// above 1080p.
|
|
635
|
+
// above 1080p. It would be a waste to select a higher res anyway, given
|
|
615
636
|
// that the device only outputs 1080p to begin with.
|
|
616
637
|
// Chromecast has an extension to query the device/display's resolution.
|
|
617
|
-
|
|
618
|
-
cast.__platform__.canDisplayType
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
638
|
+
const hasCanDisplayType = window.cast && cast.__platform__ &&
|
|
639
|
+
cast.__platform__.canDisplayType;
|
|
640
|
+
|
|
641
|
+
// Some hub devices can only do 720p. Default to that.
|
|
642
|
+
maxResolution.width = 1280;
|
|
643
|
+
maxResolution.height = 720;
|
|
644
|
+
|
|
645
|
+
try {
|
|
646
|
+
if (hasCanDisplayType && await cast.__platform__.canDisplayType(
|
|
647
|
+
'video/mp4; codecs="avc1.640028"; width=3840; height=2160')) {
|
|
648
|
+
// The device and display can both do 4k. Assume a 4k limit.
|
|
649
|
+
maxResolution.width = 3840;
|
|
650
|
+
maxResolution.height = 2160;
|
|
651
|
+
} else if (hasCanDisplayType && await cast.__platform__.canDisplayType(
|
|
652
|
+
'video/mp4; codecs="avc1.640028"; width=1920; height=1080')) {
|
|
653
|
+
// Most Chromecasts can do 1080p.
|
|
654
|
+
maxResolution.width = 1920;
|
|
655
|
+
maxResolution.height = 1080;
|
|
656
|
+
}
|
|
657
|
+
} catch (error) {
|
|
658
|
+
// This shouldn't generally happen. Log the error.
|
|
659
|
+
shaka.log.alwaysError('Failed to check canDisplayType:', error);
|
|
660
|
+
// Now ignore the error and let the 720p default stand.
|
|
627
661
|
}
|
|
628
662
|
} else if (Platform.isTizen()) {
|
|
629
663
|
maxResolution.width = 1920;
|
package/lib/util/stream_utils.js
CHANGED
|
@@ -429,7 +429,8 @@ shaka.util.StreamUtils = class {
|
|
|
429
429
|
videoCodecs = StreamUtils.getCorrectVideoCodecs(videoCodecs);
|
|
430
430
|
let audioCodecs = ManifestParserUtils.guessCodecs(
|
|
431
431
|
ContentType.AUDIO, allCodecs);
|
|
432
|
-
audioCodecs = StreamUtils.getCorrectAudioCodecs(
|
|
432
|
+
audioCodecs = StreamUtils.getCorrectAudioCodecs(
|
|
433
|
+
audioCodecs, video.mimeType);
|
|
433
434
|
|
|
434
435
|
const audioFullType = MimeUtils.getFullOrConvertedType(
|
|
435
436
|
video.mimeType, audioCodecs, ContentType.AUDIO);
|
|
@@ -465,7 +466,8 @@ shaka.util.StreamUtils = class {
|
|
|
465
466
|
}
|
|
466
467
|
|
|
467
468
|
if (audio) {
|
|
468
|
-
const codecs = StreamUtils.getCorrectAudioCodecs(
|
|
469
|
+
const codecs = StreamUtils.getCorrectAudioCodecs(
|
|
470
|
+
audio.codecs, audio.mimeType);
|
|
469
471
|
const fullType = MimeUtils.getFullOrConvertedType(
|
|
470
472
|
audio.mimeType, codecs, ContentType.AUDIO);
|
|
471
473
|
|
|
@@ -754,17 +756,18 @@ shaka.util.StreamUtils = class {
|
|
|
754
756
|
// We ignore the multiplexed audio when there is normal audio also.
|
|
755
757
|
if (videoCodecs.includes(',') && !audio) {
|
|
756
758
|
const allCodecs = videoCodecs.split(',');
|
|
759
|
+
const baseMimeType = MimeUtils.getBasicType(fullMimeType);
|
|
757
760
|
|
|
758
761
|
videoCodecs = ManifestParserUtils.guessCodecs(
|
|
759
762
|
ContentType.VIDEO, allCodecs);
|
|
760
763
|
|
|
761
764
|
let audioCodecs = ManifestParserUtils.guessCodecs(
|
|
762
765
|
ContentType.AUDIO, allCodecs);
|
|
763
|
-
audioCodecs = StreamUtils.getCorrectAudioCodecs(
|
|
766
|
+
audioCodecs = StreamUtils.getCorrectAudioCodecs(
|
|
767
|
+
audioCodecs, baseMimeType);
|
|
764
768
|
|
|
765
769
|
const audioFullType = MimeUtils.getFullOrConvertedType(
|
|
766
|
-
|
|
767
|
-
ContentType.AUDIO);
|
|
770
|
+
baseMimeType, audioCodecs, ContentType.AUDIO);
|
|
768
771
|
|
|
769
772
|
audioConfigs.push({
|
|
770
773
|
contentType: audioFullType,
|
|
@@ -815,10 +818,11 @@ shaka.util.StreamUtils = class {
|
|
|
815
818
|
}
|
|
816
819
|
if (audio) {
|
|
817
820
|
for (const fullMimeType of audio.fullMimeTypes) {
|
|
818
|
-
const
|
|
819
|
-
|
|
821
|
+
const baseMimeType = MimeUtils.getBasicType(fullMimeType);
|
|
822
|
+
const codecs = StreamUtils.getCorrectAudioCodecs(
|
|
823
|
+
MimeUtils.getCodecs(fullMimeType), baseMimeType);
|
|
820
824
|
const fullType = MimeUtils.getFullOrConvertedType(
|
|
821
|
-
|
|
825
|
+
baseMimeType, codecs, ContentType.AUDIO);
|
|
822
826
|
|
|
823
827
|
// AudioConfiguration
|
|
824
828
|
audioConfigs.push({
|
|
@@ -975,9 +979,10 @@ shaka.util.StreamUtils = class {
|
|
|
975
979
|
* Generates the correct audio codec for MediaDecodingConfiguration and
|
|
976
980
|
* for MediaSource.isTypeSupported.
|
|
977
981
|
* @param {string} codecs
|
|
982
|
+
* @param {string} mimeType
|
|
978
983
|
* @return {string}
|
|
979
984
|
*/
|
|
980
|
-
static getCorrectAudioCodecs(codecs) {
|
|
985
|
+
static getCorrectAudioCodecs(codecs, mimeType) {
|
|
981
986
|
// According to RFC 6381 section 3.3, 'fLaC' is actually the correct
|
|
982
987
|
// codec string. We still need to map it to 'flac', as some browsers
|
|
983
988
|
// currently don't support 'fLaC', while 'flac' is supported by most
|
|
@@ -992,8 +997,16 @@ shaka.util.StreamUtils = class {
|
|
|
992
997
|
}
|
|
993
998
|
|
|
994
999
|
// The same is true for 'Opus'.
|
|
995
|
-
if (codecs === '
|
|
996
|
-
|
|
1000
|
+
if (codecs.toLowerCase() === 'opus') {
|
|
1001
|
+
if (!shaka.util.Platform.isSafari()) {
|
|
1002
|
+
return 'opus';
|
|
1003
|
+
} else {
|
|
1004
|
+
if (shaka.util.MimeUtils.getContainerType(mimeType) == 'mp4') {
|
|
1005
|
+
return 'Opus';
|
|
1006
|
+
} else {
|
|
1007
|
+
return 'opus';
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
997
1010
|
}
|
|
998
1011
|
|
|
999
1012
|
return codecs;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shaka-player",
|
|
3
3
|
"description": "DASH/EME video player library",
|
|
4
|
-
"version": "4.8.
|
|
4
|
+
"version": "4.8.5",
|
|
5
5
|
"homepage": "https://github.com/shaka-project/shaka-player",
|
|
6
6
|
"author": "Google",
|
|
7
7
|
"maintainers": [
|
|
@@ -63,6 +63,11 @@
|
|
|
63
63
|
"tippy.js": "^4.3.5",
|
|
64
64
|
"which": "^2.0.2"
|
|
65
65
|
},
|
|
66
|
+
"overrides": {
|
|
67
|
+
"karma": {
|
|
68
|
+
"ua-parser-js": "github:joeyparrish/ua-parser-js#preview"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
66
71
|
"shakaCustom": {
|
|
67
72
|
"purposeOfDemoDeps": "These are the files from node_modules that need to be deployed with the demo app.",
|
|
68
73
|
"demoDeps": [
|