shaka-player 4.4.3 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (198) hide show
  1. package/.github/workflows/release-please.yaml +2 -27
  2. package/CHANGELOG.md +64 -45
  3. package/README.md +16 -10
  4. package/demo/asset_card.js +18 -21
  5. package/demo/cast_receiver/index.html +0 -1
  6. package/demo/close_button.js +0 -3
  7. package/demo/common/asset.js +22 -5
  8. package/demo/common/assets.js +132 -49
  9. package/demo/config.js +192 -253
  10. package/demo/custom.js +39 -98
  11. package/demo/front.js +7 -10
  12. package/demo/index.html +19 -22
  13. package/demo/input.js +6 -11
  14. package/demo/input_container.js +8 -9
  15. package/demo/main.js +51 -123
  16. package/demo/search.js +22 -34
  17. package/demo/service_worker.js +0 -3
  18. package/demo/tooltip.js +3 -5
  19. package/demo/visualizer.js +3 -5
  20. package/demo/visualizer_button.js +1 -20
  21. package/dist/demo.compiled.debug.js +152 -178
  22. package/dist/demo.compiled.debug.map +4 -4
  23. package/dist/demo.compiled.js +152 -178
  24. package/dist/demo.compiled.map +4 -4
  25. package/dist/deps.js +27 -24
  26. package/dist/locales.js +31 -31
  27. package/dist/receiver.compiled.debug.js +22 -43
  28. package/dist/receiver.compiled.debug.map +4 -4
  29. package/dist/receiver.compiled.js +22 -43
  30. package/dist/receiver.compiled.map +4 -4
  31. package/dist/shaka-player.compiled.d.ts +507 -365
  32. package/dist/shaka-player.compiled.debug.d.ts +507 -365
  33. package/dist/shaka-player.compiled.debug.externs.js +205 -51
  34. package/dist/shaka-player.compiled.debug.js +541 -450
  35. package/dist/shaka-player.compiled.debug.map +4 -4
  36. package/dist/shaka-player.compiled.externs.js +205 -51
  37. package/dist/shaka-player.compiled.js +1120 -1066
  38. package/dist/shaka-player.compiled.map +4 -4
  39. package/dist/shaka-player.ui.d.ts +562 -410
  40. package/dist/shaka-player.ui.debug.d.ts +562 -410
  41. package/dist/shaka-player.ui.debug.externs.js +226 -51
  42. package/dist/shaka-player.ui.debug.js +606 -506
  43. package/dist/shaka-player.ui.debug.map +4 -4
  44. package/dist/shaka-player.ui.externs.js +226 -51
  45. package/dist/shaka-player.ui.js +1266 -1207
  46. package/dist/shaka-player.ui.map +4 -4
  47. package/docs/design/lcevc-integration.md +14 -14
  48. package/docs/tutorials/faq.md +27 -55
  49. package/docs/tutorials/index.json +2 -1
  50. package/docs/tutorials/lcevc.md +118 -0
  51. package/docs/tutorials/ui-customization.md +4 -0
  52. package/externs/css_style_declaration.js +19 -0
  53. package/externs/lcevc.js +37 -13
  54. package/externs/media_remote.js +68 -0
  55. package/externs/mediatailor.js +193 -0
  56. package/externs/pictureinpicture.js +11 -0
  57. package/externs/shaka/ads.js +27 -0
  58. package/externs/shaka/manifest.js +10 -5
  59. package/externs/shaka/manifest_parser.js +7 -1
  60. package/externs/shaka/offline.js +4 -0
  61. package/externs/shaka/player.js +12 -1
  62. package/karma.conf.js +7 -3
  63. package/lib/abr/simple_abr_manager.js +43 -3
  64. package/lib/ads/ad_manager.js +104 -50
  65. package/lib/ads/media_tailor_ad.js +297 -0
  66. package/lib/ads/media_tailor_ad_manager.js +828 -0
  67. package/lib/cea/ts_cea_parser.js +15 -2
  68. package/lib/config/codec_switching_strategy.js +24 -0
  69. package/lib/dash/content_protection.js +120 -2
  70. package/lib/dash/dash_parser.js +75 -12
  71. package/lib/dash/mpd_utils.js +10 -6
  72. package/lib/dash/segment_base.js +13 -5
  73. package/lib/dash/segment_list.js +13 -5
  74. package/lib/dash/segment_template.js +43 -85
  75. package/lib/dependencies/all.js +8 -7
  76. package/lib/hls/hls_parser.js +44 -16
  77. package/lib/lcevc/lcevc_dec.js +220 -0
  78. package/lib/media/adaptation_set.js +22 -11
  79. package/lib/media/adaptation_set_criteria.js +25 -7
  80. package/lib/media/media_source_engine.js +215 -27
  81. package/lib/media/segment_index.js +1 -1
  82. package/lib/media/segment_reference.js +7 -7
  83. package/lib/media/streaming_engine.js +33 -18
  84. package/lib/mss/mss_parser.js +1 -0
  85. package/lib/net/networking_engine.js +1 -0
  86. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  87. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  88. package/lib/offline/manifest_converter.js +1 -0
  89. package/lib/offline/storage.js +3 -0
  90. package/lib/player.js +142 -72
  91. package/lib/routing/payload.js +5 -1
  92. package/lib/text/cue.js +15 -0
  93. package/lib/text/ttml_text_parser.js +17 -0
  94. package/lib/text/ui_text_displayer.js +4 -0
  95. package/lib/text/vtt_text_parser.js +33 -20
  96. package/lib/transmuxer/h265.js +862 -0
  97. package/lib/transmuxer/mpeg_ts_transmuxer.js +3 -2
  98. package/lib/transmuxer/ts_transmuxer.js +160 -15
  99. package/lib/util/error.js +28 -9
  100. package/lib/util/exp_golomb.js +30 -2
  101. package/lib/util/fake_event.js +3 -0
  102. package/lib/util/mp4_generator.js +4 -4
  103. package/lib/util/periods.js +2 -0
  104. package/lib/util/platform.js +40 -0
  105. package/lib/util/player_configuration.js +8 -0
  106. package/lib/util/state_history.js +6 -2
  107. package/lib/util/stream_utils.js +133 -217
  108. package/lib/util/ts_parser.js +226 -40
  109. package/maintained-branches.md +3 -2
  110. package/package.json +4 -6
  111. package/roadmap.md +15 -5
  112. package/shaka-player.uncompiled.js +2 -1
  113. package/support.html +0 -1
  114. package/test/cast/cast_receiver_integration.js +47 -0
  115. package/test/codec_switching/codec_switching_integration.js +181 -0
  116. package/test/dash/dash_parser_content_protection_unit.js +2 -0
  117. package/test/dash/dash_parser_integration.js +73 -0
  118. package/test/dash/dash_parser_live_unit.js +2 -0
  119. package/test/dash/dash_parser_manifest_unit.js +42 -0
  120. package/test/dash/dash_parser_segment_base_unit.js +2 -0
  121. package/test/dash/dash_parser_segment_list_unit.js +2 -0
  122. package/test/dash/dash_parser_segment_template_unit.js +2 -0
  123. package/test/demo/demo_unit.js +0 -16
  124. package/test/hls/hls_live_unit.js +2 -0
  125. package/test/hls/hls_parser_unit.js +8 -6
  126. package/test/media/adaptation_set_criteria_unit.js +118 -0
  127. package/test/media/adaptation_set_unit.js +1 -0
  128. package/test/media/media_source_engine_unit.js +165 -1
  129. package/test/media/segment_index_unit.js +4 -4
  130. package/test/media/segment_prefetch_unit.js +1 -1
  131. package/test/media/streaming_engine_unit.js +17 -17
  132. package/test/mss/mss_parser_unit.js +2 -0
  133. package/test/offline/manifest_convert_unit.js +5 -0
  134. package/test/offline/storage_integration.js +1 -4
  135. package/test/player_unit.js +102 -131
  136. package/test/routing/walker_unit.js +1 -0
  137. package/test/test/assets/dash-aes-128/Fragments(video=0,format=mpd-time-csf) +0 -0
  138. package/test/test/assets/dash-aes-128/Fragments(video=20000000,format=mpd-time-csf) +0 -0
  139. package/test/test/assets/dash-aes-128/Fragments(video=40000000,format=mpd-time-csf) +0 -0
  140. package/test/test/assets/dash-aes-128/Fragments(video=60000000,format=mpd-time-csf) +0 -0
  141. package/test/test/assets/dash-aes-128/Fragments(video=i,format=mpd-time-csf) +0 -0
  142. package/test/test/assets/dash-aes-128/dash.mpd +18 -0
  143. package/test/test/assets/dash-aes-128/license +1 -0
  144. package/test/test/assets/dash-multi-codec/audio_en_2c_128k_aac.mp4 +0 -0
  145. package/test/test/assets/dash-multi-codec/audio_es_2c_64k_opus.webm +0 -0
  146. package/test/test/assets/dash-multi-codec/dash.mpd +32 -0
  147. package/test/test/assets/dash-multi-codec/video_144p_108k_h264.mp4 +0 -0
  148. package/test/test/assets/hls-ts-h265/0.ts +0 -0
  149. package/test/test/assets/hls-ts-h265/hevc.m3u8 +6 -0
  150. package/test/test/assets/hls-ts-h265/index.m3u8 +7 -0
  151. package/test/test/assets/hls-ts-muxed-aac-h265/0.ts +0 -0
  152. package/test/test/assets/hls-ts-muxed-aac-h265/1.ts +0 -0
  153. package/test/test/assets/hls-ts-muxed-aac-h265/media.m3u8 +9 -0
  154. package/test/test/assets/hls-ts-muxed-ac3-h264/media.m3u8 +24 -0
  155. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00000.ts +0 -0
  156. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00001.ts +0 -0
  157. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00002.ts +0 -0
  158. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00003.ts +0 -0
  159. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00004.ts +0 -0
  160. package/test/test/assets/hls-ts-muxed-ac3-h264/s_00005.ts +0 -0
  161. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0000.ts +0 -0
  162. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0001.ts +0 -0
  163. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0002.ts +0 -0
  164. package/test/test/assets/hls-ts-muxed-ec3-h264/ChID_voices_1280x720p_25fps_h264_6ch_256kbps_ddp_sub_0003.ts +0 -0
  165. package/test/test/assets/hls-ts-muxed-ec3-h264/prog_index.m3u8 +14 -0
  166. package/test/test/assets/hls-ts-muxed-mp3-h264/index.m3u8 +23 -0
  167. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-1-v1-a1.ts +0 -0
  168. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-2-v1-a1.ts +0 -0
  169. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-3-v1-a1.ts +0 -0
  170. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-4-v1-a1.ts +0 -0
  171. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-5-v1-a1.ts +0 -0
  172. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-6-v1-a1.ts +0 -0
  173. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-7-v1-a1.ts +0 -0
  174. package/test/test/assets/hls-ts-muxed-mp3-h264/seg-8-v1-a1.ts +0 -0
  175. package/test/test/util/dash_parser_util.js +4 -0
  176. package/test/test/util/fake_ad_manager.js +20 -0
  177. package/test/test/util/fake_media_source_engine.js +8 -2
  178. package/test/test/util/manifest_generator.js +7 -3
  179. package/test/test/util/mss_parser_util.js +4 -0
  180. package/test/test/util/offline_utils.js +1 -0
  181. package/test/test/util/streaming_engine_util.js +7 -4
  182. package/test/text/ttml_text_parser_unit.js +52 -0
  183. package/test/text/vtt_text_parser_unit.js +103 -31
  184. package/test/transmuxer/transmuxer_integration.js +117 -0
  185. package/test/ui/ui_unit.js +3 -10
  186. package/test/util/stream_utils_unit.js +208 -74
  187. package/ui/controls.js +125 -0
  188. package/ui/externs/ui.js +8 -1
  189. package/ui/pip_button.js +22 -120
  190. package/ui/remote_button.js +201 -0
  191. package/ui/ui.js +5 -2
  192. package/demo/common/message_ids.js +0 -309
  193. package/demo/locales/en.json +0 -288
  194. package/demo/locales/source.json +0 -1146
  195. package/externs/mux.js +0 -69
  196. package/lib/lcevc/lcevc_dil.js +0 -152
  197. package/lib/transmuxer/muxjs_transmuxer.js +0 -242
  198. package/test/transmuxer/muxjs_transmuxer_integration.js +0 -177
@@ -8,51 +8,51 @@ This article describes the V-Nova LCEVC Shaka Player integration.
8
8
  # LCEVC Integration
9
9
 
10
10
  ## Adding V-Nova required files
11
- ### Importing DIL - Decoder Integration Layer
11
+ ### Importing LCEVC Decoder
12
12
 
13
- V-Nova LCEVC DIL Libraries are included using the same approach that the other external libraries are currently using. The necessary V-Nova LCEVC DIL files need to be imported in the HTML page that is going to be used by Shaka Player to decode LCEVC. Checks are inplace that make sure the necessary objects are available.
13
+ V-Nova LCEVC Decoder Libraries are included using the same approach that the other external libraries are currently using. The necessary V-Nova LCEVC Decoder files need to be imported in the HTML page that is going to be used by Shaka Player to decode LCEVC. Checks are inplace that make sure the necessary objects are available.
14
14
 
15
- Npm package : <https://www.npmjs.com/package/lcevc_dil.js>
15
+ NPM package : <https://www.npmjs.com/package/lcevc_dec.js>
16
16
 
17
17
  ```javascript
18
18
  <!-- MPEG-5 Part2 LCEVC support is enabled by including this: -->
19
- <script defer src="../node_modules/lcevc_dil.js/dist/lcevc_dil.min.js"></script>
19
+ <script defer src="../node_modules/lcevc_dec.js/dist/lcevc_dec.min.js"></script>
20
20
  ```
21
21
 
22
- To allow the Closure compiler to use the objects and methods that are exported by the DIL.js a new `extern` is created.
22
+ To allow the Closure compiler to use the objects and methods that are exported by the LCEVCdec.js a new `extern` is created.
23
23
 
24
24
  ### Defining an Extern for LCEVC
25
25
 
26
- `externs/lcevc.js` exposes the functions from the LCEVC DIL library required for LCEVC Decoding.
26
+ `externs/lcevc.js` exposes the functions from the LCEVC Decoder library required for LCEVC Decoding.
27
27
 
28
28
  ## Integration point
29
29
 
30
- ### The shaka.lcevc.Dil class - (DIL : Decoder Integration Layer)
30
+ ### The shaka.lcevc.Dec class - (DEC : Decoder)
31
31
 
32
- The main logic of the LCEVC integration is located in the `lib/lcevc_dil.min.js` file. In this file the shaka.lcevc.Dil is exported to be used in the project. This class is in charge of creating the Dil object using the mentioned externs, checking if LCEVC DIL library is available, etc.
32
+ The main logic of the LCEVC integration is located in the `lib/lcevc_dec.min.js` file. In this file the shaka.lcevc.Dec is exported to be used in the project. This class is in charge of creating the Dec object using the mentioned externs, checking if LCEVC Decoder library is available, etc.
33
33
 
34
34
  ### Modifications in the player
35
35
 
36
36
  The shaka.Player class, defined in the `lib/player.js` file, is the main player object for Shaka Player. There is a setter function for setting up a `canvas` element that is received from the user.
37
37
  If shaka.ui is used the `canvas` is created in line with the video element in the same container overlaying the video element. If user provides a custom canvas using the setter function, The user is responsible for placing the canvas element in the desired position and resizing it.
38
38
 
39
- `shaka.externs.LcevcConfiguration` is added to the `playerConfiguration` that is used as configuration for the LCEVC DIL Library.
39
+ `shaka.externs.LcevcConfiguration` is added to the `playerConfiguration` that is used as configuration for the LCEVC Decoder Library.
40
40
 
41
- The Dil object is created in the `onLoad_()` event that is triggered when a new video is loaded in Shaka Player. Attaching to a media element is defined as:
41
+ The Dec object is created in the `onLoad_()` event that is triggered when a new video is loaded in Shaka Player. Attaching to a media element is defined as:
42
42
 
43
43
  - Registering error listeners to the media element.
44
44
  - Catching the video element for use outside of the load graph.
45
45
 
46
- The Dil object is created only if LCEVC is supported (LCEVC libs are loaded on the page) and also when it was not already created in another `onLoad_()` event execution.
46
+ The LCEVC Decoder object is created only if LCEVC is supported (LCEVC libs are loaded on the page) and also when it was not already created in another `onLoad_()` event execution.
47
47
 
48
48
 
49
- ### Feeding the Dil
49
+ ### Feeding the Dec
50
50
 
51
51
  The logic that Shaka Player uses to communicate with the Media Source Extensions (MSE) is located in the `media/media_source_engine.js` file.
52
52
 
53
53
  ![image.png](lcevc-architecture.png)
54
54
 
55
- `append_()` function that is used to feed the MSE Source Buffer is intercepted and modified to pass the video buffers to the LCEVC DIL Libraries before appending to the MSE Source Buffers.
55
+ `append_()` function that is used to feed the MSE Source Buffer is intercepted and modified to pass the video buffers and related time offsets to the LCEVC Decoder Libraries before appending to the MSE Source Buffers.
56
56
 
57
57
  ## Demo page
58
58
 
@@ -60,7 +60,7 @@ The relevant libraries are added in the Demo Page like so:
60
60
 
61
61
  ```javascript
62
62
  <!-- MPEG-5 Part2 LCEVC support is enabled by including this: -->
63
- <script defer src="../node_modules/lcevc_dil.js/dist/lcevc_dil.min.js"></script>
63
+ <script defer src="../node_modules/lcevc_dec.js/dist/lcevc_dec.min.js"></script>
64
64
  ```
65
65
 
66
66
  And a new video sample with enhancement data is added to the `demo/common/assets.js` file under a new source `MPEG-5 Part 2 LCEVC`.
@@ -95,31 +95,6 @@ you see JSON, you will need to [unwrap the response][wrapping].
95
95
 
96
96
  <hr>
97
97
 
98
- **Q:** Why doesn't getStats() work in Safari?
99
-
100
- **A:** To play HLS content on Safari, we default to using Apple's native src=
101
- playback. Since the browser handles playback, we don't get much information.
102
-
103
- If you want to disable native playback and use MediaSource playback instead,
104
- configure {@link shaka.extern.StreamingConfiguration|
105
- `.streaming.useNativeHlsOnSafari`} to false.
106
-
107
- <hr>
108
-
109
- **Q:** Why doesn't my HLS content work?
110
-
111
- **A:** If your HLS content uses MPEG2-TS, you may need to enable transmuxing.
112
- The only browsers capable of playing TS natively are Edge and Chromecast. You
113
- will get a `CONTENT_UNSUPPORTED_BY_BROWSER` error on other browsers due to
114
- their lack of TS support.
115
-
116
- You can enable transmuxing by [including mux.js][] v5.6.3+ in your application.
117
- If Shaka Player detects that mux.js has been loaded, we will use it to transmux
118
- TS content into MP4 on-the-fly, so that the content can be played by the
119
- browser.
120
-
121
- <hr>
122
-
123
98
  **Q:** Why does it take so long to switch to HD?
124
99
 
125
100
  **A:** When Shaka Player's `AbrManager` makes a decision to adapt, we don't
@@ -158,26 +133,18 @@ shaka.net.NetworkingEngine.registerScheme('file', shaka.net.HttpXHRPlugin.parse)
158
133
 
159
134
  <hr>
160
135
 
161
- **Q:** Why are my CEA-708 captions not showing on Edge or Chromecast?
162
-
163
- **A:** Our support for CEA-708 captions requires transmuxing the TS files that
164
- contain said captions. Edge and Chromecast, however, have native TS support and
165
- thus are not required to transmux.
166
- In order to force those platforms to transmux, set the
167
- {@link shaka.extern.StreamingConfiguration|`.streaming.forceTransmux`}
168
- configuration to true.
169
-
170
- <hr>
171
-
172
136
  **Q:** Why do I get 404 errors with very large timescales?
173
137
 
174
- **A:** We can't handle content that creates timestamps too large to be
175
- represented as Numbers in JavaScript (2^53). Very large timescales require very
176
- large timestamps (in timescale units), which means we are unable to substitute
177
- the correct values for `$Time$` in a `<SegmentTemplate>`. [BigInteger.js][] is
178
- too large to become a required dependency for Shaka Player.
138
+ **A:** Some content creates timestamps too large to be represented as Numbers
139
+ in JavaScript (2^53). Very large timescales require very large timestamps (in
140
+ timescale units), which means we are unable to substitute the correct values
141
+ for `$Time$` in a `<SegmentTemplate>`.
142
+
143
+ We can work around this for platforms that support [`BigInt`][], or in cases
144
+ where we can live with a rounding error (not `$Time$` in `<SegmentTemplate>`).
179
145
 
180
- We recommend reducing your timescale or avoiding `$Time` in `<SegmentTemplate>`.
146
+ If you must use `$Time` in `<SegmentTemplate>` and you must play on devices
147
+ that do not support [`BigInt`][], we recommend reducing your timescale.
181
148
  See discussion in [#1667][1667] for details.
182
149
 
183
150
  <hr>
@@ -202,20 +169,23 @@ you can use the same top-level APIs; but we are dependent on the browser
202
169
  handling the streaming. So we won't support DASH on iOS since the browser
203
170
  doesn't support it.
204
171
 
205
- We have another project called [Shaka Player Embedded][] that offers the same
206
- features and similar APIs for native apps on iOS. This project uses its own
207
- media stack, which allows it to play content that would otherwise not be
208
- supported. This supports both DASH and HLS manifests.
172
+ In a future version, we plan to support `ManagedMediaSource` on iOS to achieve
173
+ control over both DASH and HLS playback on iOS. See [#5271][] and the
174
+ [`ManagedMediaSource` W3C spec proposal][]
209
175
 
210
176
  <hr>
211
177
 
212
178
  **Q:** The Nightly Demo isn't loading for me!
213
179
 
214
180
  **A:** Are you looking at the uncompiled build with an AdBlocker enabled?
215
- We're rolling out ad support which is triggering some ad blockers to block
216
- requests for some of our source files. This only affects the uncompiled build.
181
+
182
+ Some ad blockers decide to block requests for some of our source files simply
183
+ because they have `ad` in the file name. This only affects the uncompiled
184
+ build.
185
+
217
186
  Switch to the compiled build (add "build=compiled" to the url) or temporarily
218
- disable your ad blocker to see the nightly uncompiled mode.
187
+ disable your ad blocker to see the nightly in uncompiled mode.
188
+
219
189
  Please note that if you want to test our ad logic, you might have to disable
220
190
  the ad blocker in compiled mode as well.
221
191
 
@@ -243,11 +213,11 @@ an HLS manifest, we do our best to guess what the codecs might be, but those
243
213
  guesses might not always be accurate. If an HLS manifest has no codec
244
214
  information provided, we default to guessing that the video codec is
245
215
  `avc1.42E01E` and the audio codec is `mp4a.40.2`, which can cause problems if
246
- the stream is actually video-only or audio-only. In this case, you can enable
247
- the {@link shaka.extern.ManifestConfiguration|`.manifest.disableVideo`} or
248
- {@link shaka.extern.ManifestConfiguration|`.manifest.disableAudio`}
249
- configurations to signal that your content does not have a video or audio
250
- stream.
216
+ the stream is actually video-only or audio-only.
217
+
218
+ To change our default assumptions about codecs in HLS, please see
219
+ {@link shaka.extern.HlsManifestConfiguration|`.manifest.hls`} in the player
220
+ config.
251
221
 
252
222
  <hr>
253
223
 
@@ -269,8 +239,10 @@ proxy them.
269
239
  [887]: https://github.com/shaka-project/shaka-player/issues/887
270
240
  [999]: https://github.com/shaka-project/shaka-player/issues/999
271
241
  [1667]: https://github.com/shaka-project/shaka-player/issues/1667
272
- [BigInteger.js]: https://github.com/peterolson/BigInteger.js
242
+ [#5271]: https://github.com/shaka-project/shaka-player/issues/5271
243
+ [BigInt]: https://caniuse.com/bigint
273
244
  [CORS]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
245
+ [`ManagedMediaSource` W3C spec proposal]: https://github.com/w3c/media-source/issues/320
274
246
  [Shaka Player Embedded]: https://github.com/shaka-project/shaka-player-embedded
275
247
  [auth]: https://shaka-player-demo.appspot.com/docs/api/tutorial-license-server-auth.html
276
248
  [buffering]: https://shaka-player-demo.appspot.com/docs/api/tutorial-network-and-buffering-config.html
@@ -24,5 +24,6 @@
24
24
  { "selenium-grid-config": { "title": "Selenium Grid Config" } },
25
25
  { "faq": { "title": "Frequently Asked Questions" } },
26
26
  { "upgrade": { "title": "Upgrade Guide" } },
27
- { "upgrade-manifest": { "title": "ManifestParser Upgrade Guide" } }
27
+ { "upgrade-manifest": { "title": "ManifestParser Upgrade Guide" } },
28
+ { "lcevc": { "title": "LCEVC Quick Start" } }
28
29
  ]
@@ -0,0 +1,118 @@
1
+ # LCEVC Quick Start
2
+
3
+ #### Requirements
4
+
5
+ - Only supported on browsers with Media Source Extensions SourceBuffer support
6
+
7
+ - MPEG-5 Part2 LCEVC decoding support (decoding provided by [lcevc_dec.js][],
8
+ must be separately included)
9
+
10
+ ##### Integration documentation : [docs](../design/lcevc-integration.md)
11
+
12
+ ##### More on [MPEG-5 Part2 LCEVC][]
13
+
14
+ [lcevc_dec.js]: https://www.npmjs.com/package/lcevc_dec.js?activeTab=readme
15
+ [MPEG-5 Part2 LCEVC]: https://www.lcevc.org
16
+
17
+ #### Configure LCEVC
18
+
19
+ LCEVC Decoder library needs to be included in the HTML page:
20
+
21
+ - Local `npm install lcevc_dec.js`
22
+ ```html
23
+ <script src="../node_modules/lcevc_dec.js/dist/lcevc_dec.min.js"></script>
24
+ ```
25
+ - Or use `unpkg.com` for latest LCEVC Decoder libraries.
26
+ ```html
27
+ <script src="https://unpkg.com/lcevc_dec.js@1.0.0/dist/lcevc_dec.min.js"></script>
28
+ ```
29
+
30
+ Configuration to enable LCEVC enhancement:
31
+ ```js
32
+ player.configure('lcevc.enabled', true);
33
+ ```
34
+
35
+ #### LCEVC setup via UI library
36
+
37
+ Sample setup using the Shaka Player UI library:
38
+
39
+ ```html
40
+ <!DOCTYPE html>
41
+ <html>
42
+ <head>
43
+ <!-- Shaka Player UI compiled library and default CSS for player controls: -->
44
+ <script src="dist/shaka-player.ui.js"></script>
45
+ <link rel="stylesheet" href="dist/controls.css" />
46
+
47
+ <!-- LCEVC decoder compiled library -->
48
+ <script src="https://unpkg.com/lcevc_dec.js@1.0.0/dist/lcevc_dec.min.js"></script>
49
+
50
+ <!-- Application source: -->
51
+ <script src="app.js"></script>
52
+ </head>
53
+
54
+ <body>
55
+ <!-- The data-shaka-player-container tag will make the UI library place the controls in this div. -->
56
+ <div data-shaka-player-container style="max-width:40em">
57
+ <!-- The data-shaka-player tag will make the UI library use this video element. -->
58
+ <video data-shaka-player id="video" style="width:100%;height:100%"></video>
59
+ </div>
60
+ </body>
61
+ </html>
62
+ ```
63
+
64
+ ```js
65
+ // app.js
66
+
67
+ const manifestUri = 'https://dyctis843rxh5.cloudfront.net/vnIAZIaowG1K7qOt/master.m3u8';
68
+
69
+ // Initialise Shaka Player with LCEVC enhancement.
70
+ async function init() {
71
+ // When using the UI, the player is made automatically by the UI object.
72
+ const video = document.getElementById('video');
73
+ const ui = video['ui'];
74
+ const controls = ui.getControls();
75
+ const player = controls.getPlayer();
76
+
77
+ // Enable the LCEVC enhancement.
78
+ player.configure('lcevc.enabled', true);
79
+
80
+ // Listen for error events.
81
+ player.addEventListener('error', onError);
82
+ controls.addEventListener('error', onError);
83
+
84
+ // Try to load a manifest.
85
+ // This is an asynchronous process.
86
+ try {
87
+ await player.load(manifestUri);
88
+ // This runs if the asynchronous load is successful.
89
+ console.log('The video has now been loaded!');
90
+ } catch (error) {
91
+ onError(error);
92
+ }
93
+ }
94
+
95
+ // Handle errors.
96
+ function onError(error) {
97
+ console.error('Error', error);
98
+ }
99
+
100
+ // Listen to the custom shaka-ui-loaded event, to wait until the UI is loaded.
101
+ document.addEventListener('shaka-ui-loaded', init);
102
+ // Listen to the custom shaka-ui-load-failed event, in case Shaka Player fails
103
+ // to load (e.g. due to lack of browser support).
104
+ document.addEventListener('shaka-ui-load-failed', onError);
105
+
106
+ ```
107
+
108
+ #### User provided canvas
109
+
110
+ User can also provide a canvas to the player though `attachCanvas` function:
111
+
112
+ ```js
113
+ player.attachCanvas(canvas);
114
+ ```
115
+
116
+ Note: If external canvas is used, user is responsible for managing
117
+ the canvas. If no canvas is provided for Shaka UI library, the player
118
+ will generate and manage the canvas.
@@ -68,6 +68,8 @@ The following elements can be added to the UI bar using this configuration value
68
68
  supports AirPlay.
69
69
  * cast: adds a button that opens a Chromecast dialog. The button is visible only if there is
70
70
  at least one Chromecast device on the same network available for casting.
71
+ * remote: adds a button that opens a Remote Playback dialog. The button is visible only if the
72
+ browser supports Remote Playback API.
71
73
  * quality: adds a button that controls enabling/disabling of abr and video resolution selection.
72
74
  * language: adds a button that controls audio language selection.
73
75
  * playback_rate: adds a button that controls the playback rate selection.
@@ -91,6 +93,8 @@ The following buttons can be added to the overflow menu:
91
93
  * playback_rate: adds a button that controls the playback rate selection.
92
94
  * airplay: adds a button that opens a AirPlay dialog. The button is visible only if the browser
93
95
  supports AirPlay.
96
+ * remote: adds a button that opens a Remote Playback dialog. The button is visible only if the
97
+ browser supports Remote Playback API.
94
98
  * Statistics: adds a button that displays statistics of the video.
95
99
  <!-- TODO: If we add more buttons that can be put in the order this way, list them here. -->
96
100
 
@@ -0,0 +1,19 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+
8
+ /**
9
+ * @fileoverview Externs for CSSStyleDeclaration properties not in the
10
+ * Closure compiler.
11
+ *
12
+ * @externs
13
+ */
14
+
15
+
16
+ /**
17
+ * @type {string}
18
+ */
19
+ CSSStyleDeclaration.prototype.textCombineUpright;
package/externs/lcevc.js CHANGED
@@ -1,25 +1,27 @@
1
1
  /**
2
- * @fileoverview Externs for LcevcDil
2
+ * @fileoverview Externs for LcevcDec
3
3
  * compiler.
4
4
  *
5
5
  * @externs
6
6
  */
7
7
 
8
- // This empty namespace is declared to check if LcevcDil libraries are loaded.
8
+ // This empty namespace is declared to check if LcevcDec libraries are loaded.
9
+ /** @const */
9
10
  var libDPIModule = {};
10
- var LcevcDil = {};
11
+ /** @const */
12
+ var LCEVCdec = {};
11
13
 
12
14
  /**
13
- * LCEVC DIL constructor
15
+ * LCEVC Dec constructor
14
16
  * @constructor
15
17
  */
16
- LcevcDil.LcevcDIL = class {
18
+ LCEVCdec.LCEVCdec = class {
17
19
  /**
18
20
  * @param {HTMLVideoElement} media
19
21
  * @param {HTMLCanvasElement} canvas
20
- * @param {shaka.extern.LcevcConfiguration} dilConfig
22
+ * @param {shaka.extern.LcevcConfiguration} lcevcConfig
21
23
  */
22
- constructor(media, canvas, dilConfig) {
24
+ constructor(media, canvas, lcevcConfig) {
23
25
  }
24
26
 
25
27
  /**
@@ -30,13 +32,14 @@ LcevcDil.LcevcDIL = class {
30
32
  * @param {!BufferSource} data Video Buffer Data.
31
33
  * @param {string} type Type of Video Buffer Data.
32
34
  * @param {number} variantId Variant that the fragment belongs to.
35
+ * @param {number} timestampOffset Timestamp offset for appended segments
33
36
  */
34
- appendBuffer(data, type, variantId) {}
37
+ appendBuffer(data, type, variantId, timestampOffset) {}
35
38
 
36
39
  /**
37
40
  * Set current variant as variantId to the LCEVC decoder
38
41
  * @param {!number} variantId
39
- * @param {!boolean} autoBufferSwitch is lcevcDil mode that switches variant
42
+ * @param {!boolean} autoBufferSwitch is lcevcDec mode that switches variant
40
43
  * when the downloaded buffer from last variant has finished playing and
41
44
  * buffers from the new variant starts to play.
42
45
  */
@@ -49,15 +52,28 @@ LcevcDil.LcevcDIL = class {
49
52
  setContainerFormat(containerFormat) {}
50
53
 
51
54
  /**
52
- * Close LCEVC DIL
55
+ * Set streaming Format for LCEVC Data Parsing.
56
+ * @param {!number} streamingFormat container type of the stream.
57
+ */
58
+ setStreamingFormat(streamingFormat) {}
59
+
60
+ /**
61
+ * Close LCEVC DEC
53
62
  */
54
63
  close() {}
55
64
  };
56
65
 
66
+ /**
67
+ * The older module interface, for backward compatibility.
68
+ * Typed to the same interface, but under a different name.
69
+ * @type {typeof LCEVCdec.LCEVCdec}
70
+ */
71
+ LCEVCdec.LcevcDil;
72
+
57
73
  /**
58
74
  * LCEVC Support Check
59
75
  */
60
- LcevcDil.SupportObject = {
76
+ LCEVCdec.SupportObject = {
61
77
 
62
78
  /**
63
79
  * Check if canvas has WebGL support
@@ -72,10 +88,18 @@ LcevcDil.SupportObject = {
72
88
  * LCEVC Support Checklist Result
73
89
  * @type {boolean}
74
90
  */
75
- LcevcDil.SupportObject.SupportStatus;
91
+ LCEVCdec.SupportObject.SupportStatus;
76
92
 
77
93
  /**
78
94
  * LCEVC Support CheckList Error if any.
79
95
  * @type {string}
80
96
  */
81
- LcevcDil.SupportObject.SupportError;
97
+ LCEVCdec.SupportObject.SupportError;
98
+
99
+ /**
100
+ * Typedef for the module interface. Both LCEVCdec (new module) and LcevcDil
101
+ * (old module) implement roughly the same interface.
102
+ *
103
+ * @typedef {typeof LCEVCdec}
104
+ */
105
+ var LCEVCmodule;
@@ -0,0 +1,68 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * @fileoverview Externs for HTMLMediaElement which were missing in the
9
+ * Closure compiler.
10
+ *
11
+ * @externs
12
+ */
13
+
14
+
15
+ /**
16
+ * @constructor
17
+ * @implements {EventTarget}
18
+ */
19
+ function RemotePlayback() {}
20
+
21
+
22
+ /**
23
+ * Represents the RemotePlayback connection's state.
24
+ * @type {string}
25
+ */
26
+ RemotePlayback.prototype.state;
27
+
28
+
29
+ /**
30
+ * The watchAvailability() method of the RemotePlayback interface watches
31
+ * the list of available remote playback devices and returns a Promise that
32
+ * resolves with the callbackId of a remote playback device.
33
+ *
34
+ * @param {!function(boolean)} callback
35
+ * @return {!Promise}
36
+ */
37
+ RemotePlayback.prototype.watchAvailability = function(callback) {};
38
+
39
+
40
+ /**
41
+ * The cancelWatchAvailability() method of the RemotePlayback interface
42
+ * cancels the request to watch for one or all available devices.
43
+ *
44
+ * @param {number} id
45
+ * @return {!Promise}
46
+ */
47
+ RemotePlayback.prototype.cancelWatchAvailability = function(id) {};
48
+
49
+
50
+ /**
51
+ * The prompt() method of the RemotePlayback interface prompts the user
52
+ * to select an available remote playback device and give permission
53
+ * for the current media to be played using that device.
54
+ *
55
+ * If the user gives permission, the state will be set to connecting and
56
+ * the user agent will connect to the device to initiate playback.
57
+ *
58
+ * If the user chooses to instead disconnect from the device, the state will
59
+ * be set to disconnected and user agent will disconnect from this device.
60
+ *
61
+ * @return {!Promise}
62
+ */
63
+ RemotePlayback.prototype.prompt = function() {};
64
+
65
+
66
+ /** @type {RemotePlayback} */
67
+ HTMLMediaElement.prototype.remote;
68
+