shaka-player 4.3.11 → 4.4.1
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 +9 -0
- package/CHANGELOG.md +303 -202
- package/CONTRIBUTORS +8 -0
- package/LICENSE +32 -0
- package/README.md +63 -10
- package/demo/autoTemplate.txt +40 -5
- package/demo/close_button.js +11 -0
- package/demo/common/asset.js +13 -1
- package/demo/common/assets.js +53 -3
- package/demo/common/message_ids.js +25 -1
- package/demo/config.js +69 -10
- package/demo/customWarning.txt +2 -2
- package/demo/index.html +3 -1
- package/demo/locales/en.json +26 -2
- package/demo/locales/source.json +105 -9
- package/demo/main.js +52 -9
- package/demo/search.js +3 -1
- package/demo/service_worker.js +3 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +124 -112
- package/dist/demo.compiled.debug.map +3 -3
- package/dist/demo.compiled.js +124 -112
- package/dist/demo.compiled.map +3 -3
- package/dist/deps.js +46 -28
- package/dist/locales.js +33 -33
- package/dist/receiver.compiled.debug.js +52 -46
- package/dist/receiver.compiled.debug.map +3 -3
- package/dist/receiver.compiled.js +52 -46
- package/dist/receiver.compiled.map +3 -3
- package/dist/shaka-player.compiled.d.ts +676 -391
- package/dist/shaka-player.compiled.debug.d.ts +676 -391
- package/dist/shaka-player.compiled.debug.externs.js +1188 -616
- package/dist/shaka-player.compiled.debug.js +1043 -699
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +1188 -616
- package/dist/shaka-player.compiled.js +1091 -929
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +677 -392
- package/dist/shaka-player.ui.debug.d.ts +677 -392
- package/dist/shaka-player.ui.debug.externs.js +1023 -451
- package/dist/shaka-player.ui.debug.js +1098 -737
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +1023 -451
- package/dist/shaka-player.ui.js +1246 -1071
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/ad_monetization.md +15 -1
- package/docs/tutorials/application-level-redirects.md +1 -1
- package/docs/tutorials/config.md +9 -5
- package/docs/tutorials/drm-config.md +61 -0
- package/docs/tutorials/fairplay.md +19 -4
- package/docs/tutorials/license-server-auth.md +4 -4
- package/docs/tutorials/license-wrapping.md +2 -2
- package/docs/tutorials/ui-customization.md +7 -3
- package/docs/tutorials/ui.md +7 -7
- package/docs/tutorials/upgrade.md +3 -0
- package/externs/ima.js +123 -2
- package/externs/isoboxer.js +217 -0
- package/externs/mediakeys.js +18 -0
- package/externs/mux.js +1 -105
- package/externs/pictureinpicture.js +48 -0
- package/externs/shaka/ads.js +61 -1
- package/externs/shaka/cea.js +110 -0
- package/externs/shaka/codecs.js +32 -0
- package/externs/shaka/manifest.js +101 -1
- package/externs/shaka/manifest_parser.js +0 -10
- package/externs/shaka/net.js +36 -7
- package/externs/shaka/offline.js +8 -1
- package/externs/shaka/player.js +220 -21
- package/externs/shaka/text.js +1 -382
- package/externs/shaka/transmuxer.js +60 -0
- package/karma.conf.js +13 -0
- package/lib/abr/simple_abr_manager.js +6 -3
- package/lib/ads/ad_manager.js +60 -2
- package/lib/ads/client_side_ad.js +86 -0
- package/lib/ads/client_side_ad_manager.js +79 -3
- package/lib/ads/server_side_ad.js +86 -0
- package/lib/ads/server_side_ad_manager.js +13 -0
- package/lib/cast/cast_utils.js +1 -0
- package/lib/cea/cea608_data_channel.js +24 -14
- package/lib/cea/cea608_memory.js +5 -2
- package/lib/cea/cea708_service.js +8 -9
- package/lib/cea/cea708_window.js +1 -2
- package/lib/cea/cea_decoder.js +23 -6
- package/lib/cea/cea_utils.js +25 -2
- package/lib/cea/dummy_caption_decoder.js +21 -0
- package/lib/cea/dummy_cea_parser.js +1 -3
- package/lib/cea/mp4_cea_parser.js +15 -10
- package/lib/cea/ts_cea_parser.js +69 -0
- package/lib/dash/content_protection.js +32 -2
- package/lib/dash/dash_parser.js +93 -31
- package/lib/dash/mpd_utils.js +6 -25
- package/lib/dash/segment_base.js +12 -14
- package/lib/dash/segment_list.js +10 -6
- package/lib/dash/segment_template.js +349 -32
- package/lib/dependencies/all.js +8 -0
- package/lib/hls/hls_classes.js +33 -8
- package/lib/hls/hls_parser.js +805 -191
- package/lib/hls/manifest_text_parser.js +4 -14
- package/lib/media/adaptation_set_criteria.js +43 -3
- package/lib/media/closed_caption_parser.js +74 -12
- package/lib/media/drm_engine.js +189 -49
- package/lib/media/gap_jumping_controller.js +1 -1
- package/lib/media/manifest_parser.js +34 -0
- package/lib/media/media_source_capabilities.js +10 -0
- package/lib/media/media_source_engine.js +495 -231
- package/lib/media/playhead.js +1 -1
- package/lib/media/presentation_timeline.js +62 -0
- package/lib/media/segment_index.js +50 -14
- package/lib/media/segment_prefetch.js +277 -0
- package/lib/media/segment_reference.js +70 -4
- package/lib/media/streaming_engine.js +258 -81
- package/lib/media/video_wrapper.js +15 -7
- package/lib/mss/content_protection.js +353 -0
- package/lib/mss/mss_parser.js +1082 -0
- package/lib/net/networking_engine.js +60 -10
- 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 +6 -0
- package/lib/offline/storage.js +2 -4
- package/lib/player.js +309 -105
- package/lib/polyfill/media_capabilities.js +43 -3
- package/lib/polyfill/patchedmediakeys_apple.js +5 -0
- package/lib/polyfill/patchedmediakeys_nop.js +5 -0
- package/lib/polyfill/patchedmediakeys_webkit.js +5 -0
- package/lib/text/cue.js +208 -130
- package/lib/text/lrc_text_parser.js +2 -2
- package/lib/text/mp4_vtt_parser.js +2 -2
- package/lib/text/sbv_text_parser.js +1 -1
- package/lib/text/simple_text_displayer.js +1 -1
- package/lib/text/srt_text_parser.js +9 -1
- package/lib/text/ssa_text_parser.js +2 -2
- package/lib/text/text_engine.js +3 -21
- package/lib/text/text_utils.js +71 -20
- package/lib/text/ui_text_displayer.js +14 -14
- package/lib/text/vtt_text_parser.js +22 -14
- package/lib/transmuxer/aac_transmuxer.js +224 -0
- package/lib/transmuxer/ac3.js +142 -0
- package/lib/transmuxer/ac3_transmuxer.js +213 -0
- package/lib/transmuxer/adts.js +232 -0
- package/lib/transmuxer/ec3.js +103 -0
- package/lib/transmuxer/ec3_transmuxer.js +213 -0
- package/lib/transmuxer/h264.js +324 -0
- package/lib/transmuxer/mp3_transmuxer.js +205 -0
- package/lib/transmuxer/mpeg_audio.js +196 -0
- package/lib/transmuxer/mpeg_ts_transmuxer.js +182 -0
- package/lib/transmuxer/mss_transmuxer.js +389 -0
- package/lib/{media/transmuxer.js → transmuxer/muxjs_transmuxer.js} +34 -80
- package/lib/transmuxer/transmuxer_engine.js +161 -0
- package/lib/transmuxer/ts_transmuxer.js +721 -0
- package/lib/util/cmcd_manager.js +131 -71
- package/lib/util/error.js +62 -26
- package/lib/util/exp_golomb.js +220 -0
- package/lib/util/fairplay_utils.js +64 -13
- package/lib/util/id3_utils.js +56 -3
- package/lib/util/language_utils.js +11 -8
- package/lib/util/manifest_parser_utils.js +3 -0
- package/lib/util/mime_utils.js +44 -7
- package/lib/util/mp4_box_parsers.js +233 -5
- package/lib/util/mp4_generator.js +1388 -0
- package/lib/util/periods.js +40 -34
- package/lib/util/platform.js +17 -3
- package/lib/util/player_configuration.js +38 -1
- package/lib/util/stream_utils.js +138 -27
- package/lib/util/text_parser.js +1 -1
- package/lib/util/ts_parser.js +460 -74
- package/lib/util/xml_utils.js +16 -3
- package/maintained-branches.md +2 -2
- package/package.json +3 -1
- package/roadmap.md +21 -6
- package/shaka-player.uncompiled.js +18 -0
- package/test/abr/simple_abr_manager_unit.js +32 -4
- package/test/ads/ad_manager_unit.js +18 -2
- package/test/cast/cast_utils_unit.js +7 -2
- package/test/cea/cea608_memory_unit.js +24 -0
- package/test/cea/cea_decoder_unit.js +33 -0
- package/test/dash/dash_parser_content_protection_unit.js +93 -3
- package/test/dash/dash_parser_live_unit.js +56 -13
- package/test/dash/dash_parser_manifest_unit.js +70 -2
- package/test/dash/dash_parser_segment_base_unit.js +14 -9
- package/test/dash/dash_parser_segment_template_unit.js +286 -6
- package/test/demo/demo_unit.js +5 -1
- package/test/hls/hls_live_unit.js +188 -28
- package/test/hls/hls_parser_unit.js +250 -109
- package/test/hls/manifest_text_parser_unit.js +18 -13
- package/test/media/adaptation_set_criteria_unit.js +46 -14
- package/test/media/adaptation_set_unit.js +2 -0
- package/test/media/drm_engine_integration.js +11 -8
- package/test/media/drm_engine_unit.js +220 -7
- package/test/media/media_source_engine_integration.js +124 -40
- package/test/media/media_source_engine_unit.js +133 -153
- package/test/media/playhead_unit.js +3 -0
- package/test/media/presentation_timeline_unit.js +51 -0
- package/test/media/segment_index_unit.js +52 -0
- package/test/media/segment_prefetch_unit.js +243 -0
- package/test/media/streaming_engine_integration.js +9 -3
- package/test/media/streaming_engine_unit.js +440 -59
- package/test/mss/mss_parser_content_protection_unit.js +49 -0
- package/test/mss/mss_parser_unit.js +472 -0
- package/test/mss/mss_player_integration.js +123 -0
- package/test/offline/manifest_convert_unit.js +9 -0
- package/test/offline/storage_integration.js +6 -1
- package/test/player_unit.js +386 -133
- package/test/polyfill/media_capabilities_unit.js +18 -0
- package/test/test/assets/hls-raw-aac/fileSequence0.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence1.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence2.aac +0 -0
- package/test/test/assets/hls-raw-aac/fileSequence3.aac +0 -0
- package/test/test/assets/hls-raw-aac/manifest.m3u8 +4 -0
- package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +14 -0
- package/test/test/assets/hls-raw-ac3/fileSequence0.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence1.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence2.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence3.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence4.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence5.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence6.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/fileSequence7.ac3 +0 -0
- package/test/test/assets/hls-raw-ac3/prog_index.m3u8 +31 -0
- package/test/test/assets/hls-raw-ec3/fileSequence0.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence1.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence2.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence3.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence4.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence5.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence6.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/fileSequence7.ec3 +0 -0
- package/test/test/assets/hls-raw-ec3/prog_index.m3u8 +31 -0
- package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +13 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_0.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_1.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_2.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/media_w905519204_3.mp3 +0 -0
- package/test/test/assets/hls-raw-mp3/playlist.m3u8 +4 -0
- package/test/test/assets/hls-ts-aac/playlist.m3u8 +23 -0
- package/test/test/assets/hls-ts-aac/segment_0.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_1.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_2.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_3.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_4.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_5.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_6.ts +0 -0
- package/test/test/assets/hls-ts-aac/segment_7.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0004.ts +0 -0
- package/test/test/assets/hls-ts-ac3/ChID_voices_6ch_640kbps_dd_sub_0005.ts +0 -0
- package/test/test/assets/hls-ts-ac3/prog_index.m3u8 +19 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0000.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0001.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0002.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0003.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0004.ts +0 -0
- package/test/test/assets/hls-ts-ec3/ChID_voices_6ch_256kbps_ddp_sub_0005.ts +0 -0
- package/test/test/assets/hls-ts-ec3/prog_index.m3u8 +19 -0
- package/test/test/assets/hls-ts-h264/fileSequence0.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence1.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence2.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence3.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence4.ts +0 -0
- package/test/test/assets/hls-ts-h264/fileSequence5.ts +0 -0
- package/test/test/assets/hls-ts-h264/prog_index.m3u8 +25 -0
- package/test/test/assets/hls-ts-mp3/manifest.m3u8 +13 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_0.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_1.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_2.ts +0 -0
- package/test/test/assets/hls-ts-mp3/media_w239891843_3.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/chunk.m3u8 +17 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_0_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_1_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_2_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_3_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_4_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/n_5_0_0.ts +0 -0
- package/test/test/assets/hls-ts-muxed-aac-h264/playlist.m3u8 +4 -0
- package/test/test/boot.js +7 -2
- package/test/test/util/fake_ad.js +99 -0
- package/test/test/util/fake_ad_manager.js +7 -1
- package/test/test/util/fake_networking_engine.js +41 -14
- package/test/test/util/fake_segment_prefetch.js +81 -0
- package/test/test/util/manifest_generator.js +19 -5
- package/test/test/util/mss_parser_util.js +115 -0
- package/test/test/util/offline_utils.js +1 -0
- package/test/test/util/simple_fakes.js +12 -3
- package/test/test/util/streaming_engine_util.js +14 -4
- package/test/test/util/ttml_utils.js +2 -2
- package/test/text/cue_integration.js +1 -1
- package/test/text/srt_text_parser_unit.js +78 -0
- package/test/text/text_engine_unit.js +17 -8
- package/test/text/ui_text_displayer_unit.js +4 -4
- package/test/text/vtt_text_parser_unit.js +59 -40
- package/test/text/web_vtt_generator_unit.js +9 -3
- package/test/{media/transmuxer_integration.js → transmuxer/muxjs_transmuxer_integration.js} +30 -33
- package/test/transmuxer/transmuxer_engine_integration.js +60 -0
- package/test/transmuxer/transmuxer_integration.js +296 -0
- package/test/util/cmcd_manager_unit.js +162 -13
- package/test/util/language_utils_unit.js +9 -2
- package/test/util/mp4_box_parsers_unit.js +39 -4
- package/test/util/periods_unit.js +34 -26
- package/test/util/stream_utils_unit.js +60 -107
- package/ui/controls.js +19 -1
- package/ui/controls.less +1 -0
- package/ui/externs/ui.js +11 -1
- package/ui/language_utils.js +15 -0
- package/ui/less/thumbnails.less +26 -0
- package/ui/locales/oc.json +42 -0
- package/ui/pip_button.js +83 -2
- package/ui/range_element.js +15 -0
- package/ui/resolution_selection.js +9 -2
- package/ui/seek_bar.js +223 -0
- package/ui/ui.js +5 -0
- package/lib/cea/i_caption_decoder.js +0 -51
- package/lib/cea/i_cea_parser.js +0 -68
|
@@ -252,6 +252,92 @@ shaka.ads.ClientSideAd = class {
|
|
|
252
252
|
return this.ad_.getDescription();
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
/**
|
|
256
|
+
* @override
|
|
257
|
+
* @export
|
|
258
|
+
*/
|
|
259
|
+
getVastMediaBitrate() {
|
|
260
|
+
return this.ad_.getVastMediaBitrate();
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @override
|
|
265
|
+
* @export
|
|
266
|
+
*/
|
|
267
|
+
getVastMediaHeight() {
|
|
268
|
+
return this.ad_.getVastMediaHeight();
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @override
|
|
273
|
+
* @export
|
|
274
|
+
*/
|
|
275
|
+
getVastMediaWidth() {
|
|
276
|
+
return this.ad_.getVastMediaWidth();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @override
|
|
281
|
+
* @export
|
|
282
|
+
*/
|
|
283
|
+
getAdId() {
|
|
284
|
+
return this.ad_.getAdId();
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @override
|
|
289
|
+
* @export
|
|
290
|
+
*/
|
|
291
|
+
getCreativeAdId() {
|
|
292
|
+
return this.ad_.getCreativeAdId();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @override
|
|
297
|
+
* @export
|
|
298
|
+
*/
|
|
299
|
+
getAdvertiserName() {
|
|
300
|
+
return this.ad_.getAdvertiserName();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @override
|
|
305
|
+
* @export
|
|
306
|
+
*/
|
|
307
|
+
getMediaUrl() {
|
|
308
|
+
return this.ad_.getMediaUrl();
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @override
|
|
313
|
+
* @export
|
|
314
|
+
*/
|
|
315
|
+
getTimeOffset() {
|
|
316
|
+
const podInfo = this.ad_.getAdPodInfo();
|
|
317
|
+
if (podInfo == null) {
|
|
318
|
+
// Defaults to 0 if this ad is not part of a pod, or the pod is not part
|
|
319
|
+
// of an ad playlist.
|
|
320
|
+
return 0;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return podInfo.getTimeOffset();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* @override
|
|
328
|
+
* @export
|
|
329
|
+
*/
|
|
330
|
+
getPodIndex() {
|
|
331
|
+
const podInfo = this.ad_.getAdPodInfo();
|
|
332
|
+
if (podInfo == null) {
|
|
333
|
+
// Defaults to 0 if this ad is not part of a pod, or the pod is not part
|
|
334
|
+
// of an ad playlist.
|
|
335
|
+
return 0;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return podInfo.getPodIndex();
|
|
339
|
+
}
|
|
340
|
+
|
|
255
341
|
/**
|
|
256
342
|
* @override
|
|
257
343
|
* @export
|
|
@@ -24,9 +24,10 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
24
24
|
* @param {HTMLElement} adContainer
|
|
25
25
|
* @param {HTMLMediaElement} video
|
|
26
26
|
* @param {string} locale
|
|
27
|
+
* @param {?google.ima.AdsRenderingSettings} adsRenderingSettings
|
|
27
28
|
* @param {function(!shaka.util.FakeEvent)} onEvent
|
|
28
29
|
*/
|
|
29
|
-
constructor(adContainer, video, locale, onEvent) {
|
|
30
|
+
constructor(adContainer, video, locale, adsRenderingSettings, onEvent) {
|
|
30
31
|
/** @private {HTMLElement} */
|
|
31
32
|
this.adContainer_ = adContainer;
|
|
32
33
|
|
|
@@ -36,6 +37,9 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
36
37
|
/** @private {boolean} */
|
|
37
38
|
this.videoPlayed_ = false;
|
|
38
39
|
|
|
40
|
+
/** @private {?shaka.extern.AdsConfiguration} */
|
|
41
|
+
this.config_ = null;
|
|
42
|
+
|
|
39
43
|
/** @private {ResizeObserver} */
|
|
40
44
|
this.resizeObserver_ = null;
|
|
41
45
|
|
|
@@ -53,6 +57,8 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
53
57
|
|
|
54
58
|
google.ima.settings.setLocale(locale);
|
|
55
59
|
|
|
60
|
+
google.ima.settings.setDisableCustomPlaybackForIOS10Plus(true);
|
|
61
|
+
|
|
56
62
|
const adDisplayContainer = new google.ima.AdDisplayContainer(
|
|
57
63
|
this.adContainer_,
|
|
58
64
|
this.video_);
|
|
@@ -70,7 +76,11 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
70
76
|
/** @private {google.ima.AdsManager} */
|
|
71
77
|
this.imaAdsManager_ = null;
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
/** @private {!google.ima.AdsRenderingSettings} */
|
|
80
|
+
this.adsRenderingSettings_ =
|
|
81
|
+
adsRenderingSettings || new google.ima.AdsRenderingSettings();
|
|
82
|
+
|
|
83
|
+
this.eventManager_.listen(this.adsLoader_,
|
|
74
84
|
google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, (e) => {
|
|
75
85
|
this.onAdsManagerLoaded_(
|
|
76
86
|
/** @type {!google.ima.AdsManagerLoadedEvent} */ (e));
|
|
@@ -91,6 +101,16 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
91
101
|
});
|
|
92
102
|
}
|
|
93
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Called by the AdManager to provide an updated configuration any time it
|
|
106
|
+
* changes.
|
|
107
|
+
*
|
|
108
|
+
* @param {shaka.extern.AdsConfiguration} config
|
|
109
|
+
*/
|
|
110
|
+
configure(config) {
|
|
111
|
+
this.config_ = config;
|
|
112
|
+
}
|
|
113
|
+
|
|
94
114
|
/**
|
|
95
115
|
* @param {!google.ima.AdsRequest} imaRequest
|
|
96
116
|
*/
|
|
@@ -99,10 +119,32 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
99
119
|
imaRequest.adTagUrl || imaRequest.adsResponse,
|
|
100
120
|
'The ad tag needs to be set up before requesting ads, ' +
|
|
101
121
|
'or adsResponse must be filled.');
|
|
122
|
+
// Destroy the current AdsManager, in case the tag you requested previously
|
|
123
|
+
// contains post-rolls (don't play those now).
|
|
124
|
+
if (this.imaAdsManager_) {
|
|
125
|
+
this.imaAdsManager_.destroy();
|
|
126
|
+
}
|
|
127
|
+
// Your AdsLoader will be set up on page-load. You should re-use the same
|
|
128
|
+
// AdsLoader for every request.
|
|
129
|
+
if (this.adsLoader_) {
|
|
130
|
+
// Reset the IMA SDK.
|
|
131
|
+
this.adsLoader_.contentComplete();
|
|
132
|
+
}
|
|
102
133
|
this.requestAdsStartTime_ = Date.now() / 1000;
|
|
103
134
|
this.adsLoader_.requestAds(imaRequest);
|
|
104
135
|
}
|
|
105
136
|
|
|
137
|
+
/**
|
|
138
|
+
* @param {!google.ima.AdsRenderingSettings} adsRenderingSettings
|
|
139
|
+
*/
|
|
140
|
+
updateAdsRenderingSettings(adsRenderingSettings) {
|
|
141
|
+
this.adsRenderingSettings_ = adsRenderingSettings;
|
|
142
|
+
if (this.imaAdsManager_) {
|
|
143
|
+
this.imaAdsManager_.updateAdsRenderingSettings(
|
|
144
|
+
this.adsRenderingSettings_);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
106
148
|
/**
|
|
107
149
|
* Stop all currently playing ads.
|
|
108
150
|
*/
|
|
@@ -140,6 +182,10 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
140
182
|
shaka.log.warning(
|
|
141
183
|
'There was an ad error from the IMA SDK: ' + e.getError());
|
|
142
184
|
shaka.log.warning('Resuming playback.');
|
|
185
|
+
|
|
186
|
+
const data = (new Map()).set('originalEvent', e);
|
|
187
|
+
this.onEvent_(new shaka.util.FakeEvent(shaka.ads.AdManager.AD_ERROR, data));
|
|
188
|
+
|
|
143
189
|
this.onAdComplete_(/* adEvent= */ null);
|
|
144
190
|
// Remove ad breaks from the timeline
|
|
145
191
|
this.onEvent_(
|
|
@@ -160,7 +206,37 @@ shaka.ads.ClientSideAdManager = class {
|
|
|
160
206
|
this.onEvent_(new shaka.util.FakeEvent(shaka.ads.AdManager.ADS_LOADED,
|
|
161
207
|
(new Map()).set('loadTime', loadTime)));
|
|
162
208
|
|
|
163
|
-
|
|
209
|
+
if (!this.config_.customPlayheadTracker) {
|
|
210
|
+
this.imaAdsManager_ = e.getAdsManager(this.video_,
|
|
211
|
+
this.adsRenderingSettings_);
|
|
212
|
+
} else {
|
|
213
|
+
const videoPlayHead = {
|
|
214
|
+
currentTime: this.video_.currentTime,
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
this.imaAdsManager_ = e.getAdsManager(videoPlayHead,
|
|
218
|
+
this.adsRenderingSettings_);
|
|
219
|
+
|
|
220
|
+
if (this.video_.muted) {
|
|
221
|
+
this.imaAdsManager_.setVolume(0);
|
|
222
|
+
} else {
|
|
223
|
+
this.imaAdsManager_.setVolume(this.video_.volume);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
this.eventManager_.listen(this.video_, 'timeupdate', () => {
|
|
227
|
+
if (!this.video_.duration) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
videoPlayHead.currentTime = this.video_.currentTime;
|
|
231
|
+
});
|
|
232
|
+
this.eventManager_.listen(this.video_, 'volumechange', () => {
|
|
233
|
+
if (this.video_.muted) {
|
|
234
|
+
this.imaAdsManager_.setVolume(0);
|
|
235
|
+
} else {
|
|
236
|
+
this.imaAdsManager_.setVolume(this.video_.volume);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
164
240
|
|
|
165
241
|
this.onEvent_(new shaka.util.FakeEvent(
|
|
166
242
|
shaka.ads.AdManager.IMA_AD_MANAGER_LOADED,
|
|
@@ -221,6 +221,92 @@ shaka.ads.ServerSideAd = class {
|
|
|
221
221
|
return this.ad_.getDescription();
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @override
|
|
226
|
+
* @export
|
|
227
|
+
*/
|
|
228
|
+
getVastMediaBitrate() {
|
|
229
|
+
return 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @override
|
|
234
|
+
* @export
|
|
235
|
+
*/
|
|
236
|
+
getVastMediaHeight() {
|
|
237
|
+
return this.ad_.getVastMediaHeight();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @override
|
|
242
|
+
* @export
|
|
243
|
+
*/
|
|
244
|
+
getVastMediaWidth() {
|
|
245
|
+
return this.ad_.getVastMediaWidth();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @override
|
|
250
|
+
* @export
|
|
251
|
+
*/
|
|
252
|
+
getAdId() {
|
|
253
|
+
return this.ad_.getAdId();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @override
|
|
258
|
+
* @export
|
|
259
|
+
*/
|
|
260
|
+
getCreativeAdId() {
|
|
261
|
+
return this.ad_.getCreativeAdId();
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @override
|
|
266
|
+
* @export
|
|
267
|
+
*/
|
|
268
|
+
getAdvertiserName() {
|
|
269
|
+
return this.ad_.getAdvertiserName();
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* @override
|
|
274
|
+
* @export
|
|
275
|
+
*/
|
|
276
|
+
getMediaUrl() {
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @override
|
|
282
|
+
* @export
|
|
283
|
+
*/
|
|
284
|
+
getTimeOffset() {
|
|
285
|
+
const podInfo = this.ad_.getAdPodInfo();
|
|
286
|
+
if (podInfo == null) {
|
|
287
|
+
// Defaults to 0 if this ad is not part of a pod, or the pod is not part
|
|
288
|
+
// of an ad playlist.
|
|
289
|
+
return 0;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return podInfo.getTimeOffset();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* @override
|
|
297
|
+
* @export
|
|
298
|
+
*/
|
|
299
|
+
getPodIndex() {
|
|
300
|
+
const podInfo = this.ad_.getAdPodInfo();
|
|
301
|
+
if (podInfo == null) {
|
|
302
|
+
// Defaults to 0 if this ad is not part of a pod, or the pod is not part
|
|
303
|
+
// of an ad playlist.
|
|
304
|
+
return 0;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return podInfo.getPodIndex();
|
|
308
|
+
}
|
|
309
|
+
|
|
224
310
|
/**
|
|
225
311
|
* @override
|
|
226
312
|
* @export
|
|
@@ -35,6 +35,9 @@ shaka.ads.ServerSideAdManager = class {
|
|
|
35
35
|
/** @private {HTMLMediaElement} */
|
|
36
36
|
this.video_ = video;
|
|
37
37
|
|
|
38
|
+
/** @private {?shaka.extern.AdsConfiguration} */
|
|
39
|
+
this.config_ = null;
|
|
40
|
+
|
|
38
41
|
/** @private
|
|
39
42
|
{?shaka.util.PublicPromise.<string>} */
|
|
40
43
|
this.streamPromise_ = null;
|
|
@@ -168,6 +171,16 @@ shaka.ads.ServerSideAdManager = class {
|
|
|
168
171
|
});
|
|
169
172
|
}
|
|
170
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Called by the AdManager to provide an updated configuration any time it
|
|
176
|
+
* changes.
|
|
177
|
+
*
|
|
178
|
+
* @param {shaka.extern.AdsConfiguration} config
|
|
179
|
+
*/
|
|
180
|
+
configure(config) {
|
|
181
|
+
this.config_ = config;
|
|
182
|
+
}
|
|
183
|
+
|
|
171
184
|
/**
|
|
172
185
|
* @param {!google.ima.dai.api.StreamRequest} streamRequest
|
|
173
186
|
* @param {string=} backupUrl
|
package/lib/cast/cast_utils.js
CHANGED
|
@@ -9,7 +9,6 @@ goog.provide('shaka.cea.Cea608DataChannel');
|
|
|
9
9
|
goog.require('shaka.cea.Cea608Memory');
|
|
10
10
|
goog.require('shaka.cea.CeaUtils');
|
|
11
11
|
goog.require('shaka.log');
|
|
12
|
-
goog.requireType('shaka.cea.ICaptionDecoder');
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -54,7 +53,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
54
53
|
* Points to current buffer.
|
|
55
54
|
* @private {!shaka.cea.Cea608Memory}
|
|
56
55
|
*/
|
|
57
|
-
this.curbuf_ = this.
|
|
56
|
+
this.curbuf_ = this.nonDisplayedMemory_;
|
|
58
57
|
|
|
59
58
|
/**
|
|
60
59
|
* End time of the previous caption, serves as start time of next caption.
|
|
@@ -73,14 +72,25 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
73
72
|
* Resets channel state.
|
|
74
73
|
*/
|
|
75
74
|
reset() {
|
|
76
|
-
this.type_ = shaka.cea.Cea608DataChannel.CaptionType.
|
|
77
|
-
this.curbuf_ = this.
|
|
75
|
+
this.type_ = shaka.cea.Cea608DataChannel.CaptionType.NONE;
|
|
76
|
+
this.curbuf_ = this.nonDisplayedMemory_;
|
|
78
77
|
this.lastcp_ = null;
|
|
79
78
|
this.displayedMemory_.reset();
|
|
80
79
|
this.nonDisplayedMemory_.reset();
|
|
81
80
|
this.text_.reset();
|
|
82
81
|
}
|
|
83
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Set the initial PTS, which may not be 0 if we start decoding at a later
|
|
85
|
+
* point in the stream. Without this, the first cue's startTime can be way
|
|
86
|
+
* off.
|
|
87
|
+
*
|
|
88
|
+
* @param {number} pts
|
|
89
|
+
*/
|
|
90
|
+
firstPts(pts) {
|
|
91
|
+
this.prevEndTime_ = pts;
|
|
92
|
+
}
|
|
93
|
+
|
|
84
94
|
/**
|
|
85
95
|
* Gets the row index from a Preamble Address Code byte pair.
|
|
86
96
|
* @param {number} b1 Byte 1.
|
|
@@ -155,12 +165,12 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
155
165
|
}
|
|
156
166
|
buf.setRow(row);
|
|
157
167
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
168
|
+
buf.setUnderline(underline);
|
|
169
|
+
buf.setItalics(italics);
|
|
170
|
+
buf.setTextColor(textColor);
|
|
161
171
|
|
|
162
172
|
// Clear the background color, since new row (PAC) should reset ALL styles.
|
|
163
|
-
|
|
173
|
+
buf.setBackgroundColor(shaka.cea.CeaUtils.DEFAULT_BG_COLOR);
|
|
164
174
|
}
|
|
165
175
|
|
|
166
176
|
/**
|
|
@@ -214,7 +224,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
214
224
|
/**
|
|
215
225
|
* The Cea608DataChannel control methods implement all CC control operations.
|
|
216
226
|
* @param {!shaka.cea.Cea608DataChannel.Cea608Packet} ccPacket
|
|
217
|
-
* @return {?shaka.
|
|
227
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
218
228
|
* @private
|
|
219
229
|
*/
|
|
220
230
|
controlMiscellaneous_(ccPacket) {
|
|
@@ -280,7 +290,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
280
290
|
* Any currently buffered line needs to be emitted, along
|
|
281
291
|
* with a window scroll action.
|
|
282
292
|
* @param {number} pts in seconds.
|
|
283
|
-
* @return {?shaka.
|
|
293
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
284
294
|
* @private
|
|
285
295
|
*/
|
|
286
296
|
controlCr_(pts) {
|
|
@@ -313,7 +323,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
313
323
|
* This means must force emit entire display buffer.
|
|
314
324
|
* @param {number} scrollSize New scroll window size.
|
|
315
325
|
* @param {number} pts
|
|
316
|
-
* @return {?shaka.
|
|
326
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
317
327
|
* @private
|
|
318
328
|
*/
|
|
319
329
|
controlRu_(scrollSize, pts) {
|
|
@@ -357,7 +367,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
357
367
|
* Mode check:
|
|
358
368
|
* EDM affects all captioning modes (but not Text mode);
|
|
359
369
|
* @param {number} pts
|
|
360
|
-
* @return {?shaka.
|
|
370
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
361
371
|
* @private
|
|
362
372
|
*/
|
|
363
373
|
controlEdm_(pts) {
|
|
@@ -404,7 +414,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
404
414
|
* This forces Pop-On mode, and swaps the displayed and nondisplayed memories.
|
|
405
415
|
* @private
|
|
406
416
|
* @param {number} pts
|
|
407
|
-
* @return {?shaka.
|
|
417
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
408
418
|
*/
|
|
409
419
|
controlEoc_(pts) {
|
|
410
420
|
let parsedClosedCaption = null;
|
|
@@ -502,7 +512,7 @@ shaka.cea.Cea608DataChannel = class {
|
|
|
502
512
|
* Three types of control codes:
|
|
503
513
|
* Preamble Address Codes, Mid-Row Codes, and Miscellaneous Control Codes.
|
|
504
514
|
* @param {!shaka.cea.Cea608DataChannel.Cea608Packet} ccPacket
|
|
505
|
-
* @return {?shaka.
|
|
515
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
506
516
|
*/
|
|
507
517
|
handleControlCode(ccPacket) {
|
|
508
518
|
const b1 = ccPacket.ccData1;
|
package/lib/cea/cea608_memory.js
CHANGED
|
@@ -8,7 +8,6 @@ goog.provide('shaka.cea.Cea608Memory');
|
|
|
8
8
|
|
|
9
9
|
goog.require('shaka.cea.CeaUtils');
|
|
10
10
|
goog.require('shaka.text.Cue');
|
|
11
|
-
goog.requireType('shaka.cea.ICaptionDecoder');
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -77,12 +76,16 @@ shaka.cea.Cea608Memory = class {
|
|
|
77
76
|
* Emits a closed caption based on the state of the buffer.
|
|
78
77
|
* @param {number} startTime Start time of the cue.
|
|
79
78
|
* @param {number} endTime End time of the cue.
|
|
80
|
-
* @return {?shaka.
|
|
79
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
81
80
|
*/
|
|
82
81
|
forceEmit(startTime, endTime) {
|
|
83
82
|
const stream = `CC${(this.fieldNum_<< 1) | this.channelNum_ +1}`;
|
|
84
83
|
const topLevelCue = new shaka.text.Cue(
|
|
85
84
|
startTime, endTime, /* payload= */ '');
|
|
85
|
+
topLevelCue.lineInterpretation =
|
|
86
|
+
shaka.text.Cue.lineInterpretation.PERCENTAGE;
|
|
87
|
+
const maxRows = shaka.cea.Cea608Memory.CC_ROWS + 1;
|
|
88
|
+
topLevelCue.line = this.row_ / maxRows * 100;
|
|
86
89
|
return shaka.cea.CeaUtils.getParsedCaption(
|
|
87
90
|
topLevelCue, stream, this.rows_, startTime, endTime);
|
|
88
91
|
}
|
|
@@ -8,7 +8,6 @@ goog.provide('shaka.cea.Cea708Service');
|
|
|
8
8
|
|
|
9
9
|
goog.require('shaka.cea.Cea708Window');
|
|
10
10
|
goog.require('shaka.cea.DtvccPacket');
|
|
11
|
-
goog.require('shaka.cea.ICaptionDecoder');
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -44,7 +43,7 @@ shaka.cea.Cea708Service = class {
|
|
|
44
43
|
/**
|
|
45
44
|
* Processes a CEA-708 control code.
|
|
46
45
|
* @param {!shaka.cea.DtvccPacket} dtvccPacket
|
|
47
|
-
* @return {?shaka.
|
|
46
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
48
47
|
* @throws {!shaka.util.Error}
|
|
49
48
|
*/
|
|
50
49
|
handleCea708ControlCode(dtvccPacket) {
|
|
@@ -156,7 +155,7 @@ shaka.cea.Cea708Service = class {
|
|
|
156
155
|
* Handles C0 group data.
|
|
157
156
|
* @param {number} controlCode
|
|
158
157
|
* @param {number} pts
|
|
159
|
-
* @return {?shaka.
|
|
158
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
160
159
|
* @private
|
|
161
160
|
*/
|
|
162
161
|
handleC0_(controlCode, pts) {
|
|
@@ -207,7 +206,7 @@ shaka.cea.Cea708Service = class {
|
|
|
207
206
|
* @param {!shaka.cea.DtvccPacket} dtvccPacket
|
|
208
207
|
* @param {number} captionCommand
|
|
209
208
|
* @param {number} pts in seconds
|
|
210
|
-
* @return {?shaka.
|
|
209
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
211
210
|
* @throws {!shaka.util.Error} a possible out-of-range buffer read.
|
|
212
211
|
* @private
|
|
213
212
|
*/
|
|
@@ -318,7 +317,7 @@ shaka.cea.Cea708Service = class {
|
|
|
318
317
|
/**
|
|
319
318
|
* @param {number} windowsBitmap
|
|
320
319
|
* @param {number} pts
|
|
321
|
-
* @return {?shaka.
|
|
320
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
322
321
|
* @private
|
|
323
322
|
*/
|
|
324
323
|
clearWindows_(windowsBitmap, pts) {
|
|
@@ -356,7 +355,7 @@ shaka.cea.Cea708Service = class {
|
|
|
356
355
|
/**
|
|
357
356
|
* @param {number} windowsBitmap
|
|
358
357
|
* @param {number} pts
|
|
359
|
-
* @return {?shaka.
|
|
358
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
360
359
|
* @private
|
|
361
360
|
*/
|
|
362
361
|
hideWindows_(windowsBitmap, pts) {
|
|
@@ -377,7 +376,7 @@ shaka.cea.Cea708Service = class {
|
|
|
377
376
|
/**
|
|
378
377
|
* @param {number} windowsBitmap
|
|
379
378
|
* @param {number} pts
|
|
380
|
-
* @return {?shaka.
|
|
379
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
381
380
|
* @private
|
|
382
381
|
*/
|
|
383
382
|
toggleWindows_(windowsBitmap, pts) {
|
|
@@ -402,7 +401,7 @@ shaka.cea.Cea708Service = class {
|
|
|
402
401
|
/**
|
|
403
402
|
* @param {number} windowsBitmap
|
|
404
403
|
* @param {number} pts
|
|
405
|
-
* @return {?shaka.
|
|
404
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
406
405
|
* @private
|
|
407
406
|
*/
|
|
408
407
|
deleteWindows_(windowsBitmap, pts) {
|
|
@@ -424,7 +423,7 @@ shaka.cea.Cea708Service = class {
|
|
|
424
423
|
* Emits anything currently present in any of the windows, and then
|
|
425
424
|
* deletes all windows, cancels all delays, reinitializes the service.
|
|
426
425
|
* @param {number} pts
|
|
427
|
-
* @return {?shaka.
|
|
426
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
428
427
|
* @private
|
|
429
428
|
*/
|
|
430
429
|
reset_(pts) {
|
package/lib/cea/cea708_window.js
CHANGED
|
@@ -8,7 +8,6 @@ goog.provide('shaka.cea.Cea708Window');
|
|
|
8
8
|
|
|
9
9
|
goog.require('shaka.cea.CeaUtils');
|
|
10
10
|
goog.require('shaka.cea.CeaUtils.StyledChar');
|
|
11
|
-
goog.require('shaka.cea.ICaptionDecoder');
|
|
12
11
|
goog.require('shaka.text.Cue');
|
|
13
12
|
goog.require('shaka.util.Functional');
|
|
14
13
|
|
|
@@ -288,7 +287,7 @@ shaka.cea.Cea708Window = class {
|
|
|
288
287
|
/**
|
|
289
288
|
* @param {number} endTime
|
|
290
289
|
* @param {number} serviceNumber Number of the service emitting this caption.
|
|
291
|
-
* @return {?shaka.
|
|
290
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
292
291
|
*/
|
|
293
292
|
forceEmit(endTime, serviceNumber) {
|
|
294
293
|
const stream = `svc${serviceNumber}`;
|
package/lib/cea/cea_decoder.js
CHANGED
|
@@ -9,16 +9,17 @@ goog.provide('shaka.cea.CeaDecoder');
|
|
|
9
9
|
goog.require('shaka.cea.Cea608DataChannel');
|
|
10
10
|
goog.require('shaka.cea.Cea708Service');
|
|
11
11
|
goog.require('shaka.cea.DtvccPacketBuilder');
|
|
12
|
-
goog.require('shaka.cea.ICaptionDecoder');
|
|
13
12
|
goog.require('shaka.log');
|
|
13
|
+
goog.require('shaka.media.ClosedCaptionParser');
|
|
14
14
|
goog.require('shaka.util.DataViewReader');
|
|
15
15
|
goog.require('shaka.util.Error');
|
|
16
16
|
goog.requireType('shaka.cea.DtvccPacket');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* CEA-X08 captions decoder.
|
|
21
|
-
* @implements {shaka.
|
|
20
|
+
* CEA-X08 captions decoder.
|
|
21
|
+
* @implements {shaka.extern.ICaptionDecoder}
|
|
22
|
+
* @export
|
|
22
23
|
*/
|
|
23
24
|
shaka.cea.CeaDecoder = class {
|
|
24
25
|
/** */
|
|
@@ -77,6 +78,11 @@ shaka.cea.CeaDecoder = class {
|
|
|
77
78
|
*/
|
|
78
79
|
this.serviceNumberToService_ = new Map();
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* @private {boolean}
|
|
83
|
+
*/
|
|
84
|
+
this.waitingForFirstPacket_ = true;
|
|
85
|
+
|
|
80
86
|
this.reset();
|
|
81
87
|
}
|
|
82
88
|
|
|
@@ -106,6 +112,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
106
112
|
for (const stream of this.cea608ModeToStream_.values()) {
|
|
107
113
|
stream.reset();
|
|
108
114
|
}
|
|
115
|
+
this.waitingForFirstPacket_ = true;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
/**
|
|
@@ -114,6 +121,13 @@ shaka.cea.CeaDecoder = class {
|
|
|
114
121
|
* @override
|
|
115
122
|
*/
|
|
116
123
|
extract(userDataSeiMessage, pts) {
|
|
124
|
+
if (this.waitingForFirstPacket_) {
|
|
125
|
+
for (const stream of this.cea608ModeToStream_.values()) {
|
|
126
|
+
stream.firstPts(pts);
|
|
127
|
+
}
|
|
128
|
+
this.waitingForFirstPacket_ = false;
|
|
129
|
+
}
|
|
130
|
+
|
|
117
131
|
const reader = new shaka.util.DataViewReader(
|
|
118
132
|
userDataSeiMessage, shaka.util.DataViewReader.Endianness.BIG_ENDIAN);
|
|
119
133
|
|
|
@@ -195,7 +209,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
195
209
|
* @override
|
|
196
210
|
*/
|
|
197
211
|
decode() {
|
|
198
|
-
/** @type {!Array.<!shaka.
|
|
212
|
+
/** @type {!Array.<!shaka.extern.ICaptionDecoder.ClosedCaption>} */
|
|
199
213
|
const parsedClosedCaptions = [];
|
|
200
214
|
|
|
201
215
|
// In some versions of Chrome, and other browsers, the default sorting
|
|
@@ -237,7 +251,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
237
251
|
/**
|
|
238
252
|
* Decodes a CEA-608 closed caption packet based on ANSI/CEA-608.
|
|
239
253
|
* @param {shaka.cea.Cea608DataChannel.Cea608Packet} ccPacket
|
|
240
|
-
* @return {?shaka.
|
|
254
|
+
* @return {?shaka.extern.ICaptionDecoder.ClosedCaption}
|
|
241
255
|
* @private
|
|
242
256
|
*/
|
|
243
257
|
decodeCea608_(ccPacket) {
|
|
@@ -302,7 +316,7 @@ shaka.cea.CeaDecoder = class {
|
|
|
302
316
|
/**
|
|
303
317
|
* Decodes a CEA-708 DTVCC packet based on ANSI/CTA-708-E.
|
|
304
318
|
* @param {shaka.cea.DtvccPacket} dtvccPacket
|
|
305
|
-
* @return {!Array<!shaka.
|
|
319
|
+
* @return {!Array<!shaka.extern.ICaptionDecoder.ClosedCaption>}
|
|
306
320
|
* @private
|
|
307
321
|
*/
|
|
308
322
|
decodeCea708_(dtvccPacket) {
|
|
@@ -402,3 +416,6 @@ shaka.cea.CeaDecoder.NTSC_CC_FIELD_2 = 1;
|
|
|
402
416
|
* @private @const {number}
|
|
403
417
|
*/
|
|
404
418
|
shaka.cea.CeaDecoder.USA_COUNTRY_CODE = 0xb5;
|
|
419
|
+
|
|
420
|
+
shaka.media.ClosedCaptionParser.registerDecoder(
|
|
421
|
+
() => new shaka.cea.CeaDecoder());
|