shaka-player 4.6.4 → 4.7.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/README.md +1 -0
- package/dist/controls.css +1 -1
- package/dist/controls.css.map +1 -1
- package/dist/deps.js +9 -5
- package/dist/locales.js +29 -29
- package/dist/shaka-player.compiled.d.ts +46 -3
- package/dist/shaka-player.compiled.debug.d.ts +46 -3
- package/dist/shaka-player.compiled.debug.externs.js +45 -0
- package/dist/shaka-player.compiled.debug.js +382 -351
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +45 -0
- package/dist/shaka-player.compiled.js +1135 -1121
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +68 -4
- package/dist/shaka-player.ui.debug.d.ts +68 -4
- package/dist/shaka-player.ui.debug.externs.js +77 -0
- package/dist/shaka-player.ui.debug.js +428 -392
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +77 -0
- package/dist/shaka-player.ui.js +1304 -1290
- package/dist/shaka-player.ui.map +4 -4
- package/externs/mediasession.js +7 -0
- package/externs/shaka/abr_manager.js +8 -0
- package/externs/shaka/manifest.js +3 -3
- package/externs/shaka/player.js +59 -4
- package/lib/abr/simple_abr_manager.js +41 -15
- package/lib/cea/cea708_service.js +1 -1
- package/lib/cea/cea708_window.js +95 -7
- package/lib/dash/dash_parser.js +55 -11
- package/lib/media/adaptation_set_criteria.js +76 -10
- package/lib/media/media_source_engine.js +42 -18
- package/lib/media/segment_reference.js +12 -0
- package/lib/media/streaming_engine.js +55 -3
- package/lib/player.js +92 -6
- package/lib/util/cmsd_manager.js +269 -0
- package/lib/util/content_steering_manager.js +5 -1
- package/lib/util/mime_utils.js +6 -2
- package/lib/util/periods.js +108 -39
- package/lib/util/player_configuration.js +19 -5
- package/lib/util/stream_utils.js +82 -13
- package/package.json +1 -1
- package/ui/audio_language_selection.js +3 -0
- package/ui/controls.js +60 -0
- package/ui/externs/ui.js +12 -1
- package/ui/hidden_fast_forward_button.js +32 -0
- package/ui/hidden_rewind_button.js +32 -0
- package/ui/hidden_seek_button.js +121 -0
- package/ui/less/buttons.less +50 -0
- package/ui/less/containers.less +18 -0
- package/ui/resolution_selection.js +2 -0
- package/ui/ui.js +2 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -75
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -26
- package/.github/ISSUE_TEMPLATE/question.md +0 -26
- package/.github/config.yml +0 -1
- package/.github/workflows/appspot.yaml +0 -39
- package/.github/workflows/build-and-test.yaml +0 -222
- package/.github/workflows/compute-incremental-coverage.py +0 -265
- package/.github/workflows/custom-actions/prep-for-appspot/action.yaml +0 -56
- package/.github/workflows/custom-actions/set-commit-status/action.yaml +0 -37
- package/.github/workflows/deflake.yaml +0 -31
- package/.github/workflows/demo-version-index.yaml +0 -43
- package/.github/workflows/nightly-demo.yaml +0 -42
- package/.github/workflows/release-please.yaml +0 -193
- package/.github/workflows/report-incremental-coverage.yaml +0 -39
- package/.github/workflows/safari-homedir-launcher.sh +0 -18
- package/.github/workflows/selenium-lab-tests.yaml +0 -370
- package/.github/workflows/shaka-bot-commands/command-help.sh +0 -27
- package/.github/workflows/shaka-bot-commands/command-test.sh +0 -56
- package/.github/workflows/shaka-bot-commands/lib.sh +0 -83
- package/.github/workflows/shaka-bot-commands/main.sh +0 -51
- package/.github/workflows/sync-labels.yaml +0 -33
- package/.github/workflows/talk-to-shaka-bot.yaml +0 -29
- package/.github/workflows/update-issues.yaml +0 -31
- package/.github/workflows/update-screenshots.yaml +0 -142
- package/.github/workflows/validate-pr-title.yaml +0 -27
- package/CHANGELOG.md +0 -5774
- package/CODE_OF_CONDUCT.md +0 -93
- package/CONTRIBUTING.md +0 -76
- package/demo/TengwarTelcontar.woff2 +0 -0
- package/demo/app_logo_144.png +0 -0
- package/demo/app_logo_192.png +0 -0
- package/demo/app_logo_256.png +0 -0
- package/demo/app_logo_384.png +0 -0
- package/demo/app_logo_512.png +0 -0
- package/demo/app_manifest.json +0 -29
- package/demo/asset_card.js +0 -410
- package/demo/autoTemplate.txt +0 -61
- package/demo/cast_receiver/idle1.jpg +0 -0
- package/demo/cast_receiver/idle2.jpg +0 -0
- package/demo/cast_receiver/idle3.jpg +0 -0
- package/demo/cast_receiver/index.html +0 -75
- package/demo/cast_receiver/receiver_app.css +0 -111
- package/demo/cast_receiver/receiver_app.js +0 -158
- package/demo/close_button.js +0 -60
- package/demo/common/asset.js +0 -510
- package/demo/common/assets.js +0 -1634
- package/demo/config.js +0 -859
- package/demo/custom.js +0 -907
- package/demo/customWarning.txt +0 -8
- package/demo/demo.less +0 -591
- package/demo/demo_uncompiled.js +0 -11
- package/demo/demo_utils.js +0 -113
- package/demo/favicon.ico +0 -0
- package/demo/front.js +0 -156
- package/demo/icons/README.md +0 -4
- package/demo/icons/baseline-audiotrack-24px.svg +0 -1
- package/demo/icons/baseline-closed_caption-24px.svg +0 -1
- package/demo/icons/baseline-fast_forward-24px.svg +0 -1
- package/demo/icons/baseline-language-24px.svg +0 -1
- package/demo/icons/baseline-live_tv-24px.svg +0 -1
- package/demo/icons/baseline-subtitles-24px.svg +0 -1
- package/demo/icons/baseline-surround_sound-24px.svg +0 -1
- package/demo/icons/custom_ad.svg +0 -1
- package/demo/icons/custom_box_with_text.svg +0 -1
- package/demo/icons/custom_clear_key.svg +0 -1
- package/demo/icons/custom_high_definition.svg +0 -1
- package/demo/icons/custom_playready.svg +0 -1
- package/demo/icons/custom_ultra_high_definition.svg +0 -1
- package/demo/icons/custom_widevine.svg +0 -1
- package/demo/index.html +0 -173
- package/demo/input.js +0 -270
- package/demo/input_container.js +0 -218
- package/demo/load.js +0 -156
- package/demo/main.js +0 -1854
- package/demo/search.js +0 -452
- package/demo/service_worker.js +0 -355
- package/demo/shaka_logo_trans.png +0 -0
- package/demo/tooltip.js +0 -29
- package/demo/visualizer.js +0 -335
- package/demo/visualizer_button.js +0 -84
- package/dist/demo.compiled.debug.js +0 -340
- package/dist/demo.compiled.debug.map +0 -8
- package/dist/demo.compiled.js +0 -340
- package/dist/demo.compiled.map +0 -8
- package/dist/demo.css +0 -6
- package/dist/demo.css.map +0 -1
- package/dist/receiver.compiled.debug.js +0 -187
- package/dist/receiver.compiled.debug.map +0 -8
- package/dist/receiver.compiled.js +0 -187
- package/dist/receiver.compiled.map +0 -8
- package/docs/announcement-list-join-group.png +0 -0
- package/docs/api-mainpage.md +0 -28
- package/docs/design/REDESIGN.md +0 -283
- package/docs/design/architecture.md +0 -13
- package/docs/design/bg-fetch-after.gv +0 -29
- package/docs/design/bg-fetch-after.gv.png +0 -0
- package/docs/design/bg-fetch-before.gv +0 -18
- package/docs/design/bg-fetch-before.gv.png +0 -0
- package/docs/design/bg-fetch.md +0 -134
- package/docs/design/cast.gv +0 -35
- package/docs/design/cast.gv.png +0 -0
- package/docs/design/chromecast.md +0 -151
- package/docs/design/codec_preferences.md +0 -158
- package/docs/design/dash-audio-channels.md +0 -123
- package/docs/design/dash-manifests.md +0 -248
- package/docs/design/dash-timeline.svg +0 -4
- package/docs/design/dataflow.gv +0 -66
- package/docs/design/dataflow.gv.png +0 -0
- package/docs/design/export.md +0 -70
- package/docs/design/fuzzy-locale-matching.md +0 -40
- package/docs/design/gap-jumping.md +0 -151
- package/docs/design/lcevc-architecture.png +0 -0
- package/docs/design/lcevc-demo.png +0 -0
- package/docs/design/lcevc-integration.md +0 -72
- package/docs/design/locale_compatibility.svg +0 -1
- package/docs/design/locales_tree.svg +0 -1
- package/docs/design/localization-design-principles.md +0 -158
- package/docs/design/newdemo.gv +0 -83
- package/docs/design/newdemo.gv.png +0 -0
- package/docs/design/offline.gv +0 -43
- package/docs/design/offline.gv.png +0 -0
- package/docs/design/offline.md +0 -153
- package/docs/design/ownership.gv +0 -76
- package/docs/design/ownership.gv.png +0 -0
- package/docs/design/preload.md +0 -299
- package/docs/design/preload.png +0 -0
- package/docs/design/talking-about-languages.md +0 -46
- package/docs/design/timeline.svg +0 -152
- package/docs/design/ui.md +0 -31
- package/docs/design/ui_player_relationships.svg +0 -1
- package/docs/jsdoc-plugin.js +0 -74
- package/docs/jsdoc-template/README.md +0 -1
- package/docs/jsdoc-template/publish.js +0 -879
- package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docs/jsdoc-template/static/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docs/jsdoc-template/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docs/jsdoc-template/static/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docs/jsdoc-template/static/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docs/jsdoc-template/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docs/jsdoc-template/static/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/jsdoc-template/static/scripts/linenumber.js +0 -44
- package/docs/jsdoc-template/static/scripts/show-widget.js +0 -55
- package/docs/jsdoc-template/static/styles/jsdoc-default.css +0 -438
- package/docs/jsdoc-template/tmpl/augments.tmpl +0 -10
- package/docs/jsdoc-template/tmpl/container.tmpl +0 -205
- package/docs/jsdoc-template/tmpl/details.tmpl +0 -152
- package/docs/jsdoc-template/tmpl/example.tmpl +0 -2
- package/docs/jsdoc-template/tmpl/examples.tmpl +0 -13
- package/docs/jsdoc-template/tmpl/exceptions.tmpl +0 -32
- package/docs/jsdoc-template/tmpl/layout.tmpl +0 -50
- package/docs/jsdoc-template/tmpl/mainpage.tmpl +0 -14
- package/docs/jsdoc-template/tmpl/members.tmpl +0 -47
- package/docs/jsdoc-template/tmpl/method.tmpl +0 -140
- package/docs/jsdoc-template/tmpl/modifies.tmpl +0 -14
- package/docs/jsdoc-template/tmpl/params.tmpl +0 -131
- package/docs/jsdoc-template/tmpl/properties.tmpl +0 -125
- package/docs/jsdoc-template/tmpl/returns.tmpl +0 -19
- package/docs/jsdoc-template/tmpl/source.tmpl +0 -8
- package/docs/jsdoc-template/tmpl/tutorial.tmpl +0 -21
- package/docs/jsdoc-template/tmpl/type.tmpl +0 -7
- package/docs/jsdoc.conf.json +0 -38
- package/docs/shaka-player-logo.png +0 -0
- package/docs/style.md +0 -174
- package/docs/tutorials/a11y.md +0 -64
- package/docs/tutorials/ad_monetization.md +0 -292
- package/docs/tutorials/application-level-redirects.md +0 -94
- package/docs/tutorials/architecture.md +0 -32
- package/docs/tutorials/basic-usage.md +0 -89
- package/docs/tutorials/blob-url.md +0 -15
- package/docs/tutorials/config.md +0 -148
- package/docs/tutorials/debugging.md +0 -189
- package/docs/tutorials/drm-config.md +0 -274
- package/docs/tutorials/errors.md +0 -95
- package/docs/tutorials/fairplay.md +0 -242
- package/docs/tutorials/faq.md +0 -252
- package/docs/tutorials/index.json +0 -29
- package/docs/tutorials/lcevc.md +0 -118
- package/docs/tutorials/license-server-auth.md +0 -248
- package/docs/tutorials/license-wrapping.md +0 -168
- package/docs/tutorials/manifest-parser.md +0 -365
- package/docs/tutorials/network-and-buffering-config.md +0 -119
- package/docs/tutorials/offline.md +0 -683
- package/docs/tutorials/plugins.md +0 -184
- package/docs/tutorials/selenium-grid-config.md +0 -174
- package/docs/tutorials/service-worker.md +0 -106
- package/docs/tutorials/ui-customization.md +0 -288
- package/docs/tutorials/ui.md +0 -232
- package/docs/tutorials/upgrade-manifest.md +0 -281
- package/docs/tutorials/upgrade.md +0 -104
- package/docs/tutorials/welcome.md +0 -108
- package/docs/tutorials/widevine-service-certs.md +0 -45
- package/karma.conf.js +0 -879
- package/maintained-branches.md +0 -15
- package/roadmap.md +0 -186
- package/test/abr/simple_abr_manager_unit.js +0 -398
- package/test/ads/ad_manager_unit.js +0 -260
- package/test/assumptions/uint8_array_unit.js +0 -22
- package/test/cast/cast_proxy_unit.js +0 -736
- package/test/cast/cast_receiver_integration.js +0 -488
- package/test/cast/cast_receiver_unit.js +0 -1183
- package/test/cast/cast_sender_unit.js +0 -973
- package/test/cast/cast_utils_unit.js +0 -311
- package/test/cea/cea608_memory_unit.js +0 -411
- package/test/cea/cea708_service_unit.js +0 -674
- package/test/cea/cea708_window_unit.js +0 -373
- package/test/cea/cea_decoder_unit.js +0 -615
- package/test/cea/dtvcc_packet_builder_unit.js +0 -158
- package/test/cea/dtvcc_packet_unit.js +0 -60
- package/test/cea/mp4_cea_parser_unit.js +0 -127
- package/test/codec_switching/codec_switching_integration.js +0 -182
- package/test/dash/dash_parser_content_protection_unit.js +0 -998
- package/test/dash/dash_parser_integration.js +0 -74
- package/test/dash/dash_parser_live_unit.js +0 -1542
- package/test/dash/dash_parser_manifest_unit.js +0 -3121
- package/test/dash/dash_parser_segment_base_unit.js +0 -421
- package/test/dash/dash_parser_segment_list_unit.js +0 -380
- package/test/dash/dash_parser_segment_template_unit.js +0 -910
- package/test/dash/mpd_utils_unit.js +0 -794
- package/test/demo/demo_unit.js +0 -108
- package/test/deprecate/enforcer_unit.js +0 -74
- package/test/deprecate/version_unit.js +0 -57
- package/test/hls/hls_live_unit.js +0 -1330
- package/test/hls/hls_parser_unit.js +0 -5276
- package/test/hls/manifest_text_parser_unit.js +0 -545
- package/test/media/adaptation_set_criteria_unit.js +0 -806
- package/test/media/adaptation_set_unit.js +0 -229
- package/test/media/buffering_observer_unit.js +0 -143
- package/test/media/closed_caption_parser_unit.js +0 -18
- package/test/media/content_workarounds_unit.js +0 -43
- package/test/media/drm_engine_integration.js +0 -356
- package/test/media/drm_engine_unit.js +0 -2805
- package/test/media/media_source_engine_integration.js +0 -691
- package/test/media/media_source_engine_unit.js +0 -1512
- package/test/media/mp4_segment_index_parser_unit.js +0 -80
- package/test/media/play_rate_controller_unit.js +0 -69
- package/test/media/playhead_unit.js +0 -1394
- package/test/media/presentation_timeline_unit.js +0 -477
- package/test/media/quality_observer_unit.js +0 -138
- package/test/media/region_observer_unit.js +0 -374
- package/test/media/region_timeline_unit.js +0 -139
- package/test/media/segment_index_unit.js +0 -1080
- package/test/media/segment_prefetch_unit.js +0 -243
- package/test/media/segment_reference_unit.js +0 -63
- package/test/media/stall_detector_unit.js +0 -184
- package/test/media/streaming_engine_integration.js +0 -632
- package/test/media/streaming_engine_unit.js +0 -4211
- package/test/media/time_ranges_utils_unit.js +0 -123
- package/test/media/webm_segment_index_parser_unit.js +0 -90
- package/test/mss/mss_parser_content_protection_unit.js +0 -49
- package/test/mss/mss_parser_unit.js +0 -474
- package/test/mss/mss_player_integration.js +0 -124
- package/test/net/data_uri_plugin_unit.js +0 -105
- package/test/net/http_plugin_unit.js +0 -439
- package/test/net/networking_engine_unit.js +0 -1236
- package/test/net/networking_utils_unit.js +0 -37
- package/test/offline/download_progress_estimator_unit.js +0 -90
- package/test/offline/indexeddb_storage_unit.js +0 -192
- package/test/offline/manifest_convert_unit.js +0 -622
- package/test/offline/offline_integration.js +0 -168
- package/test/offline/offline_manifest_parser_unit.js +0 -231
- package/test/offline/offline_scheme_unit.js +0 -154
- package/test/offline/offline_uri_unit.js +0 -59
- package/test/offline/storage_compatibility_unit.js +0 -344
- package/test/offline/storage_integration.js +0 -1858
- package/test/player_external.js +0 -237
- package/test/player_integration.js +0 -1371
- package/test/player_load_graph_integration.js +0 -865
- package/test/player_src_equals_external.js +0 -154
- package/test/player_src_equals_integration.js +0 -527
- package/test/player_unit.js +0 -4434
- package/test/polyfill/media_capabilities_unit.js +0 -277
- package/test/polyfill/patchedmediakeys_apple_unit.js +0 -130
- package/test/test/assets/3675/chunk-stream0-00001.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00002.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00003.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00004.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00005.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00006.m4s +0 -0
- package/test/test/assets/3675/chunk-stream0-00007.m4s +0 -0
- package/test/test/assets/3675/dash_0.mpd +0 -30
- package/test/test/assets/3675/dash_1.mpd +0 -30
- package/test/test/assets/3675/dash_2.mpd +0 -30
- package/test/test/assets/3675/dash_3.mpd +0 -30
- package/test/test/assets/3675/dash_4.mpd +0 -30
- package/test/test/assets/3675/dash_5.mpd +0 -26
- package/test/test/assets/3675/init-stream0.m4s +0 -0
- package/test/test/assets/audio-xhe-aac.mp4 +0 -0
- package/test/test/assets/audio.ts +0 -0
- package/test/test/assets/captions-test.ts +0 -0
- package/test/test/assets/cea-init.mp4 +0 -0
- package/test/test/assets/cea-segment.mp4 +0 -0
- package/test/test/assets/chapters.srt +0 -11
- package/test/test/assets/chapters.vtt +0 -10
- package/test/test/assets/chapters2.vtt +0 -10
- 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 +0 -18
- package/test/test/assets/dash-aes-128/license +0 -1
- 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 +0 -32
- package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
- package/test/test/assets/db-dump-v1.json +0 -1
- package/test/test/assets/db-dump-v2-broken.json +0 -1
- package/test/test/assets/db-dump-v2-clean.json +0 -1
- package/test/test/assets/db-dump-v3.json +0 -1
- package/test/test/assets/db-dump-v4-broken.json +0 -1
- package/test/test/assets/db-dump-v5.json +0 -1
- package/test/test/assets/empty_caption_video_init.mp4 +0 -0
- package/test/test/assets/empty_caption_video_segment.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-audio-init.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-audio-segment.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-video-init.mp4 +0 -0
- package/test/test/assets/encrypted-sintel-video-segment.mp4 +0 -0
- package/test/test/assets/green-pixel.mp4 +0 -0
- package/test/test/assets/green-pixel.txt +0 -15
- package/test/test/assets/h265-cea-init.mp4 +0 -0
- package/test/test/assets/h265-cea-segment.mp4 +0 -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 +0 -4
- package/test/test/assets/hls-raw-aac/stream.m4a.m3u8 +0 -14
- 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 +0 -31
- 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 +0 -31
- package/test/test/assets/hls-raw-mp3/chunklist_w905519204.m3u8 +0 -13
- 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 +0 -4
- package/test/test/assets/hls-ts-aac/playlist.m3u8 +0 -23
- 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 +0 -19
- 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 +0 -19
- 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 +0 -25
- package/test/test/assets/hls-ts-h265/0.ts +0 -0
- package/test/test/assets/hls-ts-h265/hevc.m3u8 +0 -6
- package/test/test/assets/hls-ts-h265/index.m3u8 +0 -7
- package/test/test/assets/hls-ts-mp3/manifest.m3u8 +0 -13
- 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 +0 -17
- 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 +0 -4
- 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 +0 -9
- package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +0 -24
- 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 +0 -14
- package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +0 -23
- 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/assets/id3-metadata.aac +0 -0
- package/test/test/assets/id3-metadata.ts +0 -0
- package/test/test/assets/index-segment.mp4 +0 -0
- package/test/test/assets/index-segment.webm +0 -0
- package/test/test/assets/init-segment.webm +0 -0
- package/test/test/assets/large_file.mpd +0 -4930
- package/test/test/assets/multidrm-audio-init.mp4 +0 -0
- package/test/test/assets/multidrm-audio-segment.mp4 +0 -0
- package/test/test/assets/multidrm-video-init.mp4 +0 -0
- package/test/test/assets/multidrm-video-segment.mp4 +0 -0
- package/test/test/assets/multiple-trun-init.mp4 +0 -0
- package/test/test/assets/multiple-trun-segment.mp4 +0 -0
- package/test/test/assets/sintel-audio-init.mp4 +0 -0
- package/test/test/assets/sintel-audio-segment.mp4 +0 -0
- package/test/test/assets/sintel-video-init.mp4 +0 -0
- package/test/test/assets/sintel-video-segment.mp4 +0 -0
- package/test/test/assets/small.mp4 +0 -0
- package/test/test/assets/text-clip-alt.vtt +0 -63
- package/test/test/assets/text-clip.vtt +0 -63
- package/test/test/assets/thumbnails-sprites.vtt +0 -10
- package/test/test/assets/thumbnails.vtt +0 -10
- package/test/test/assets/ttml-init.mp4 +0 -0
- package/test/test/assets/ttml-segment-multiplemdat.mp4 +0 -0
- package/test/test/assets/ttml-segment.mp4 +0 -0
- package/test/test/assets/video.ts +0 -0
- package/test/test/assets/vtt-init.mp4 +0 -0
- package/test/test/assets/vtt-segment-multi-payload.mp4 +0 -0
- package/test/test/assets/vtt-segment-no-duration.mp4 +0 -0
- package/test/test/assets/vtt-segment-settings.mp4 +0 -0
- package/test/test/assets/vtt-segment.mp4 +0 -0
- package/test/test/boot.js +0 -495
- package/test/test/externs/filters.js +0 -44
- package/test/test/externs/fontfaceonload.js +0 -29
- package/test/test/externs/jasmine.js +0 -670
- package/test/test/externs/karma.js +0 -26
- package/test/test/externs/require.js +0 -21
- package/test/test/externs/sprintf.js +0 -18
- package/test/test/namespace.js +0 -10
- package/test/test/util/canned_idb.js +0 -379
- package/test/test/util/cea_utils.js +0 -60
- package/test/test/util/dash_parser_util.js +0 -329
- package/test/test/util/fake_ad.js +0 -321
- package/test/test/util/fake_ad_manager.js +0 -122
- package/test/test/util/fake_demo_main.js +0 -144
- package/test/test/util/fake_drm_engine.js +0 -103
- package/test/test/util/fake_media_source_engine.js +0 -464
- package/test/test/util/fake_networking_engine.js +0 -381
- package/test/test/util/fake_segment_prefetch.js +0 -84
- package/test/test/util/fake_text_displayer.js +0 -60
- package/test/test/util/id3_generator.js +0 -100
- package/test/test/util/indexeddb_utils.js +0 -124
- package/test/test/util/jasmine_fetch.js +0 -382
- package/test/test/util/layout_tests.js +0 -435
- package/test/test/util/loader.js +0 -88
- package/test/test/util/manifest_generator.js +0 -705
- package/test/test/util/manifest_parser_util.js +0 -101
- package/test/test/util/mss_parser_util.js +0 -119
- package/test/test/util/offline_utils.js +0 -105
- package/test/test/util/simple_fakes.js +0 -535
- package/test/test/util/stream_generator.js +0 -676
- package/test/test/util/streaming_engine_util.js +0 -506
- package/test/test/util/test_scheme.js +0 -778
- package/test/test/util/ttml_utils.js +0 -77
- package/test/test/util/ui_utils.js +0 -183
- package/test/test/util/util.js +0 -374
- package/test/test/util/waiter.js +0 -406
- package/test/text/cue_integration.js +0 -51
- package/test/text/lrc_text_parser_unit.js +0 -98
- package/test/text/mp4_ttml_parser_unit.js +0 -171
- package/test/text/mp4_vtt_parser_unit.js +0 -195
- package/test/text/sbv_text_parser_unit.js +0 -81
- package/test/text/simple_text_displayer_unit.js +0 -468
- package/test/text/srt_text_parser_unit.js +0 -163
- package/test/text/ssa_text_parser_unit.js +0 -382
- package/test/text/text_displayer_layout_unit.js +0 -323
- package/test/text/text_engine_unit.js +0 -500
- package/test/text/text_track_integration.js +0 -186
- package/test/text/ttml_text_parser_unit.js +0 -2176
- package/test/text/ui_text_displayer_unit.js +0 -608
- package/test/text/vtt_text_parser_unit.js +0 -1363
- package/test/text/web_vtt_generator_unit.js +0 -144
- package/test/text/web_vtt_layout_integration.js +0 -524
- package/test/transmuxer/transmuxer_engine_integration.js +0 -69
- package/test/transmuxer/transmuxer_integration.js +0 -443
- package/test/ui/ad_ui_unit.js +0 -369
- package/test/ui/localization_unit.js +0 -508
- package/test/ui/ui_customization_unit.js +0 -208
- package/test/ui/ui_integration.js +0 -669
- package/test/ui/ui_unit.js +0 -902
- package/test/util/abortable_operation_unit.js +0 -624
- package/test/util/array_utils_unit.js +0 -58
- package/test/util/buffer_utils_unit.js +0 -185
- package/test/util/cmcd_manager_unit.js +0 -440
- package/test/util/content_steering_manager_unit.js +0 -427
- package/test/util/data_view_reader_unit.js +0 -254
- package/test/util/ebml_parser_unit.js +0 -297
- package/test/util/event_manager_unit.js +0 -185
- package/test/util/fake_event_target_unit.js +0 -123
- package/test/util/id3_utils_unit.js +0 -168
- package/test/util/iterables_unit.js +0 -68
- package/test/util/language_utils_unit.js +0 -240
- package/test/util/manifest_parser_utils_unit.js +0 -55
- package/test/util/mime_utils_unit.js +0 -64
- package/test/util/mp4_box_parsers_unit.js +0 -246
- package/test/util/mp4_parser_unit.js +0 -373
- package/test/util/multi_map_unit.js +0 -94
- package/test/util/object_utils_unit.js +0 -79
- package/test/util/periods_unit.js +0 -1623
- package/test/util/pssh_unit.js +0 -226
- package/test/util/state_history_unit.js +0 -101
- package/test/util/stream_utils_unit.js +0 -1068
- package/test/util/string_utils_unit.js +0 -166
- package/test/util/text_parser_unit.js +0 -165
- package/test/util/ts_parser_unit.js +0 -77
- package/test/util/xml_utils_unit.js +0 -444
|
@@ -1,674 +0,0 @@
|
|
|
1
|
-
/*! @license
|
|
2
|
-
* Shaka Player
|
|
3
|
-
* Copyright 2016 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
describe('Cea708Service', () => {
|
|
8
|
-
const CeaUtils = shaka.test.CeaUtils;
|
|
9
|
-
|
|
10
|
-
/** @type {!shaka.cea.Cea708Service} */
|
|
11
|
-
let service;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Hide window (2 bytes), with a bitmap provided to indicate all windows.
|
|
15
|
-
* @type {!Array<number>}
|
|
16
|
-
*/
|
|
17
|
-
const hideWindow = [0x8a, 0xff];
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Define window (7 bytes), defines window #0 to be a visible window
|
|
21
|
-
* with 32 rows and 32 columns. (We specify 31 for each since decoder adds 1).
|
|
22
|
-
* @type {!Array<number>}
|
|
23
|
-
*/
|
|
24
|
-
const defineWindow = [
|
|
25
|
-
0x98, 0x38, 0x00, 0x00, 0x1f, 0x1f, 0x00,
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
/** @type {number} */
|
|
29
|
-
const startTime = 1;
|
|
30
|
-
|
|
31
|
-
/** @type {number} */
|
|
32
|
-
const endTime = 2;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* We arbitrarily pick service 1 for all of these tests.
|
|
36
|
-
* @type {number}
|
|
37
|
-
*/
|
|
38
|
-
const serviceNumber = 1;
|
|
39
|
-
|
|
40
|
-
/** @type {string} */
|
|
41
|
-
const stream = `svc${serviceNumber}`;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Takes in a array of bytes and a presentation timestamp (in seconds),
|
|
45
|
-
* and converts it into a CEA-708 DTVCC Packet.
|
|
46
|
-
* @param {!Array<number>} bytes
|
|
47
|
-
* @param {number} pts
|
|
48
|
-
*/
|
|
49
|
-
const createCea708PacketFromBytes = (bytes, pts) => {
|
|
50
|
-
const cea708Bytes = bytes.map((code, i) => {
|
|
51
|
-
return {
|
|
52
|
-
pts,
|
|
53
|
-
type: shaka.cea.DtvccPacketBuilder.DTVCC_PACKET_DATA,
|
|
54
|
-
value: code,
|
|
55
|
-
order: i,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
return new shaka.cea.DtvccPacket(cea708Bytes);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Takes in a CEA-708 service and array of 708 packets with control codes,
|
|
63
|
-
* and returns all the captions inside of them, using the service to decode.
|
|
64
|
-
* @param {!shaka.cea.Cea708Service} service
|
|
65
|
-
* @param {...!shaka.cea.DtvccPacket} packets
|
|
66
|
-
*/
|
|
67
|
-
const getCaptionsFromPackets = (service, ...packets) => {
|
|
68
|
-
const captions = [];
|
|
69
|
-
for (const packet of packets) {
|
|
70
|
-
while (packet.hasMoreData()) {
|
|
71
|
-
const caption = service.handleCea708ControlCode(packet);
|
|
72
|
-
if (caption) {
|
|
73
|
-
captions.push(caption);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return captions;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
beforeEach(() => {
|
|
81
|
-
service = new shaka.cea.Cea708Service(serviceNumber);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
it('decodes regular unstyled caption text', () => {
|
|
85
|
-
const controlCodes = [
|
|
86
|
-
...defineWindow,
|
|
87
|
-
// Series of G0 control codes that add text.
|
|
88
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
89
|
-
];
|
|
90
|
-
|
|
91
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
92
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
93
|
-
|
|
94
|
-
const text = 'test';
|
|
95
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
96
|
-
topLevelCue.nestedCues = [
|
|
97
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
98
|
-
];
|
|
99
|
-
|
|
100
|
-
const expectedCaptions = [
|
|
101
|
-
{
|
|
102
|
-
stream,
|
|
103
|
-
cue: topLevelCue,
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
108
|
-
expect(captions).toEqual(expectedCaptions);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('setPenLocation sets the pen location correctly', () => {
|
|
112
|
-
const controlCodes = [
|
|
113
|
-
...defineWindow,
|
|
114
|
-
// Series of G0 control codes that add text.
|
|
115
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
116
|
-
|
|
117
|
-
// SetPenLocation command to move the pen to (2, 0)
|
|
118
|
-
0x92, 0x02, 0x00,
|
|
119
|
-
|
|
120
|
-
// Series of G0 control codes that add text.
|
|
121
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
122
|
-
];
|
|
123
|
-
|
|
124
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
125
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
126
|
-
|
|
127
|
-
// After decoding, the buffer should look like this (omitting null cells).
|
|
128
|
-
// [0]: test
|
|
129
|
-
// [1]:
|
|
130
|
-
// [2]: test
|
|
131
|
-
const text = 'test';
|
|
132
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
133
|
-
topLevelCue.nestedCues = [
|
|
134
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
135
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
136
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
137
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
138
|
-
];
|
|
139
|
-
|
|
140
|
-
const expectedCaptions = [
|
|
141
|
-
{
|
|
142
|
-
stream,
|
|
143
|
-
cue: topLevelCue,
|
|
144
|
-
},
|
|
145
|
-
];
|
|
146
|
-
|
|
147
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
148
|
-
expect(captions).toEqual(expectedCaptions);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('setPenAttributes sets underline and italics correctly', () => {
|
|
152
|
-
const controlCodes = [
|
|
153
|
-
...defineWindow,
|
|
154
|
-
// Series of G0 control codes that add text.
|
|
155
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
156
|
-
|
|
157
|
-
// setPenAttributes. First byte is a "don't care", since this
|
|
158
|
-
// decoder ignores it. First 2 bits of second byte are italics
|
|
159
|
-
// and underline toggles. Turn on italics + underline.
|
|
160
|
-
0x90, 0x00, 0xc0,
|
|
161
|
-
|
|
162
|
-
// Series of G0 control codes that add text.
|
|
163
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
164
|
-
|
|
165
|
-
// setPenAttributes. Turn off italics + underline.
|
|
166
|
-
0x90, 0x00, 0x00,
|
|
167
|
-
|
|
168
|
-
// Series of G0 control codes that add text.
|
|
169
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
170
|
-
];
|
|
171
|
-
|
|
172
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
173
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
174
|
-
|
|
175
|
-
// Three nested cues, where the middle one should be underlined+italicized.
|
|
176
|
-
const text = 'test';
|
|
177
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
178
|
-
topLevelCue.nestedCues = [
|
|
179
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
180
|
-
CeaUtils.createStyledCue(
|
|
181
|
-
startTime, endTime, text,
|
|
182
|
-
/* underline= */ true, /* italics= */ true,
|
|
183
|
-
/* textColor= */ shaka.cea.CeaUtils.DEFAULT_TXT_COLOR,
|
|
184
|
-
/* backgroundColor= */ shaka.cea.CeaUtils.DEFAULT_BG_COLOR),
|
|
185
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
186
|
-
];
|
|
187
|
-
|
|
188
|
-
const expectedCaptions = [
|
|
189
|
-
{
|
|
190
|
-
stream,
|
|
191
|
-
cue: topLevelCue,
|
|
192
|
-
},
|
|
193
|
-
];
|
|
194
|
-
|
|
195
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
196
|
-
expect(captions).toEqual(expectedCaptions);
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it('setPenColor sets foreground and background color correctly', () => {
|
|
200
|
-
const controlCodes = [
|
|
201
|
-
...defineWindow,
|
|
202
|
-
// Series of G0 control codes that add text.
|
|
203
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
204
|
-
|
|
205
|
-
// setPenColor (4 bytes). Last 6 bits of byte 2 are R,G,B for foreground.
|
|
206
|
-
// Last 6 bits of byte 3 are R,G,B for background. This decoder ignores
|
|
207
|
-
// byte 4 which is edge color, so it's a "don't care".
|
|
208
|
-
0x91, 0x30, 0x33, 0x00, // Red foreground, magenta background.
|
|
209
|
-
|
|
210
|
-
// Series of G0 control codes that add text.
|
|
211
|
-
0x63, 0x6f, 0x6c, 0x6f, 0x72, // c, o, l, o, r
|
|
212
|
-
];
|
|
213
|
-
|
|
214
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
215
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
216
|
-
|
|
217
|
-
// Two nested cues, the second one should have colors.
|
|
218
|
-
const text1 = 'test';
|
|
219
|
-
const text2 = 'color';
|
|
220
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
221
|
-
topLevelCue.nestedCues = [
|
|
222
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text1),
|
|
223
|
-
CeaUtils.createStyledCue(
|
|
224
|
-
startTime, endTime, text2,
|
|
225
|
-
/* underline= */ false, /* italics= */ false,
|
|
226
|
-
/* textColor= */ 'red', /* backgroundColor= */ 'magenta'),
|
|
227
|
-
];
|
|
228
|
-
|
|
229
|
-
const expectedCaptions = [
|
|
230
|
-
{
|
|
231
|
-
stream,
|
|
232
|
-
cue: topLevelCue,
|
|
233
|
-
},
|
|
234
|
-
];
|
|
235
|
-
|
|
236
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
237
|
-
expect(captions).toEqual(expectedCaptions);
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
it('handles special characters from the G0, G1, G2, and G3 groups', () => {
|
|
241
|
-
const controlCodes = [
|
|
242
|
-
...defineWindow,
|
|
243
|
-
// Series of G0 text control code
|
|
244
|
-
0x7f, // A musical note, the only exception the G0 table has to ASCII.
|
|
245
|
-
|
|
246
|
-
// setPenLocation (1, 0) to go to next row.
|
|
247
|
-
0x92, 0x01, 0x00,
|
|
248
|
-
|
|
249
|
-
// Series of G1 control codes that add text.
|
|
250
|
-
0xa9, 0xb6, 0xf7, // ©, ¶, ÷
|
|
251
|
-
|
|
252
|
-
// setPenLocation (2, 0) to go to next row.
|
|
253
|
-
0x92, 0x02, 0x00,
|
|
254
|
-
|
|
255
|
-
// Series of G2 control codes that add text.
|
|
256
|
-
0x1079, 0x107b, 0x1039, // ⅞, ┐, ™
|
|
257
|
-
|
|
258
|
-
// setPenLocation (3, 0) to go to next row.
|
|
259
|
-
0x92, 0x03, 0x00,
|
|
260
|
-
|
|
261
|
-
// G3 control code.
|
|
262
|
-
0x10a0, // As of CEA-708-E, there is only 1 char in G3, on 0xa0.
|
|
263
|
-
];
|
|
264
|
-
|
|
265
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
266
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
267
|
-
|
|
268
|
-
const text1 = '♪';
|
|
269
|
-
const text2 = '©¶÷';
|
|
270
|
-
const text3 = '⅞┐™';
|
|
271
|
-
const text4 = '[CC]';
|
|
272
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
273
|
-
topLevelCue.nestedCues = [
|
|
274
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text1),
|
|
275
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
276
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text2),
|
|
277
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
278
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text3),
|
|
279
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
280
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text4),
|
|
281
|
-
];
|
|
282
|
-
|
|
283
|
-
const expectedCaptions = [
|
|
284
|
-
{
|
|
285
|
-
stream,
|
|
286
|
-
cue: topLevelCue,
|
|
287
|
-
},
|
|
288
|
-
];
|
|
289
|
-
|
|
290
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
291
|
-
expect(captions).toEqual(expectedCaptions);
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
it('adds an underline for unsupported chars from the G2/G3 groups', () => {
|
|
295
|
-
const controlCodes = [
|
|
296
|
-
...defineWindow,
|
|
297
|
-
// Series of G2 control codes that add text.
|
|
298
|
-
0x1036, 0x103c, 0x1070, // unsupported, œ, unsupported
|
|
299
|
-
|
|
300
|
-
// setPenLocation (1, 0) to go to next row.
|
|
301
|
-
0x92, 0x01, 0x00,
|
|
302
|
-
|
|
303
|
-
// Series of G3 control codes that add text.
|
|
304
|
-
0x10a0, 0x10a1, 0x10db, // [CC], unsupported, unsupported
|
|
305
|
-
];
|
|
306
|
-
|
|
307
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
308
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
309
|
-
|
|
310
|
-
// Some of the characters are unsupported as of CEA-708-E, so they should
|
|
311
|
-
// be replaced by an underline.
|
|
312
|
-
const text1 = '_œ_';
|
|
313
|
-
const text2 = '[CC]__';
|
|
314
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
315
|
-
topLevelCue.nestedCues = [
|
|
316
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text1),
|
|
317
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
318
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text2),
|
|
319
|
-
];
|
|
320
|
-
|
|
321
|
-
const expectedCaptions = [
|
|
322
|
-
{
|
|
323
|
-
stream,
|
|
324
|
-
cue: topLevelCue,
|
|
325
|
-
},
|
|
326
|
-
];
|
|
327
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
328
|
-
expect(captions).toEqual(expectedCaptions);
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
it('handles the reset command correctly', () => {
|
|
332
|
-
const controlCodes = [
|
|
333
|
-
...defineWindow,
|
|
334
|
-
// Series of G0 control codes that add text.
|
|
335
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
336
|
-
];
|
|
337
|
-
|
|
338
|
-
const resetControlCode = [0x8f];
|
|
339
|
-
|
|
340
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
341
|
-
const packet2 = createCea708PacketFromBytes(resetControlCode, endTime);
|
|
342
|
-
|
|
343
|
-
// The text in the current window should have been emitted, and then clear
|
|
344
|
-
// should have been called.
|
|
345
|
-
const text = 'test';
|
|
346
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
347
|
-
topLevelCue.nestedCues = [
|
|
348
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
349
|
-
];
|
|
350
|
-
|
|
351
|
-
const expectedCaptions = [
|
|
352
|
-
{
|
|
353
|
-
stream,
|
|
354
|
-
cue: topLevelCue,
|
|
355
|
-
},
|
|
356
|
-
];
|
|
357
|
-
|
|
358
|
-
spyOn(service, 'clear').and.callThrough();
|
|
359
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
360
|
-
expect(captions).toEqual(expectedCaptions);
|
|
361
|
-
expect(service.clear).toHaveBeenCalledTimes(1);
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
it('handles the setWindowAttributes command correctly', () => {
|
|
365
|
-
const controlCodes = [
|
|
366
|
-
...defineWindow,
|
|
367
|
-
// Series of G0 control codes that add text.
|
|
368
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
369
|
-
|
|
370
|
-
// Currently, setWindowAttributes is only used to justify text,
|
|
371
|
-
// as specified by the last 2 bits of the fourth byte. The
|
|
372
|
-
// other bytes after the first byte are "don't care".
|
|
373
|
-
0x97, 0x00, 0x00, 0x01, 0x00, // Justify right
|
|
374
|
-
];
|
|
375
|
-
|
|
376
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
377
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
378
|
-
|
|
379
|
-
// Right-justified text is expected.
|
|
380
|
-
const text = 'test';
|
|
381
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
382
|
-
topLevelCue.textAlign = shaka.text.Cue.textAlign.RIGHT;
|
|
383
|
-
topLevelCue.nestedCues = [
|
|
384
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
385
|
-
];
|
|
386
|
-
|
|
387
|
-
const expectedCaptions = [
|
|
388
|
-
{
|
|
389
|
-
stream,
|
|
390
|
-
cue: topLevelCue,
|
|
391
|
-
},
|
|
392
|
-
];
|
|
393
|
-
|
|
394
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
395
|
-
expect(captions).toEqual(expectedCaptions);
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
it('handles the carriage return command correctly', () => {
|
|
399
|
-
const controlCodes = [
|
|
400
|
-
...defineWindow,
|
|
401
|
-
// Series of G0 control codes that add text.
|
|
402
|
-
0x74, 0x65, // t, e,
|
|
403
|
-
|
|
404
|
-
// Carriage return.
|
|
405
|
-
0x0d,
|
|
406
|
-
|
|
407
|
-
// Series of G0 control codes that add text.
|
|
408
|
-
0x73, 0x74, // s, t
|
|
409
|
-
];
|
|
410
|
-
|
|
411
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
412
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
413
|
-
|
|
414
|
-
const text1 = 'te';
|
|
415
|
-
const text2 = 'st';
|
|
416
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
417
|
-
topLevelCue.nestedCues = [
|
|
418
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text1),
|
|
419
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
420
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text2),
|
|
421
|
-
];
|
|
422
|
-
|
|
423
|
-
const expectedCaptions = [
|
|
424
|
-
{
|
|
425
|
-
stream,
|
|
426
|
-
cue: topLevelCue,
|
|
427
|
-
},
|
|
428
|
-
];
|
|
429
|
-
|
|
430
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
431
|
-
expect(captions).toEqual(expectedCaptions);
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
it('handles the horizontal carriage return command correctly', () => {
|
|
435
|
-
const controlCodes = [
|
|
436
|
-
...defineWindow,
|
|
437
|
-
// Series of G0 control codes that add text.
|
|
438
|
-
0x74, 0x65, // t, e,
|
|
439
|
-
|
|
440
|
-
// setPenLocation (1, 0) to go to next row.
|
|
441
|
-
0x92, 0x01, 0x00,
|
|
442
|
-
|
|
443
|
-
// Series of G0 control codes that add text.
|
|
444
|
-
0x6d, 0x70, // m, p
|
|
445
|
-
|
|
446
|
-
// Horizontal Carriage return.
|
|
447
|
-
0x0e,
|
|
448
|
-
|
|
449
|
-
// Series of G0 control codes that add text.
|
|
450
|
-
0x73, 0x74, // s, t
|
|
451
|
-
];
|
|
452
|
-
|
|
453
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
454
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
455
|
-
|
|
456
|
-
// HCR wipes the row and moves the pen to the row start.
|
|
457
|
-
const text1 = 'te';
|
|
458
|
-
const text2 = 'st';
|
|
459
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
460
|
-
topLevelCue.nestedCues = [
|
|
461
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text1),
|
|
462
|
-
CeaUtils.createLineBreakCue(startTime, endTime),
|
|
463
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text2),
|
|
464
|
-
];
|
|
465
|
-
|
|
466
|
-
const expectedCaptions = [
|
|
467
|
-
{
|
|
468
|
-
stream,
|
|
469
|
-
cue: topLevelCue,
|
|
470
|
-
},
|
|
471
|
-
];
|
|
472
|
-
|
|
473
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
474
|
-
expect(captions).toEqual(expectedCaptions);
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
it('handles the ASCII backspace command correctly', () => {
|
|
478
|
-
const controlCodes = [
|
|
479
|
-
...defineWindow,
|
|
480
|
-
// Series of G0 control codes that add text.
|
|
481
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
482
|
-
|
|
483
|
-
// Backspace.
|
|
484
|
-
0x08,
|
|
485
|
-
];
|
|
486
|
-
|
|
487
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
488
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
489
|
-
|
|
490
|
-
// Backspace should have erased the last 't' in 'test'.
|
|
491
|
-
const text = 'tes';
|
|
492
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
493
|
-
topLevelCue.nestedCues = [
|
|
494
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
495
|
-
];
|
|
496
|
-
|
|
497
|
-
const expectedCaptions = [
|
|
498
|
-
{
|
|
499
|
-
stream,
|
|
500
|
-
cue: topLevelCue,
|
|
501
|
-
},
|
|
502
|
-
];
|
|
503
|
-
|
|
504
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
505
|
-
expect(captions).toEqual(expectedCaptions);
|
|
506
|
-
});
|
|
507
|
-
|
|
508
|
-
it('handles the ASCII form-feed command correctly', () => {
|
|
509
|
-
const controlCodes = [
|
|
510
|
-
...defineWindow,
|
|
511
|
-
// Series of G0 control codes that add text.
|
|
512
|
-
0x61, 0x62, // a, b,
|
|
513
|
-
|
|
514
|
-
// setPenLocation (1, 0) to go to next row.
|
|
515
|
-
0x92, 0x01, 0x00,
|
|
516
|
-
|
|
517
|
-
// Series of G0 control codes that add text.
|
|
518
|
-
0x62, 0x61, // b, a
|
|
519
|
-
|
|
520
|
-
// Form-feed.
|
|
521
|
-
0x0c,
|
|
522
|
-
|
|
523
|
-
// Series of G0 control codes that add text.
|
|
524
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
525
|
-
];
|
|
526
|
-
|
|
527
|
-
const packet1 = createCea708PacketFromBytes(controlCodes, startTime);
|
|
528
|
-
const packet2 = createCea708PacketFromBytes(hideWindow, endTime);
|
|
529
|
-
|
|
530
|
-
// The form feed control code would have wiped the entire window
|
|
531
|
-
// including new lines, and the text after is just 'test'.
|
|
532
|
-
const text = 'test';
|
|
533
|
-
const topLevelCue = new shaka.text.Cue(startTime, endTime, '');
|
|
534
|
-
topLevelCue.nestedCues = [
|
|
535
|
-
CeaUtils.createDefaultCue(startTime, endTime, /* payload= */ text),
|
|
536
|
-
];
|
|
537
|
-
|
|
538
|
-
const expectedCaptions = [
|
|
539
|
-
{
|
|
540
|
-
stream,
|
|
541
|
-
cue: topLevelCue,
|
|
542
|
-
},
|
|
543
|
-
];
|
|
544
|
-
|
|
545
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2);
|
|
546
|
-
|
|
547
|
-
expect(captions).toEqual(expectedCaptions);
|
|
548
|
-
});
|
|
549
|
-
|
|
550
|
-
it('handles C2 and C3 no-op control codes correctly', () => {
|
|
551
|
-
// As of CEA-708, the C2 and C3 control code group has no operations.
|
|
552
|
-
// However, the bytes are reserved for future modifications to the spec,
|
|
553
|
-
// and so the correct # of bytes should be skipped if they are seen.
|
|
554
|
-
const packets = [
|
|
555
|
-
// C2 control code data.
|
|
556
|
-
[0x1008, 0x00], // C2 Packet 1.
|
|
557
|
-
[0x1010, 0x00, 0x00], // C2 Packet 2.
|
|
558
|
-
[0x1018, 0x00, 0x00, 0x00], // C2 Packet 3.
|
|
559
|
-
|
|
560
|
-
// C3 control code data.
|
|
561
|
-
[0x1080, 0x00, 0x00, 0x00, 0x00], // C3 packet 1.
|
|
562
|
-
[0x1088, 0x00, 0x00, 0x00, 0x00, 0x00], // C3 packet 2.
|
|
563
|
-
];
|
|
564
|
-
const expectedSkips = [1, 2, 3, 4, 5]; // As per the CEA-708-E spec.
|
|
565
|
-
|
|
566
|
-
for (let i = 0; i < packets.length; i++) {
|
|
567
|
-
const packet = createCea708PacketFromBytes(packets[i], /* pts= */ 1);
|
|
568
|
-
spyOn(packet, 'skip');
|
|
569
|
-
getCaptionsFromPackets(service, packet);
|
|
570
|
-
expect(packet.skip).toHaveBeenCalledWith(expectedSkips[i]);
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
-
|
|
574
|
-
describe('handles commands that change the display of windows', () => {
|
|
575
|
-
const time1 = 1;
|
|
576
|
-
const time2 = 2;
|
|
577
|
-
const time3 = 4;
|
|
578
|
-
const time4 = 5;
|
|
579
|
-
const textControlCodes = [
|
|
580
|
-
// Series of G0 control codes that add text.
|
|
581
|
-
0x74, 0x65, 0x73, 0x74, // t, e, s, t
|
|
582
|
-
];
|
|
583
|
-
|
|
584
|
-
// These commands affect ALL windows, per the 0xff bitmap.
|
|
585
|
-
const toggleWindow = [0x8b, 0xff];
|
|
586
|
-
const displayWindow = [0x89, 0xff];
|
|
587
|
-
const deleteWindow = [0x8c, 0xff];
|
|
588
|
-
const clearWindow = [0x88, 0xff];
|
|
589
|
-
|
|
590
|
-
it('handles display, toggle, and delete commands on windows', () => {
|
|
591
|
-
// Define a visible window, add some text, and toggle it off,
|
|
592
|
-
// which should force the window to emit the caption, 'test'.
|
|
593
|
-
const packet1 = createCea708PacketFromBytes(defineWindow, time1);
|
|
594
|
-
const packet2 = createCea708PacketFromBytes(textControlCodes, time1);
|
|
595
|
-
const packet3 = createCea708PacketFromBytes(toggleWindow, time2);
|
|
596
|
-
|
|
597
|
-
// Window is now hidden. Turn it back on at time 3, and append
|
|
598
|
-
// more text to it.
|
|
599
|
-
const packet4 = createCea708PacketFromBytes(displayWindow, time3);
|
|
600
|
-
const packet5 = createCea708PacketFromBytes(textControlCodes, time3);
|
|
601
|
-
|
|
602
|
-
// Window is now being displayed. Delete all the windows.
|
|
603
|
-
// This should force the displayed window to emit the caption, 'testtest'.
|
|
604
|
-
const packet6 = createCea708PacketFromBytes(deleteWindow, time4);
|
|
605
|
-
|
|
606
|
-
const text1 = 'test';
|
|
607
|
-
const text2 = 'testtest';
|
|
608
|
-
const topLevelCue1 = new shaka.text.Cue(
|
|
609
|
-
/* startTime= */ time1, /* endTime= */ time2, '');
|
|
610
|
-
topLevelCue1.nestedCues = [
|
|
611
|
-
CeaUtils.createDefaultCue(
|
|
612
|
-
/* startTime= */ time1, /* endTime= */ time2, /* payload= */ text1),
|
|
613
|
-
];
|
|
614
|
-
|
|
615
|
-
const topLevelCue2 = new shaka.text.Cue(
|
|
616
|
-
/* startTime= */ time3, /* endTime= */ time4, '');
|
|
617
|
-
topLevelCue2.nestedCues = [
|
|
618
|
-
CeaUtils.createDefaultCue(
|
|
619
|
-
/* startTime= */ time3, /* endTime= */ time4, /* payload= */ text2),
|
|
620
|
-
];
|
|
621
|
-
|
|
622
|
-
const expectedCaptions = [
|
|
623
|
-
{
|
|
624
|
-
stream,
|
|
625
|
-
cue: topLevelCue1,
|
|
626
|
-
},
|
|
627
|
-
|
|
628
|
-
{
|
|
629
|
-
stream,
|
|
630
|
-
cue: topLevelCue2,
|
|
631
|
-
},
|
|
632
|
-
];
|
|
633
|
-
|
|
634
|
-
const captions = getCaptionsFromPackets(
|
|
635
|
-
service, packet1, packet2, packet3, packet4, packet5, packet6);
|
|
636
|
-
expect(captions).toEqual(expectedCaptions);
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
it('handles the clear command on a window', () => {
|
|
640
|
-
// Define a visible window, add text to it, and then clear it.
|
|
641
|
-
// This should emit a caption, since a visible window is being cleared.
|
|
642
|
-
const packet1 = createCea708PacketFromBytes(defineWindow, time1);
|
|
643
|
-
const packet2 = createCea708PacketFromBytes(textControlCodes, time1);
|
|
644
|
-
const packet3 = createCea708PacketFromBytes(clearWindow, time2);
|
|
645
|
-
|
|
646
|
-
// Display the window again, and then hide it. Although a visible window
|
|
647
|
-
// that turns off usually emits, this should NOT emit a caption, since
|
|
648
|
-
// the window contains nothing in it after the clear.
|
|
649
|
-
const packet4 = createCea708PacketFromBytes(displayWindow, time3);
|
|
650
|
-
const packet5 = createCea708PacketFromBytes(textControlCodes, time3);
|
|
651
|
-
const packet6 = createCea708PacketFromBytes(hideWindow, time1);
|
|
652
|
-
|
|
653
|
-
// Only one cue should have been emitted as per the explanation above.
|
|
654
|
-
const text = 'test';
|
|
655
|
-
const topLevelCue = new shaka.text.Cue(
|
|
656
|
-
/* startTime= */ time1, /* endTime= */ time2, '');
|
|
657
|
-
topLevelCue.nestedCues = [
|
|
658
|
-
CeaUtils.createDefaultCue(
|
|
659
|
-
/* startTime= */ time1, /* endTime= */ time2, /* payload= */ text),
|
|
660
|
-
];
|
|
661
|
-
|
|
662
|
-
const expectedCaptions = [
|
|
663
|
-
{
|
|
664
|
-
stream,
|
|
665
|
-
cue: topLevelCue,
|
|
666
|
-
},
|
|
667
|
-
];
|
|
668
|
-
|
|
669
|
-
const captions = getCaptionsFromPackets(service, packet1, packet2,
|
|
670
|
-
packet3, packet4, packet5, packet6);
|
|
671
|
-
expect(captions).toEqual(expectedCaptions);
|
|
672
|
-
});
|
|
673
|
-
});
|
|
674
|
-
});
|