shaka-player 4.4.3 → 4.5.0
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/.github/workflows/release-please.yaml +2 -27
- package/CHANGELOG.md +64 -45
- package/README.md +16 -10
- package/demo/asset_card.js +18 -21
- package/demo/cast_receiver/index.html +0 -1
- package/demo/close_button.js +0 -3
- package/demo/common/asset.js +22 -5
- package/demo/common/assets.js +132 -49
- package/demo/config.js +192 -253
- package/demo/custom.js +39 -98
- package/demo/front.js +7 -10
- package/demo/index.html +19 -22
- package/demo/input.js +6 -11
- package/demo/input_container.js +8 -9
- package/demo/main.js +51 -123
- package/demo/search.js +22 -34
- package/demo/service_worker.js +0 -3
- package/demo/tooltip.js +3 -5
- package/demo/visualizer.js +3 -5
- package/demo/visualizer_button.js +1 -20
- package/dist/demo.compiled.debug.js +152 -178
- package/dist/demo.compiled.debug.map +4 -4
- package/dist/demo.compiled.js +152 -178
- package/dist/demo.compiled.map +4 -4
- package/dist/deps.js +27 -24
- package/dist/locales.js +31 -31
- package/dist/receiver.compiled.debug.js +22 -43
- package/dist/receiver.compiled.debug.map +4 -4
- package/dist/receiver.compiled.js +22 -43
- package/dist/receiver.compiled.map +4 -4
- package/dist/shaka-player.compiled.d.ts +507 -365
- package/dist/shaka-player.compiled.debug.d.ts +507 -365
- package/dist/shaka-player.compiled.debug.externs.js +205 -51
- package/dist/shaka-player.compiled.debug.js +541 -450
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +205 -51
- package/dist/shaka-player.compiled.js +1120 -1066
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +562 -410
- package/dist/shaka-player.ui.debug.d.ts +562 -410
- package/dist/shaka-player.ui.debug.externs.js +226 -51
- package/dist/shaka-player.ui.debug.js +606 -506
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +226 -51
- package/dist/shaka-player.ui.js +1266 -1207
- package/dist/shaka-player.ui.map +4 -4
- package/docs/design/lcevc-integration.md +14 -14
- package/docs/tutorials/faq.md +27 -55
- package/docs/tutorials/index.json +2 -1
- package/docs/tutorials/lcevc.md +118 -0
- package/docs/tutorials/ui-customization.md +4 -0
- package/externs/css_style_declaration.js +19 -0
- package/externs/lcevc.js +37 -13
- package/externs/media_remote.js +68 -0
- package/externs/mediatailor.js +193 -0
- package/externs/pictureinpicture.js +11 -0
- package/externs/shaka/ads.js +27 -0
- package/externs/shaka/manifest.js +10 -5
- package/externs/shaka/manifest_parser.js +7 -1
- package/externs/shaka/offline.js +4 -0
- package/externs/shaka/player.js +12 -1
- package/karma.conf.js +7 -3
- package/lib/abr/simple_abr_manager.js +43 -3
- package/lib/ads/ad_manager.js +104 -50
- package/lib/ads/media_tailor_ad.js +297 -0
- package/lib/ads/media_tailor_ad_manager.js +828 -0
- package/lib/cea/ts_cea_parser.js +15 -2
- package/lib/config/codec_switching_strategy.js +24 -0
- package/lib/dash/content_protection.js +120 -2
- package/lib/dash/dash_parser.js +75 -12
- package/lib/dash/mpd_utils.js +10 -6
- package/lib/dash/segment_base.js +13 -5
- package/lib/dash/segment_list.js +13 -5
- package/lib/dash/segment_template.js +43 -85
- package/lib/dependencies/all.js +8 -7
- package/lib/hls/hls_parser.js +44 -16
- package/lib/lcevc/lcevc_dec.js +220 -0
- package/lib/media/adaptation_set.js +22 -11
- package/lib/media/adaptation_set_criteria.js +25 -7
- package/lib/media/media_source_engine.js +215 -27
- package/lib/media/segment_index.js +1 -1
- package/lib/media/segment_reference.js +7 -7
- package/lib/media/streaming_engine.js +33 -18
- package/lib/mss/mss_parser.js +1 -0
- package/lib/net/networking_engine.js +1 -0
- package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
- package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
- package/lib/offline/manifest_converter.js +1 -0
- package/lib/offline/storage.js +3 -0
- package/lib/player.js +142 -72
- package/lib/routing/payload.js +5 -1
- package/lib/text/cue.js +15 -0
- package/lib/text/ttml_text_parser.js +17 -0
- package/lib/text/ui_text_displayer.js +4 -0
- package/lib/text/vtt_text_parser.js +33 -20
- package/lib/transmuxer/h265.js +862 -0
- package/lib/transmuxer/mpeg_ts_transmuxer.js +3 -2
- package/lib/transmuxer/ts_transmuxer.js +160 -15
- package/lib/util/error.js +28 -9
- package/lib/util/exp_golomb.js +30 -2
- package/lib/util/fake_event.js +3 -0
- package/lib/util/mp4_generator.js +4 -4
- package/lib/util/periods.js +2 -0
- package/lib/util/platform.js +40 -0
- package/lib/util/player_configuration.js +8 -0
- package/lib/util/state_history.js +6 -2
- package/lib/util/stream_utils.js +133 -217
- package/lib/util/ts_parser.js +226 -40
- package/maintained-branches.md +3 -2
- package/package.json +4 -6
- package/roadmap.md +15 -5
- package/shaka-player.uncompiled.js +2 -1
- package/support.html +0 -1
- package/test/cast/cast_receiver_integration.js +47 -0
- package/test/codec_switching/codec_switching_integration.js +181 -0
- package/test/dash/dash_parser_content_protection_unit.js +2 -0
- package/test/dash/dash_parser_integration.js +73 -0
- package/test/dash/dash_parser_live_unit.js +2 -0
- package/test/dash/dash_parser_manifest_unit.js +42 -0
- package/test/dash/dash_parser_segment_base_unit.js +2 -0
- package/test/dash/dash_parser_segment_list_unit.js +2 -0
- package/test/dash/dash_parser_segment_template_unit.js +2 -0
- package/test/demo/demo_unit.js +0 -16
- package/test/hls/hls_live_unit.js +2 -0
- package/test/hls/hls_parser_unit.js +8 -6
- package/test/media/adaptation_set_criteria_unit.js +118 -0
- package/test/media/adaptation_set_unit.js +1 -0
- package/test/media/media_source_engine_unit.js +165 -1
- package/test/media/segment_index_unit.js +4 -4
- package/test/media/segment_prefetch_unit.js +1 -1
- package/test/media/streaming_engine_unit.js +17 -17
- package/test/mss/mss_parser_unit.js +2 -0
- package/test/offline/manifest_convert_unit.js +5 -0
- package/test/offline/storage_integration.js +1 -4
- package/test/player_unit.js +102 -131
- package/test/routing/walker_unit.js +1 -0
- package/test/test/assets/dash-aes-128/Fragments(video=0,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=20000000,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=40000000,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=60000000,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/Fragments(video=i,format=mpd-time-csf) +0 -0
- package/test/test/assets/dash-aes-128/dash.mpd +18 -0
- package/test/test/assets/dash-aes-128/license +1 -0
- package/test/test/assets/dash-multi-codec/audio_en_2c_128k_aac.mp4 +0 -0
- package/test/test/assets/dash-multi-codec/audio_es_2c_64k_opus.webm +0 -0
- package/test/test/assets/dash-multi-codec/dash.mpd +32 -0
- package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
- package/test/test/assets/hls-ts-h265/0.ts +0 -0
- package/test/test/assets/hls-ts-h265/hevc.m3u8 +6 -0
- package/test/test/assets/hls-ts-h265/index.m3u8 +7 -0
- package/test/test/assets/hls-ts-muxed-aac-h265/0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h265/1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +9 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +24 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00000.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00001.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00002.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00003.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00004.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ac3-h264/s_00005.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-muxed-ec3-h264/prog_index.m3u8 +14 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +23 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-1-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-2-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-3-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-4-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-5-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-6-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-7-v1-a1.ts +0 -0
- package/test/test/assets/hls-ts-muxed-mp3-h264/seg-8-v1-a1.ts +0 -0
- package/test/test/util/dash_parser_util.js +4 -0
- package/test/test/util/fake_ad_manager.js +20 -0
- package/test/test/util/fake_media_source_engine.js +8 -2
- package/test/test/util/manifest_generator.js +7 -3
- package/test/test/util/mss_parser_util.js +4 -0
- package/test/test/util/offline_utils.js +1 -0
- package/test/test/util/streaming_engine_util.js +7 -4
- package/test/text/ttml_text_parser_unit.js +52 -0
- package/test/text/vtt_text_parser_unit.js +103 -31
- package/test/transmuxer/transmuxer_integration.js +117 -0
- package/test/ui/ui_unit.js +3 -10
- package/test/util/stream_utils_unit.js +208 -74
- package/ui/controls.js +125 -0
- package/ui/externs/ui.js +8 -1
- package/ui/pip_button.js +22 -120
- package/ui/remote_button.js +201 -0
- package/ui/ui.js +5 -2
- package/demo/common/message_ids.js +0 -309
- package/demo/locales/en.json +0 -288
- package/demo/locales/source.json +0 -1146
- package/externs/mux.js +0 -69
- package/lib/lcevc/lcevc_dil.js +0 -152
- package/lib/transmuxer/muxjs_transmuxer.js +0 -242
- package/test/transmuxer/muxjs_transmuxer_integration.js +0 -177
package/lib/player.js
CHANGED
|
@@ -56,7 +56,7 @@ goog.require('shaka.util.PublicPromise');
|
|
|
56
56
|
goog.require('shaka.util.Stats');
|
|
57
57
|
goog.require('shaka.util.StreamUtils');
|
|
58
58
|
goog.require('shaka.util.Timer');
|
|
59
|
-
goog.require('shaka.lcevc.
|
|
59
|
+
goog.require('shaka.lcevc.Dec');
|
|
60
60
|
goog.requireType('shaka.media.PresentationTimeline');
|
|
61
61
|
goog.requireType('shaka.routing.Node');
|
|
62
62
|
goog.requireType('shaka.routing.Payload');
|
|
@@ -314,6 +314,18 @@ goog.requireType('shaka.routing.Payload');
|
|
|
314
314
|
*/
|
|
315
315
|
|
|
316
316
|
|
|
317
|
+
/**
|
|
318
|
+
* @event shaka.Player.ManifestUpdatedEvent
|
|
319
|
+
* @description Fired after the manifest has been updated (live streams).
|
|
320
|
+
* @property {string} type
|
|
321
|
+
* 'manifestupdated'
|
|
322
|
+
* @property {boolean} isLive
|
|
323
|
+
* True when the playlist is live. Useful to detect transition from live
|
|
324
|
+
* to static playlist..
|
|
325
|
+
* @exportDoc
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
|
|
317
329
|
/**
|
|
318
330
|
* @event shaka.Player.MetadataEvent
|
|
319
331
|
* @description Triggers after metadata associated with the stream is found.
|
|
@@ -423,6 +435,26 @@ goog.requireType('shaka.routing.Payload');
|
|
|
423
435
|
*/
|
|
424
436
|
|
|
425
437
|
|
|
438
|
+
/**
|
|
439
|
+
* @event shaka.Player.KeyStatusChanged
|
|
440
|
+
* @description Fired when the key status changed.
|
|
441
|
+
* @property {string} type
|
|
442
|
+
* 'keystatuschanged'
|
|
443
|
+
* @exportDoc
|
|
444
|
+
*/
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* @event shaka.Player.StateChanged
|
|
449
|
+
* @description Fired when player state is changed.
|
|
450
|
+
* @property {string} type
|
|
451
|
+
* 'statechanged'
|
|
452
|
+
* @property {string} newstate
|
|
453
|
+
* The new state.
|
|
454
|
+
* @exportDoc
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
|
|
426
458
|
/**
|
|
427
459
|
* @summary The main player object for Shaka Player.
|
|
428
460
|
*
|
|
@@ -528,9 +560,9 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
528
560
|
/** @private {?HTMLCanvasElement} */
|
|
529
561
|
this.lcevcCanvas_ = null;
|
|
530
562
|
|
|
531
|
-
// This is the LCEVC
|
|
532
|
-
/** @private {?shaka.lcevc.
|
|
533
|
-
this.
|
|
563
|
+
// This is the LCEVC Decoder object to decode LCEVC.
|
|
564
|
+
/** @private {?shaka.lcevc.Dec} */
|
|
565
|
+
this.lcevcDec_ = null;
|
|
534
566
|
|
|
535
567
|
/** @private {shaka.media.QualityObserver} */
|
|
536
568
|
this.qualityObserver_ = null;
|
|
@@ -591,7 +623,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
591
623
|
this.config_.preferredAudioLanguage,
|
|
592
624
|
this.config_.preferredVariantRole,
|
|
593
625
|
this.config_.preferredAudioChannelCount,
|
|
594
|
-
this.config_.preferredVideoHdrLevel
|
|
626
|
+
this.config_.preferredVideoHdrLevel,
|
|
627
|
+
this.config_.mediaSource.codecSwitchingStrategy);
|
|
595
628
|
|
|
596
629
|
/** @private {string} */
|
|
597
630
|
this.currentTextLanguage_ = this.config_.preferredTextLanguage;
|
|
@@ -763,36 +796,37 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
763
796
|
}
|
|
764
797
|
|
|
765
798
|
/**
|
|
766
|
-
* Create a shaka.lcevc.
|
|
799
|
+
* Create a shaka.lcevc.Dec object
|
|
767
800
|
* @param {shaka.extern.LcevcConfiguration} config
|
|
768
801
|
* @private
|
|
769
802
|
*/
|
|
770
|
-
|
|
771
|
-
if (this.
|
|
772
|
-
this.
|
|
803
|
+
createLcevcDec_(config) {
|
|
804
|
+
if (this.lcevcDec_ == null) {
|
|
805
|
+
this.lcevcDec_ = new shaka.lcevc.Dec(
|
|
773
806
|
/** @type {HTMLVideoElement} */ (this.video_),
|
|
774
807
|
this.lcevcCanvas_,
|
|
775
808
|
config,
|
|
776
809
|
);
|
|
777
810
|
if (this.mediaSourceEngine_) {
|
|
778
|
-
this.mediaSourceEngine_.
|
|
811
|
+
this.mediaSourceEngine_.updateLcevcDec(this.lcevcDec_);
|
|
779
812
|
}
|
|
780
813
|
}
|
|
781
814
|
}
|
|
782
815
|
|
|
783
816
|
/**
|
|
784
|
-
* Close a shaka.lcevc.
|
|
817
|
+
* Close a shaka.lcevc.Dec object if present and hide the canvas.
|
|
785
818
|
* @private
|
|
786
819
|
*/
|
|
787
|
-
|
|
788
|
-
if (this.
|
|
789
|
-
this.
|
|
790
|
-
this.
|
|
820
|
+
closeLcevcDec_() {
|
|
821
|
+
if (this.lcevcDec_ != null) {
|
|
822
|
+
this.lcevcDec_.hideCanvas();
|
|
823
|
+
this.lcevcDec_.release();
|
|
824
|
+
this.lcevcDec_ = null;
|
|
791
825
|
}
|
|
792
826
|
}
|
|
793
827
|
|
|
794
828
|
/**
|
|
795
|
-
* Setup shaka.lcevc.
|
|
829
|
+
* Setup shaka.lcevc.Dec object
|
|
796
830
|
* @param {?shaka.extern.PlayerConfiguration} config
|
|
797
831
|
* @private
|
|
798
832
|
*/
|
|
@@ -815,10 +849,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
815
849
|
}
|
|
816
850
|
}
|
|
817
851
|
}
|
|
818
|
-
this.
|
|
819
|
-
this.
|
|
852
|
+
this.closeLcevcDec_();
|
|
853
|
+
this.createLcevcDec_(config.lcevc);
|
|
820
854
|
} else {
|
|
821
|
-
this.
|
|
855
|
+
this.closeLcevcDec_();
|
|
822
856
|
}
|
|
823
857
|
}
|
|
824
858
|
|
|
@@ -844,20 +878,23 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
844
878
|
return;
|
|
845
879
|
}
|
|
846
880
|
|
|
847
|
-
// If LCEVC
|
|
848
|
-
this.
|
|
881
|
+
// If LCEVC Decoder exists close it.
|
|
882
|
+
this.closeLcevcDec_();
|
|
849
883
|
|
|
850
884
|
// Mark as "dead". This should stop external-facing calls from changing our
|
|
851
885
|
// internal state any more. This will stop calls to |attach|, |detach|, etc.
|
|
852
886
|
// from interrupting our final move to the detached state.
|
|
853
887
|
this.loadMode_ = shaka.Player.LoadMode.DESTROYED;
|
|
854
888
|
|
|
889
|
+
const payload = shaka.Player.createEmptyPayload_();
|
|
890
|
+
payload.keepAdManager = false;
|
|
891
|
+
|
|
855
892
|
// Because we have set |loadMode_| to |DESTROYED| we can't call |detach|. We
|
|
856
893
|
// must talk to |this.walker_| directly.
|
|
857
894
|
const events = this.walker_.startNewRoute((currentPayload) => {
|
|
858
895
|
return {
|
|
859
896
|
node: this.detachNode_,
|
|
860
|
-
payload:
|
|
897
|
+
payload: payload,
|
|
861
898
|
interruptible: false,
|
|
862
899
|
};
|
|
863
900
|
});
|
|
@@ -1156,10 +1193,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1156
1193
|
* <code>detach</code>, or <code>unload</code>.
|
|
1157
1194
|
*
|
|
1158
1195
|
* @param {boolean=} initializeMediaSource
|
|
1196
|
+
* @param {boolean=} keepAdManager
|
|
1159
1197
|
* @return {!Promise}
|
|
1160
1198
|
* @export
|
|
1161
1199
|
*/
|
|
1162
|
-
unload(initializeMediaSource = true) {
|
|
1200
|
+
unload(initializeMediaSource = true, keepAdManager = false) {
|
|
1163
1201
|
// Do not allow the player to be used after |destroy| is called.
|
|
1164
1202
|
if (this.loadMode_ == shaka.Player.LoadMode.DESTROYED) {
|
|
1165
1203
|
return Promise.reject(this.createAbortLoadError_());
|
|
@@ -1173,8 +1211,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1173
1211
|
initializeMediaSource = false;
|
|
1174
1212
|
}
|
|
1175
1213
|
|
|
1176
|
-
// If LCEVC
|
|
1177
|
-
this.
|
|
1214
|
+
// If LCEVC Decoder exists close it.
|
|
1215
|
+
this.closeLcevcDec_();
|
|
1178
1216
|
|
|
1179
1217
|
// Since we are going either to attached or detached (through unloaded), we
|
|
1180
1218
|
// can't allow it to be interrupted or else we could lose track of what
|
|
@@ -1184,6 +1222,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1184
1222
|
// If we have a media element, we want to go back to attached. If we have no
|
|
1185
1223
|
// media element, we want to go back to detached.
|
|
1186
1224
|
const payload = shaka.Player.createEmptyPayload_();
|
|
1225
|
+
payload.keepAdManager = keepAdManager;
|
|
1187
1226
|
|
|
1188
1227
|
const events = this.walker_.startNewRoute((currentPayload) => {
|
|
1189
1228
|
// When someone calls |unload| we can either be before attached or
|
|
@@ -1496,7 +1535,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1496
1535
|
has.mediaElement = null;
|
|
1497
1536
|
}
|
|
1498
1537
|
|
|
1499
|
-
if (this.adManager_) {
|
|
1538
|
+
if (this.adManager_ && !wants.keepAdManager) {
|
|
1500
1539
|
// The ad manager is specific to the video, so detach it too.
|
|
1501
1540
|
this.adManager_.release();
|
|
1502
1541
|
}
|
|
@@ -1618,7 +1657,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1618
1657
|
this.mediaSourceEngine_ = null;
|
|
1619
1658
|
}
|
|
1620
1659
|
|
|
1621
|
-
if (this.adManager_) {
|
|
1660
|
+
if (this.adManager_ && !wants.keepAdManager) {
|
|
1622
1661
|
this.adManager_.onAssetUnload();
|
|
1623
1662
|
}
|
|
1624
1663
|
|
|
@@ -1719,7 +1758,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1719
1758
|
(metadata, offset, endTime) => {
|
|
1720
1759
|
this.processTimedMetadataMediaSrc_(metadata, offset, endTime);
|
|
1721
1760
|
},
|
|
1722
|
-
this.
|
|
1761
|
+
this.lcevcDec_);
|
|
1723
1762
|
mediaSourceEngine.configure(this.config_.mediaSource);
|
|
1724
1763
|
const {segmentRelativeVttTiming} = this.config_.manifest;
|
|
1725
1764
|
mediaSourceEngine.setSegmentRelativeVttTiming(segmentRelativeVttTiming);
|
|
@@ -1904,6 +1943,15 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
1904
1943
|
this.processDrmInfos_(currentDrmInfo.keySystem, stream);
|
|
1905
1944
|
}
|
|
1906
1945
|
},
|
|
1946
|
+
onManifestUpdated: () => {
|
|
1947
|
+
const eventName = shaka.util.FakeEvent.EventName.ManifestUpdated;
|
|
1948
|
+
const data = (new Map()).set('isLive', this.isLive());
|
|
1949
|
+
this.dispatchEvent(this.makeEvent_(eventName, data));
|
|
1950
|
+
if (this.adManager_) {
|
|
1951
|
+
this.adManager_.onManifestUpdated(this.isLive());
|
|
1952
|
+
}
|
|
1953
|
+
},
|
|
1954
|
+
getBandwidthEstimate: () => this.abrManager_.getBandwidthEstimate(),
|
|
1907
1955
|
};
|
|
1908
1956
|
|
|
1909
1957
|
const startTime = Date.now() / 1000;
|
|
@@ -2000,8 +2048,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2000
2048
|
// the enhancement. In DRM contexts where the browser CDM restricts
|
|
2001
2049
|
// access from our decoder, the enhancement cannot be applied and
|
|
2002
2050
|
// therefore the LCEVC output canvas is hidden accordingly.
|
|
2003
|
-
if (this.
|
|
2004
|
-
this.
|
|
2051
|
+
if (this.lcevcDec_) {
|
|
2052
|
+
this.lcevcDec_.hideCanvas();
|
|
2005
2053
|
}
|
|
2006
2054
|
}
|
|
2007
2055
|
},
|
|
@@ -2087,7 +2135,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2087
2135
|
this.loadEventManager_.listen(mediaElement, 'ended', updateStateHistory);
|
|
2088
2136
|
this.loadEventManager_.listen(mediaElement, 'ratechange', onRateChange);
|
|
2089
2137
|
|
|
2090
|
-
// Check status of the LCEVC
|
|
2138
|
+
// Check status of the LCEVC Dec Object and reset or
|
|
2091
2139
|
// create or close based on config
|
|
2092
2140
|
this.setupLcevc_(this.config_);
|
|
2093
2141
|
|
|
@@ -2112,7 +2160,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2112
2160
|
this.config_.preferredVariantRole,
|
|
2113
2161
|
this.config_.preferredAudioChannelCount,
|
|
2114
2162
|
this.config_.preferredVideoHdrLevel,
|
|
2115
|
-
this.config_.preferredAudioLabel
|
|
2163
|
+
this.config_.preferredAudioLabel,
|
|
2164
|
+
this.config_.mediaSource.codecSwitchingStrategy);
|
|
2116
2165
|
|
|
2117
2166
|
this.currentTextLanguage_ = this.config_.preferredTextLanguage;
|
|
2118
2167
|
this.currentTextRole_ = this.config_.preferredTextRole;
|
|
@@ -2260,8 +2309,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2260
2309
|
this.onAbrStatusChanged_();
|
|
2261
2310
|
}
|
|
2262
2311
|
|
|
2263
|
-
// Re-filter the manifest after streams have been chosen.
|
|
2264
|
-
this.filterManifestByCurrentVariant_();
|
|
2265
2312
|
// Dispatch a 'trackschanged' event now that all initial filtering is done.
|
|
2266
2313
|
this.onTracksChanged_();
|
|
2267
2314
|
|
|
@@ -2280,12 +2327,18 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2280
2327
|
'arbitrary language initially');
|
|
2281
2328
|
}
|
|
2282
2329
|
|
|
2283
|
-
|
|
2330
|
+
const isLive = this.isLive();
|
|
2331
|
+
|
|
2332
|
+
if (isLive && (this.config_.streaming.liveSync ||
|
|
2284
2333
|
this.manifest_.serviceDescription)) {
|
|
2285
2334
|
const onTimeUpdate = () => this.onTimeUpdate_();
|
|
2286
2335
|
this.loadEventManager_.listen(mediaElement, 'timeupdate', onTimeUpdate);
|
|
2287
2336
|
}
|
|
2288
2337
|
|
|
2338
|
+
if (this.adManager_) {
|
|
2339
|
+
this.adManager_.onManifestUpdated(isLive);
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2289
2342
|
this.fullyLoaded_ = true;
|
|
2290
2343
|
|
|
2291
2344
|
// Wait for the 'loadedmetadata' event to measure load() latency.
|
|
@@ -2374,6 +2427,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2374
2427
|
video: {
|
|
2375
2428
|
id: 0,
|
|
2376
2429
|
originalId: null,
|
|
2430
|
+
groupId: null,
|
|
2377
2431
|
createSegmentIndex: () => Promise.resolve(),
|
|
2378
2432
|
segmentIndex: null,
|
|
2379
2433
|
mimeType: wants.mimeType ?
|
|
@@ -2645,6 +2699,23 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
2645
2699
|
this.loadEventManager_.listen(mediaElement, 'timeupdate', onTimeUpdate);
|
|
2646
2700
|
}
|
|
2647
2701
|
|
|
2702
|
+
if (this.adManager_) {
|
|
2703
|
+
const isLive = this.isLive();
|
|
2704
|
+
this.adManager_.onManifestUpdated(isLive);
|
|
2705
|
+
// There is no good way to detect when the manifest has been updated,
|
|
2706
|
+
// so we use seekRange().end so we can tell when it has been updated.
|
|
2707
|
+
if (isLive) {
|
|
2708
|
+
let prevSeekRangeEnd = this.seekRange().end;
|
|
2709
|
+
this.loadEventManager_.listen(mediaElement, 'progress', () => {
|
|
2710
|
+
const newSeekRangeEnd = this.seekRange().end;
|
|
2711
|
+
if (prevSeekRangeEnd != newSeekRangeEnd) {
|
|
2712
|
+
this.adManager_.onManifestUpdated(this.isLive());
|
|
2713
|
+
prevSeekRangeEnd = newSeekRangeEnd;
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2648
2719
|
this.fullyLoaded_ = true;
|
|
2649
2720
|
});
|
|
2650
2721
|
}
|
|
@@ -3077,16 +3148,16 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
3077
3148
|
* @param {!shaka.extern.TextDisplayer} textDisplayer
|
|
3078
3149
|
* @param {!function(!Array.<shaka.extern.ID3Metadata>, number, ?number)}
|
|
3079
3150
|
* onMetadata
|
|
3080
|
-
* @param {shaka.lcevc.
|
|
3151
|
+
* @param {shaka.lcevc.Dec} lcevcDec
|
|
3081
3152
|
*
|
|
3082
3153
|
* @return {!shaka.media.MediaSourceEngine}
|
|
3083
3154
|
*/
|
|
3084
|
-
createMediaSourceEngine(mediaElement, textDisplayer, onMetadata,
|
|
3155
|
+
createMediaSourceEngine(mediaElement, textDisplayer, onMetadata, lcevcDec) {
|
|
3085
3156
|
return new shaka.media.MediaSourceEngine(
|
|
3086
3157
|
mediaElement,
|
|
3087
3158
|
textDisplayer,
|
|
3088
3159
|
onMetadata,
|
|
3089
|
-
|
|
3160
|
+
lcevcDec);
|
|
3090
3161
|
}
|
|
3091
3162
|
|
|
3092
3163
|
/**
|
|
@@ -4185,7 +4256,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4185
4256
|
if (this.manifest_ && this.playhead_) {
|
|
4186
4257
|
this.currentAdaptationSetCriteria_ =
|
|
4187
4258
|
new shaka.media.PreferenceBasedCriteria(language, role || '',
|
|
4188
|
-
channelsCount, /* hdrLevel= */ '', /* label= */ ''
|
|
4259
|
+
channelsCount, /* hdrLevel= */ '', /* label= */ '',
|
|
4260
|
+
this.config_.mediaSource.codecSwitchingStrategy);
|
|
4189
4261
|
|
|
4190
4262
|
const diff = (a, b) => {
|
|
4191
4263
|
if (!a.video && !b.video) {
|
|
@@ -4302,7 +4374,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4302
4374
|
// label have the same language.
|
|
4303
4375
|
this.currentAdaptationSetCriteria_ =
|
|
4304
4376
|
new shaka.media.PreferenceBasedCriteria(
|
|
4305
|
-
firstVariantWithLabel.language, '', 0, '', label
|
|
4377
|
+
firstVariantWithLabel.language, '', 0, '', label,
|
|
4378
|
+
this.config_.mediaSource.codecSwitchingStrategy);
|
|
4306
4379
|
|
|
4307
4380
|
this.chooseVariantAndSwitch_(clearBuffer, safeMargin);
|
|
4308
4381
|
} else if (this.video_ && this.video_.audioTracks) {
|
|
@@ -4759,9 +4832,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4759
4832
|
|
|
4760
4833
|
let adCuePoints = [];
|
|
4761
4834
|
if (this.adManager_) {
|
|
4762
|
-
|
|
4763
|
-
adCuePoints = this.adManager_.getServerSideCuePoints();
|
|
4764
|
-
} catch (error) {}
|
|
4835
|
+
adCuePoints = this.adManager_.getCuePoints();
|
|
4765
4836
|
}
|
|
4766
4837
|
|
|
4767
4838
|
if (this.loadMode_ == shaka.Player.LoadMode.SRC_EQUALS) {
|
|
@@ -4816,6 +4887,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4816
4887
|
const stream = {
|
|
4817
4888
|
id: this.nextExternalStreamId_++,
|
|
4818
4889
|
originalId: null,
|
|
4890
|
+
groupId: null,
|
|
4819
4891
|
createSegmentIndex: () => Promise.resolve(),
|
|
4820
4892
|
segmentIndex: shaka.media.SegmentIndex.forSingleSegment(
|
|
4821
4893
|
/* startTime= */ 0,
|
|
@@ -4972,6 +5044,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
4972
5044
|
const stream = {
|
|
4973
5045
|
id: this.nextExternalStreamId_++,
|
|
4974
5046
|
originalId: null,
|
|
5047
|
+
groupId: null,
|
|
4975
5048
|
createSegmentIndex: () => Promise.resolve(),
|
|
4976
5049
|
segmentIndex: new shaka.media.SegmentIndex(references),
|
|
4977
5050
|
mimeType: mimeType || '',
|
|
@@ -5033,9 +5106,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5033
5106
|
|
|
5034
5107
|
let adCuePoints = [];
|
|
5035
5108
|
if (this.adManager_) {
|
|
5036
|
-
|
|
5037
|
-
adCuePoints = this.adManager_.getServerSideCuePoints();
|
|
5038
|
-
} catch (error) {}
|
|
5109
|
+
adCuePoints = this.adManager_.getCuePoints();
|
|
5039
5110
|
}
|
|
5040
5111
|
|
|
5041
5112
|
/** @type {!HTMLTrackElement} */
|
|
@@ -5396,6 +5467,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5396
5467
|
const textStream = {
|
|
5397
5468
|
id: this.nextExternalStreamId_++, // A globally unique ID.
|
|
5398
5469
|
originalId: id, // The CC ID string, like 'CC1', 'CC3', etc.
|
|
5470
|
+
groupId: null,
|
|
5399
5471
|
createSegmentIndex: () => Promise.resolve(),
|
|
5400
5472
|
segmentIndex,
|
|
5401
5473
|
mimeType,
|
|
@@ -5454,7 +5526,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5454
5526
|
this.streamingEngine_.getCurrentVariant() : null;
|
|
5455
5527
|
|
|
5456
5528
|
await shaka.util.StreamUtils.filterManifest(
|
|
5457
|
-
this.drmEngine_, currentVariant, manifest
|
|
5529
|
+
this.drmEngine_, currentVariant, manifest,
|
|
5530
|
+
this.config_.mediaSource.codecSwitchingStrategy);
|
|
5458
5531
|
this.checkPlayableVariants_(manifest);
|
|
5459
5532
|
}
|
|
5460
5533
|
|
|
@@ -5511,21 +5584,6 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5511
5584
|
}
|
|
5512
5585
|
}
|
|
5513
5586
|
|
|
5514
|
-
/**
|
|
5515
|
-
* @private
|
|
5516
|
-
*/
|
|
5517
|
-
filterManifestByCurrentVariant_() {
|
|
5518
|
-
goog.asserts.assert(this.manifest_, 'Manifest should be valid');
|
|
5519
|
-
goog.asserts.assert(this.streamingEngine_,
|
|
5520
|
-
'StreamingEngine should be valid');
|
|
5521
|
-
|
|
5522
|
-
const currentVariant = this.streamingEngine_ ?
|
|
5523
|
-
this.streamingEngine_.getCurrentVariant() : null;
|
|
5524
|
-
shaka.util.StreamUtils.filterManifestByCurrentVariant(currentVariant,
|
|
5525
|
-
this.manifest_);
|
|
5526
|
-
this.checkPlayableVariants_(this.manifest_);
|
|
5527
|
-
}
|
|
5528
|
-
|
|
5529
5587
|
/**
|
|
5530
5588
|
* @param {shaka.extern.Variant} initialVariant
|
|
5531
5589
|
* @param {number} time
|
|
@@ -5661,14 +5719,20 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
5661
5719
|
|
|
5662
5720
|
const history = this.stats_.getStateHistory();
|
|
5663
5721
|
|
|
5722
|
+
let updateState = 'playing';
|
|
5664
5723
|
if (this.bufferObserver_.getState() == State.STARVING) {
|
|
5665
|
-
|
|
5724
|
+
updateState = 'buffering';
|
|
5666
5725
|
} else if (this.video_.paused) {
|
|
5667
|
-
|
|
5726
|
+
updateState = 'paused';
|
|
5668
5727
|
} else if (this.video_.ended) {
|
|
5669
|
-
|
|
5670
|
-
}
|
|
5671
|
-
|
|
5728
|
+
updateState = 'ended';
|
|
5729
|
+
}
|
|
5730
|
+
const stateChanged = history.update(updateState);
|
|
5731
|
+
|
|
5732
|
+
if (stateChanged) {
|
|
5733
|
+
const eventName = shaka.util.FakeEvent.EventName.StateChanged;
|
|
5734
|
+
const data = (new Map()).set('newstate', updateState);
|
|
5735
|
+
this.dispatchEvent(this.makeEvent_(eventName, data));
|
|
5672
5736
|
}
|
|
5673
5737
|
}
|
|
5674
5738
|
|
|
@@ -6132,8 +6196,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
6132
6196
|
const data = new Map()
|
|
6133
6197
|
.set('oldTrack', from)
|
|
6134
6198
|
.set('newTrack', to);
|
|
6135
|
-
if (this.
|
|
6136
|
-
this.
|
|
6199
|
+
if (this.lcevcDec_) {
|
|
6200
|
+
this.lcevcDec_.updateVariant(to, this.getManifestType());
|
|
6137
6201
|
}
|
|
6138
6202
|
const event =
|
|
6139
6203
|
this.makeEvent_(shaka.util.FakeEvent.EventName.Adaptation, data);
|
|
@@ -6163,8 +6227,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
6163
6227
|
const data = new Map()
|
|
6164
6228
|
.set('oldTrack', from)
|
|
6165
6229
|
.set('newTrack', to);
|
|
6166
|
-
if (this.
|
|
6167
|
-
this.
|
|
6230
|
+
if (this.lcevcDec_) {
|
|
6231
|
+
this.lcevcDec_.updateVariant(to, this.getManifestType());
|
|
6168
6232
|
}
|
|
6169
6233
|
|
|
6170
6234
|
const event =
|
|
@@ -6445,6 +6509,10 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
6445
6509
|
return;
|
|
6446
6510
|
}
|
|
6447
6511
|
|
|
6512
|
+
const event =
|
|
6513
|
+
this.makeEvent_(shaka.util.FakeEvent.EventName.KeyStatusChanged);
|
|
6514
|
+
this.dispatchEvent(event);
|
|
6515
|
+
|
|
6448
6516
|
const keyIds = Object.keys(keyStatusMap);
|
|
6449
6517
|
if (keyIds.length == 0) {
|
|
6450
6518
|
shaka.log.warning(
|
|
@@ -7112,6 +7180,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
|
|
|
7112
7180
|
startTime: null,
|
|
7113
7181
|
startTimeOfLoad: NaN,
|
|
7114
7182
|
uri: null,
|
|
7183
|
+
keepAdManager: true,
|
|
7115
7184
|
};
|
|
7116
7185
|
}
|
|
7117
7186
|
|
|
@@ -7175,7 +7244,8 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
|
|
|
7175
7244
|
* @define {string} A version number taken from git at compile time.
|
|
7176
7245
|
* @export
|
|
7177
7246
|
*/
|
|
7178
|
-
|
|
7247
|
+
// eslint-disable-next-line no-useless-concat
|
|
7248
|
+
shaka.Player.version = 'v4.5.0' + '-uncompiled'; // x-release-please-version
|
|
7179
7249
|
|
|
7180
7250
|
// Initialize the deprecation system using the version string we just set
|
|
7181
7251
|
// on the player.
|
package/lib/routing/payload.js
CHANGED
|
@@ -13,7 +13,8 @@ goog.provide('shaka.routing.Payload');
|
|
|
13
13
|
* mimeType: ?string,
|
|
14
14
|
* startTime: ?number,
|
|
15
15
|
* startTimeOfLoad: number,
|
|
16
|
-
* uri: ?string
|
|
16
|
+
* uri: ?string,
|
|
17
|
+
* keepAdManager: boolean
|
|
17
18
|
* }}
|
|
18
19
|
*
|
|
19
20
|
* @description
|
|
@@ -39,5 +40,8 @@ goog.provide('shaka.routing.Payload');
|
|
|
39
40
|
*
|
|
40
41
|
* @property {?string} uri
|
|
41
42
|
* The address of the content that will be loaded.
|
|
43
|
+
*
|
|
44
|
+
* @property {boolean} keepAdManager
|
|
45
|
+
* Indicates if the adManager shouldn't destroyed.
|
|
42
46
|
*/
|
|
43
47
|
shaka.routing.Payload;
|
package/lib/text/cue.js
CHANGED
|
@@ -222,6 +222,13 @@ shaka.text.Cue = class {
|
|
|
222
222
|
*/
|
|
223
223
|
this.opacity = 1;
|
|
224
224
|
|
|
225
|
+
/**
|
|
226
|
+
* Text combine upright as a CSS text-combine-upright value.
|
|
227
|
+
* @type {string}
|
|
228
|
+
* @export
|
|
229
|
+
*/
|
|
230
|
+
this.textCombineUpright = '';
|
|
231
|
+
|
|
225
232
|
/**
|
|
226
233
|
* Text decoration. A combination of underline, overline
|
|
227
234
|
* and line through. Empty array means no decoration.
|
|
@@ -292,6 +299,14 @@ shaka.text.Cue = class {
|
|
|
292
299
|
*/
|
|
293
300
|
this.lineBreak = false;
|
|
294
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Used to indicate the type of ruby tag that should be used when rendering
|
|
304
|
+
* the cue. Valid values: ruby, rp, rt.
|
|
305
|
+
* @type {?string}
|
|
306
|
+
* @export
|
|
307
|
+
*/
|
|
308
|
+
this.rubyTag = null;
|
|
309
|
+
|
|
295
310
|
/**
|
|
296
311
|
* The number of horizontal and vertical cells into which the Root Container
|
|
297
312
|
* Region area is divided.
|
|
@@ -724,6 +724,23 @@ shaka.text.TtmlTextParser = class {
|
|
|
724
724
|
if (textDecorationElement) {
|
|
725
725
|
TtmlTextParser.addTextDecoration_(cue, textDecorationElement);
|
|
726
726
|
}
|
|
727
|
+
|
|
728
|
+
const textCombine = TtmlTextParser.getStyleAttribute_(
|
|
729
|
+
cueElement, region, styles, 'textCombine', shouldInheritRegionStyles);
|
|
730
|
+
if (textCombine) {
|
|
731
|
+
cue.textCombineUpright = textCombine;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
const ruby = TtmlTextParser.getStyleAttribute_(
|
|
735
|
+
cueElement, region, styles, 'ruby', shouldInheritRegionStyles);
|
|
736
|
+
switch (ruby) {
|
|
737
|
+
case 'container':
|
|
738
|
+
cue.rubyTag = 'ruby';
|
|
739
|
+
break;
|
|
740
|
+
case 'text':
|
|
741
|
+
cue.rubyTag = 'rt';
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
727
744
|
}
|
|
728
745
|
|
|
729
746
|
/**
|
|
@@ -452,6 +452,9 @@ shaka.text.UITextDisplayer = class {
|
|
|
452
452
|
if (cue.lineBreak) {
|
|
453
453
|
type = 'br';
|
|
454
454
|
}
|
|
455
|
+
if (cue.rubyTag) {
|
|
456
|
+
type = cue.rubyTag;
|
|
457
|
+
}
|
|
455
458
|
|
|
456
459
|
const needWrapper = !isNested && cue.nestedCues.length > 0;
|
|
457
460
|
|
|
@@ -561,6 +564,7 @@ shaka.text.UITextDisplayer = class {
|
|
|
561
564
|
style.paddingRight =
|
|
562
565
|
shaka.text.UITextDisplayer.convertLengthValue_(
|
|
563
566
|
cue.linePadding, cue, this.videoContainer_);
|
|
567
|
+
style.textCombineUpright = cue.textCombineUpright;
|
|
564
568
|
style.textShadow = cue.textShadow;
|
|
565
569
|
|
|
566
570
|
if (cue.backgroundImage) {
|