shaka-player 2.5.1 → 2.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.csslintrc +13 -0
  2. package/AUTHORS +3 -0
  3. package/CHANGELOG.md +156 -0
  4. package/CONTRIBUTORS +3 -0
  5. package/README.md +3 -0
  6. package/build/README.md +5 -5
  7. package/build/apps.py +3 -1
  8. package/build/build.py +5 -2
  9. package/build/check.py +17 -0
  10. package/build/compiler.py +49 -0
  11. package/build/conformance.textproto +1 -0
  12. package/build/docs.py +0 -6
  13. package/build/generateExterns.js +72 -20
  14. package/build/install-linux-prereqs.sh +4 -4
  15. package/build/shakaBuildHelpers.py +7 -8
  16. package/build/test.py +21 -9
  17. package/build/types/core +1 -0
  18. package/build/types/ui +6 -1
  19. package/demo/asset_card.js +129 -41
  20. package/demo/cast_receiver/receiver_app.css +27 -13
  21. package/demo/close_button.js +10 -15
  22. package/demo/common/asset.js +6 -6
  23. package/demo/common/assets.js +72 -14
  24. package/demo/config.js +28 -25
  25. package/demo/custom.js +20 -16
  26. package/demo/demo.less +107 -16
  27. package/demo/demo_uncompiled.js +33 -0
  28. package/demo/demo_utils.js +4 -3
  29. package/demo/front.js +12 -8
  30. package/demo/index.html +14 -17
  31. package/demo/input.js +30 -23
  32. package/demo/input_container.js +15 -11
  33. package/demo/load.js +5 -7
  34. package/demo/main.js +138 -49
  35. package/demo/search.js +40 -36
  36. package/demo/service_worker.js +1 -1
  37. package/demo/tooltip.js +16 -24
  38. package/dist/.csslintstamp +0 -0
  39. package/dist/controls.css +1 -1
  40. package/dist/controls.css.map +1 -1
  41. package/dist/demo.compiled.debug.js +165 -152
  42. package/dist/demo.compiled.debug.map +4 -4
  43. package/dist/demo.compiled.js +165 -152
  44. package/dist/demo.compiled.map +4 -4
  45. package/dist/demo.css +1 -1
  46. package/dist/demo.css.map +1 -1
  47. package/dist/deps.js +28 -11
  48. package/dist/receiver.compiled.debug.js +11 -11
  49. package/dist/receiver.compiled.debug.map +3 -3
  50. package/dist/receiver.compiled.js +11 -11
  51. package/dist/receiver.compiled.map +3 -3
  52. package/dist/shaka-player.compiled.debug.externs.js +232 -102
  53. package/dist/shaka-player.compiled.debug.js +189 -165
  54. package/dist/shaka-player.compiled.debug.map +4 -4
  55. package/dist/shaka-player.compiled.externs.js +232 -102
  56. package/dist/shaka-player.compiled.js +567 -553
  57. package/dist/shaka-player.compiled.map +4 -4
  58. package/dist/shaka-player.ui.debug.externs.js +338 -113
  59. package/dist/shaka-player.ui.debug.js +296 -276
  60. package/dist/shaka-player.ui.debug.map +4 -4
  61. package/dist/shaka-player.ui.externs.js +338 -113
  62. package/dist/shaka-player.ui.js +685 -671
  63. package/dist/shaka-player.ui.map +4 -4
  64. package/docs/tutorials/drm-config.md +1 -0
  65. package/docs/tutorials/fairplay.md +77 -0
  66. package/docs/tutorials/index.json +1 -0
  67. package/docs/tutorials/manifest-parser.md +1 -1
  68. package/docs/tutorials/ui-customization.md +5 -2
  69. package/docs/tutorials/ui.md +10 -4
  70. package/docs/tutorials/welcome.md +2 -2
  71. package/externs/mediasession.js +16 -1
  72. package/externs/shaka/net.js +14 -4
  73. package/externs/shaka/player.js +136 -90
  74. package/externs/tippy.js +30 -0
  75. package/externs/webkitmediakeys.js +4 -0
  76. package/karma.conf.js +30 -24
  77. package/lib/cast/cast_proxy.js +94 -23
  78. package/lib/cast/cast_receiver.js +8 -1
  79. package/lib/dash/content_protection.js +33 -1
  80. package/lib/dash/dash_parser.js +13 -5
  81. package/lib/hls/hls_parser.js +20 -4
  82. package/lib/media/drm_engine.js +29 -2
  83. package/lib/media/media_source_engine.js +9 -6
  84. package/lib/media/play_rate_controller.js +14 -3
  85. package/lib/media/playhead.js +8 -3
  86. package/lib/media/streaming_engine.js +68 -20
  87. package/lib/media/transmuxer.js +2 -2
  88. package/lib/media/video_wrapper.js +8 -3
  89. package/lib/net/data_uri_plugin.js +5 -2
  90. package/lib/net/http_fetch_plugin.js +3 -3
  91. package/lib/net/http_plugin_utils.js +2 -4
  92. package/lib/net/http_xhr_plugin.js +2 -2
  93. package/lib/net/networking_engine.js +1 -0
  94. package/lib/offline/offline_scheme.js +7 -2
  95. package/lib/player.js +18 -8
  96. package/lib/polyfill/input_event.js +7 -11
  97. package/lib/polyfill/mediasource.js +1 -1
  98. package/lib/polyfill/patchedmediakeys_apple.js +2 -72
  99. package/lib/text/cue.js +1 -1
  100. package/lib/text/ttml_text_parser.js +1 -1
  101. package/lib/util/config_utils.js +1 -0
  102. package/lib/util/error.js +45 -11
  103. package/lib/util/event_manager.js +211 -100
  104. package/lib/util/fairplay_utils.js +122 -0
  105. package/lib/util/i_releasable.js +1 -0
  106. package/lib/util/player_configuration.js +7 -0
  107. package/lib/util/pssh.js +41 -0
  108. package/lib/util/string_utils.js +42 -6
  109. package/lib/util/timer.js +1 -1
  110. package/package.json +33 -33
  111. package/roadmap.md +96 -0
  112. package/shaka-player.uncompiled.js +5 -1
  113. package/test/dash/dash_parser_content_protection_unit.js +35 -1
  114. package/test/dash/dash_parser_manifest_unit.js +60 -0
  115. package/test/hls/hls_live_unit.js +7 -1
  116. package/test/hls/hls_parser_unit.js +50 -0
  117. package/test/media/drm_engine_unit.js +10 -4
  118. package/test/media/media_source_engine_integration.js +12 -0
  119. package/test/media/media_source_engine_unit.js +3 -1
  120. package/test/media/playhead_unit.js +7 -5
  121. package/test/media/streaming_engine_unit.js +46 -1
  122. package/test/media/transmuxer_integration.js +13 -0
  123. package/test/net/data_uri_plugin_unit.js +13 -2
  124. package/test/net/http_plugin_unit.js +17 -12
  125. package/test/net/networking_engine_unit.js +17 -8
  126. package/test/offline/offline_scheme_unit.js +18 -8
  127. package/test/player_external.js +3 -2
  128. package/test/player_integration.js +94 -3
  129. package/test/player_src_equals_integration.js +2 -2
  130. package/test/player_unit.js +21 -8
  131. package/test/test/boot.js +20 -5
  132. package/test/test/externs/jasmine.js +48 -0
  133. package/test/test/util/expect_async_polyfill.js +145 -0
  134. package/test/test/util/fake_networking_engine.js +1 -0
  135. package/test/test/util/manifest_generator.js +2 -1
  136. package/test/test/util/test_scheme.js +34 -2
  137. package/test/test/util/ui_utils.js +41 -0
  138. package/test/test/util/util.js +16 -8
  139. package/test/ui/ui_unit.js +130 -4
  140. package/ui/audio_language_selection.js +17 -96
  141. package/ui/big_play_button.js +61 -0
  142. package/ui/controls.js +226 -335
  143. package/ui/controls.less +3 -5
  144. package/ui/element.js +24 -6
  145. package/ui/externs/ui.js +62 -9
  146. package/ui/fullscreen_button.js +2 -52
  147. package/ui/less/buttons.less +10 -16
  148. package/ui/less/containers.less +75 -20
  149. package/ui/less/general.less +18 -2
  150. package/ui/less/other_elements.less +2 -1
  151. package/ui/less/overflow_menu.less +11 -10
  152. package/ui/less/range_elements.less +12 -10
  153. package/ui/less/spinner.less +2 -0
  154. package/ui/overflow_menu.js +1 -1
  155. package/ui/pip_button.js +1 -1
  156. package/ui/{play_pause_button.js → play_button.js} +17 -47
  157. package/ui/presentation_time.js +17 -12
  158. package/ui/range_element.js +176 -0
  159. package/ui/resolution_selection.js +43 -106
  160. package/ui/seek_bar.js +204 -0
  161. package/ui/settings_menu.js +113 -0
  162. package/ui/small_play_button.js +73 -0
  163. package/ui/text_displayer.js +17 -14
  164. package/ui/text_selection.js +42 -107
  165. package/ui/ui.js +17 -40
  166. package/ui/volume_bar.js +40 -68
@@ -32,16 +32,17 @@
32
32
  *
33
33
  * @property {number} timestamp
34
34
  * The timestamp the choice was made, in seconds since 1970
35
- * (i.e. Date.now() / 1000).
35
+ * (i.e. <code>Date.now() / 1000</code>).
36
36
  * @property {number} id
37
37
  * The id of the track that was chosen.
38
38
  * @property {string} type
39
- * The type of track chosen ('variant' or 'text').
39
+ * The type of track chosen (<code>'variant'</code> or <code>'text'</code>).
40
40
  * @property {boolean} fromAdaptation
41
- * True if the choice was made by AbrManager for adaptation; false if it
42
- * was made by the application through selectTrack.
41
+ * <code>true</code> if the choice was made by AbrManager for adaptation;
42
+ * <code>false</code> if it was made by the application through
43
+ * <code>selectTrack</code>.
43
44
  * @property {?number} bandwidth
44
- * The bandwidth of the chosen track (null for text).
45
+ * The bandwidth of the chosen track (<code>null</code> for text).
45
46
  * @exportDoc
46
47
  */
47
48
  shaka.extern.TrackChoice;
@@ -56,10 +57,10 @@ shaka.extern.TrackChoice;
56
57
  *
57
58
  * @property {number} timestamp
58
59
  * The timestamp the state was entered, in seconds since 1970
59
- * (i.e. Date.now() / 1000).
60
+ * (i.e. <code>Date.now() / 1000</code>).
60
61
  * @property {string} state
61
- * The state the player entered. This could be 'buffering', 'playing',
62
- * 'paused', or 'ended'.
62
+ * The state the player entered. This could be <code>'buffering'</code>,
63
+ * <code>'playing'</code>, <code>'paused'</code>, or <code>'ended'</code>.
63
64
  * @property {number} duration
64
65
  * The number of seconds the player was in this state. If this is the last
65
66
  * entry in the list, the player is still in this state, so the duration will
@@ -91,7 +92,8 @@ shaka.extern.StateChange;
91
92
  * @description
92
93
  * Contains statistics and information about the current state of the player.
93
94
  * This is meant for applications that want to log quality-of-experience (QoE)
94
- * or other stats. These values will reset when load() is called again.
95
+ * or other stats. These values will reset when <code>load()</code> is called
96
+ * again.
95
97
  *
96
98
  * @property {number} width
97
99
  * The width of the current video track.
@@ -101,18 +103,18 @@ shaka.extern.StateChange;
101
103
  * The bandwidth required for the current streams (total, in bit/sec).
102
104
  *
103
105
  * @property {number} decodedFrames
104
- * The total number of frames decoded by the Player. This may be NaN if this
105
- * is not supported by the browser.
106
+ * The total number of frames decoded by the Player. This may be
107
+ * <code>NaN</code> if this is not supported by the browser.
106
108
  * @property {number} droppedFrames
107
- * The total number of frames dropped by the Player. This may be NaN if this
108
- * is not supported by the browser.
109
+ * The total number of frames dropped by the Player. This may be
110
+ * <code>NaN</code> if this is not supported by the browser.
109
111
  * @property {number} estimatedBandwidth
110
112
  * The current estimated network bandwidth (in bit/sec).
111
113
  *
112
114
  * @property {number} loadLatency
113
115
  * This is the number of seconds it took for the video element to have enough
114
116
  * data to begin playback. This is measured from the time load() is called to
115
- * the time the 'loadeddata' event is fired by the media element.
117
+ * the time the <code>'loadeddata'</code> event is fired by the media element.
116
118
  * @property {number} playTime
117
119
  * The total time spent in a playing state in seconds.
118
120
  * @property {number} pauseTime
@@ -159,7 +161,8 @@ shaka.extern.BufferedRange;
159
161
  * Contains information about the current buffered ranges.
160
162
  *
161
163
  * @property {!Array.<shaka.extern.BufferedRange>} total
162
- * The combined audio/video buffered ranges, reported by |video.buffered|.
164
+ * The combined audio/video buffered ranges, reported by
165
+ * <code>video.buffered</code>.
163
166
  * @property {!Array.<shaka.extern.BufferedRange>} audio
164
167
  * The buffered ranges for audio content.
165
168
  * @property {!Array.<shaka.extern.BufferedRange>} video
@@ -215,18 +218,18 @@ shaka.extern.BufferedInfo;
215
218
  * visible/audible in the buffer).
216
219
  *
217
220
  * @property {string} type
218
- * The type of track, either 'variant' or 'text'.
221
+ * The type of track, either <code>'variant'</code> or <code>'text'</code>.
219
222
  * @property {number} bandwidth
220
223
  * The bandwidth required to play the track, in bits/sec.
221
224
  *
222
225
  * @property {string} language
223
- * The language of the track, or 'und' if not given. This is the exact
224
- * value provided in the manifest; it may need to be normalized.
226
+ * The language of the track, or <code>'und'</code> if not given. This is the
227
+ * exact value provided in the manifest; it may need to be normalized.
225
228
  * @property {?string} label
226
229
  * The track label, which is unique text that should describe the track.
227
230
  * @property {?string} kind
228
- * (only for text tracks) The kind of text track, either 'caption' or
229
- * 'subtitle'.
231
+ * (only for text tracks) The kind of text track, either
232
+ * <code>'caption'</code> or <code>'subtitle'</code>.
230
233
  * @property {?number} width
231
234
  * The video width provided in the manifest, if present.
232
235
  * @property {?number} height
@@ -248,10 +251,12 @@ shaka.extern.BufferedInfo;
248
251
  * indicates which track Shaka will use when the user's language preference
249
252
  * cannot be satisfied.
250
253
  * @property {!Array.<string>} roles
251
- * The roles of the track, e.g. 'main', 'caption', or 'commentary'.
254
+ * The roles of the track, e.g. <code>'main'</code>, <code>'caption'</code>,
255
+ * or <code>'commentary'</code>.
252
256
  * @property {Array.<string>} audioRoles
253
- * The roles of the audio in the track, e.g. 'main' or 'commentary'.
254
- * Will be null for text tracks or variant tracks without audio.
257
+ * The roles of the audio in the track, e.g. <code>'main'</code> or
258
+ * <code>'commentary'</code>. Will be null for text tracks or variant tracks
259
+ * without audio.
255
260
  * @property {?number} videoId
256
261
  * (only for variant tracks) The video stream id.
257
262
  * @property {?number} audioId
@@ -308,9 +313,11 @@ shaka.extern.Track;
308
313
  * @property {number} maxHeight
309
314
  * The maximum height of a video track, in pixels.
310
315
  * @property {number} minPixels
311
- * The minimum number of total pixels in a video track (i.e. width * height).
316
+ * The minimum number of total pixels in a video track (i.e.
317
+ * <code>width * height</code>).
312
318
  * @property {number} maxPixels
313
- * The maximum number of total pixels in a video track (i.e. width * height).
319
+ * The maximum number of total pixels in a video track (i.e.
320
+ * <code>width * height</code>).
314
321
  *
315
322
  * @property {number} minBandwidth
316
323
  * The minimum bandwidth of a variant track, in bit/sec.
@@ -351,8 +358,8 @@ shaka.extern.DrmSupportType;
351
358
  * The keys are media MIME types.
352
359
  * @property {!Object.<string, ?shaka.extern.DrmSupportType>} drm
353
360
  * A map of supported key systems.
354
- * The keys are the key system names. The value is null if it is not
355
- * supported. Key systems not probed will not be in this dictionary.
361
+ * The keys are the key system names. The value is <code>null</code> if it is
362
+ * not supported. Key systems not probed will not be in this dictionary.
356
363
  *
357
364
  * @exportDoc
358
365
  */
@@ -460,22 +467,23 @@ shaka.extern.DashContentProtectionCallback;
460
467
  * @property {string} videoRobustness
461
468
  * A key-system-specific string that specifies a required security level for
462
469
  * video.
463
- * <i>Defaults to '', i.e., no specific robustness required.</i> <br>
470
+ * <i>Defaults to <code>''</code>, i.e., no specific robustness required.</i>
464
471
  * @property {string} audioRobustness
465
472
  * A key-system-specific string that specifies a required security level for
466
473
  * audio.
467
- * <i>Defaults to '', i.e., no specific robustness required.</i> <br>
474
+ * <i>Defaults to <code>''</code>, i.e., no specific robustness required.</i>
468
475
  * @property {Uint8Array} serverCertificate
469
476
  * <i>Defaults to null.</i> <br>
470
- * <i>An empty certificate (byteLength 0) will be treated as null.</i> <br>
477
+ * <i>An empty certificate (<code>byteLength==0</code>) will be treated as
478
+ * <code>null</code>.</i> <br>
471
479
  * <i>A certificate will be requested from the license server if
472
480
  * required.</i> <br>
473
481
  * A key-system-specific server certificate used to encrypt license requests.
474
482
  * Its use is optional and is meant as an optimization to avoid a round-trip
475
483
  * to request a certificate.
476
484
  * @property {string} individualizationServer
477
- * The server that handles an 'individualiation-request'. If the server isn't
478
- * given, it will default to the license server.
485
+ * The server that handles an <code>'individualiation-request'</code>. If the
486
+ * server isn't given, it will default to the license server.
479
487
  *
480
488
  * @exportDoc
481
489
  */
@@ -488,7 +496,9 @@ shaka.extern.AdvancedDrmConfiguration;
488
496
  * servers: !Object.<string, string>,
489
497
  * clearKeys: !Object.<string, string>,
490
498
  * delayLicenseRequestUntilPlayed: boolean,
491
- * advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>
499
+ * advanced: Object.<string, shaka.extern.AdvancedDrmConfiguration>,
500
+ * initDataTransform: ((function(!Uint8Array):!Uint8Array)|undefined),
501
+ * fairPlayTransform: boolean
492
502
  * }}
493
503
  *
494
504
  * @property {shaka.extern.RetryParameters} retryParameters
@@ -496,7 +506,8 @@ shaka.extern.AdvancedDrmConfiguration;
496
506
  * @property {!Object.<string, string>} servers
497
507
  * <i>Required for all but the clear key CDM.</i> <br>
498
508
  * A dictionary which maps key system IDs to their license servers.
499
- * For example, {'com.widevine.alpha': 'https://example.com/drm'}.
509
+ * For example,
510
+ * <code>{'com.widevine.alpha': 'https://example.com/drm'}</code>.
500
511
  * @property {!Object.<string, string>} clearKeys
501
512
  * <i>Forces the use of the Clear Key CDM.</i>
502
513
  * A map of key IDs (hex) to keys (hex).
@@ -508,6 +519,19 @@ shaka.extern.AdvancedDrmConfiguration;
508
519
  * <i>Optional.</i> <br>
509
520
  * A dictionary which maps key system IDs to advanced DRM configuration for
510
521
  * those key systems.
522
+ * @property {((function(!Uint8Array):!Uint8Array)|undefined)}
523
+ * initDataTransform
524
+ * <i>Optional.</i><br>
525
+ * If given, this function is called with the init data from the
526
+ * manifest/media and should return the (possibly transformed) init data to
527
+ * pass to the browser.
528
+ * @property {boolean} fairPlayTransform
529
+ * <i>Optional.</i><br>
530
+ * <b>Temporary, for v2.5.x only.</b><br>
531
+ * If true, transform the FairPlay license request/response according to the
532
+ * FairPlay examples; if false, don't transform. Defaults to
533
+ * <code>true</code>. Starting in v2.6 this will go away and we will never
534
+ * provide default license request/response transforms.
511
535
  *
512
536
  * @exportDoc
513
537
  */
@@ -531,8 +555,8 @@ shaka.extern.DrmConfiguration;
531
555
  * ContentProtection node. Return null if not recognized.
532
556
  * @property {string} clockSyncUri
533
557
  * A default clock sync URI to be used with live streams which do not
534
- * contain any clock sync information. The "Date" header from this URI
535
- * will be used to determine the current time.
558
+ * contain any clock sync information. The <code>Date</code> header from this
559
+ * URI will be used to determine the current time.
536
560
  * @property {boolean} ignoreDrmInfo
537
561
  * If true will cause DASH parser to ignore DRM information specified
538
562
  * by the manifest and treat it as if it signaled no particular key
@@ -543,39 +567,57 @@ shaka.extern.DrmConfiguration;
543
567
  * to the application and will result in a playback failure. Defaults to
544
568
  * false if not provided.
545
569
  * @property {number} defaultPresentationDelay
546
- * A default presentationDelay if suggestedPresentationDelay is missing
547
- * in the MPEG DASH manifest. This has to be bigger than minBufferTime * 1.5.
570
+ * A default <code>presentationDelay</code> if
571
+ * <code>suggestedPresentationDelay</code> is missing in the MPEG DASH
572
+ * manifest. This has to be bigger than <code>minBufferTime * 1.5</code>.
548
573
  * @property {boolean} ignoreMinBufferTime
549
- * If true will cause DASH parser to ignore minBufferTime from manifest.
550
- * It allows player config to take precedence over manifest for
551
- * rebufferingGoal. Defaults to false if not provided.
574
+ * If true will cause DASH parser to ignore <code>minBufferTime</code> from
575
+ * manifest. It allows player config to take precedence over manifest for
576
+ * <code>rebufferingGoal</code>. Defaults to <code>false</code> if not
577
+ * provided.
552
578
  * @property {boolean} autoCorrectDrift
553
- * If true, ignore the availabilityStartTime in the manifest and instead use
554
- * the segments to determine the live edge. This allows us to play streams
555
- * that have a lot of drift. If false, we can't play content where the
556
- * manifest specifies segments in the future. Defaults to true.
557
- *
579
+ * If <code>true</code>, ignore the <code>availabilityStartTime</code> in the
580
+ * manifest and instead use the segments to determine the live edge. This
581
+ * allows us to play streams that have a lot of drift. If <code>false</code>,
582
+ * we can't play content where the manifest specifies segments in the future.
583
+ * Defaults to <code>true</code>.
558
584
  * @exportDoc
559
585
  */
560
586
  shaka.extern.DashManifestConfiguration;
561
587
 
562
588
 
589
+ /**
590
+ * @typedef {{
591
+ * ignoreTextStreamFailures: boolean
592
+ * }}
593
+ *
594
+ * @property {boolean} ignoreTextStreamFailures
595
+ * If <code>true</code>, ignore any errors in a text stream and filter out
596
+ * those streams.
597
+ * @exportDoc
598
+ */
599
+ shaka.extern.HlsManifestConfiguration;
600
+
601
+
563
602
  /**
564
603
  * @typedef {{
565
604
  * retryParameters: shaka.extern.RetryParameters,
566
605
  * availabilityWindowOverride: number,
567
- * dash: shaka.extern.DashManifestConfiguration
606
+ * dash: shaka.extern.DashManifestConfiguration,
607
+ * hls: shaka.extern.HlsManifestConfiguration
568
608
  * }}
569
609
  *
570
610
  * @property {shaka.extern.RetryParameters} retryParameters
571
611
  * Retry parameters for manifest requests.
572
612
  * @property {number} availabilityWindowOverride
573
613
  * A number, in seconds, that overrides the availability window in the
574
- * manifest, or NaN if the default value should be used. This is enforced by
575
- * the manifest parser, so custom manifest parsers should take care to honor
576
- * this parameter.
614
+ * manifest, or <code>NaN</code> if the default value should be used. This is
615
+ * enforced by the manifest parser, so custom manifest parsers should take
616
+ * care to honor this parameter.
577
617
  * @property {shaka.extern.DashManifestConfiguration} dash
578
618
  * Advanced parameters used by the DASH manifest parser.
619
+ * @property {shaka.extern.HlsManifestConfiguration} hls
620
+ * Advanced parameters used by the HLS manifest parser.
579
621
  *
580
622
  * @exportDoc
581
623
  */
@@ -624,27 +666,29 @@ shaka.extern.ManifestConfiguration;
624
666
  * in buffer behind the playhead when it appends a new media segment.
625
667
  * The StreamingEngine will evict content to meet this limit.
626
668
  * @property {boolean} ignoreTextStreamFailures
627
- * If true, the player will ignore text stream failures and continue playing
628
- * other streams.
669
+ * If <code>true</code>, the player will ignore text stream failures and
670
+ * continue playing other streams.
629
671
  * @property {boolean} alwaysStreamText
630
- * If true, always stream text tracks, regardless of whether or not they are
631
- * shown. This is necessary when using the browser's built-in controls, which
632
- * are not capable of signaling display state changes back to Shaka Player.
633
- * Defaults to false.
672
+ * If <code>true</code>, always stream text tracks, regardless of whether or
673
+ * not they are shown. This is necessary when using the browser's built-in
674
+ * controls, which are not capable of signaling display state changes back to
675
+ * Shaka Player.
676
+ * Defaults to <code>false</code>.
634
677
  * @property {boolean} startAtSegmentBoundary
635
- * If true, adjust the start time backwards so it is at the start of a
636
- * segment. This affects both explicit start times and calculated start time
637
- * for live streams. This can put us further from the live edge. Defaults to
638
- * false.
678
+ * If <code>true</code>, adjust the start time backwards so it is at the start
679
+ * of a segment. This affects both explicit start times and calculated start
680
+ * time for live streams. This can put us further from the live edge. Defaults
681
+ * to <code>false</code>.
639
682
  * @property {number} smallGapLimit
640
683
  * The limit (in seconds) for a gap in the media to be considered "small".
641
684
  * Small gaps are jumped automatically without events. Large gaps result
642
685
  * in a Player event and can be jumped.
643
686
  * @property {boolean} jumpLargeGaps
644
- * If true, jump large gaps in addition to small gaps. The event will be
645
- * raised first. Then, if the app doesn't call preventDefault() on the event,
646
- * the Player will jump the gap. If false, then the event will be raised,
647
- * but the gap will not be jumped.
687
+ * If <code>true</code>, jump large gaps in addition to small gaps. A
688
+ * <code>largegap</code> event will be raised first. Then, if the app doesn't
689
+ * call <code>preventDefault()</code> on the event, the Player will jump the
690
+ * gap. If <code>false</code>, then the event will be raised, but the gap
691
+ * will not be jumped.
648
692
  * @property {number} durationBackoff
649
693
  * By default, we will not allow seeking to exactly the duration of a
650
694
  * presentation. This field is the number of seconds before duration we will
@@ -652,11 +696,11 @@ shaka.extern.ManifestConfiguration;
652
696
  * To disable this behavior, the config can be set to 0. We recommend using
653
697
  * the default value unless you have a good reason not to.
654
698
  * @property {boolean} forceTransmuxTS
655
- * If this is true, we will transmux TS content even if not strictly necessary
656
- * for the assets to be played. Shaka Player currently only supports CEA 708
657
- * captions by transmuxing, so this value is necessary for enabling them on
658
- * platforms with native TS support like Edge or Chromecast.
659
- * This value defaults to false.
699
+ * If this is <code>true</code>, we will transmux TS content even if not
700
+ * strictly necessary for the assets to be played. Shaka Player currently
701
+ * only supports CEA 708 captions by transmuxing, so this value is necessary
702
+ * for enabling them on platforms with native TS support like Edge or
703
+ * Chromecast. This value defaults to <code>false</code>.
660
704
  * @property {number} safeSeekOffset
661
705
  * The amount of seconds that should be added when repositioning the playhead
662
706
  * after falling out of the availability window or seek. This gives the player
@@ -664,9 +708,9 @@ shaka.extern.ManifestConfiguration;
664
708
  * jump in the stream skipping more content. This is helpful for lower
665
709
  * bandwidth scenarios. Defaults to 5 if not provided.
666
710
  * @property {boolean} stallEnabled
667
- * When set to |true|, the stall detector logic will run, skipping forward
668
- * |stallSkip| seconds whenever the playhead stops moving for |stallThreshold|
669
- * seconds.
711
+ * When set to <code>true</code>, the stall detector logic will run, skipping
712
+ * forward <code>stallSkip</code> seconds whenever the playhead stops moving
713
+ * for <code>stallThreshold</code> seconds.
670
714
  * @property {number} stallThreshold
671
715
  * The maximum number of seconds that may elapse without the playhead moving
672
716
  * (when playback is expected) before it will be labeled as a stall.
@@ -697,10 +741,10 @@ shaka.extern.StreamingConfiguration;
697
741
  * The restrictions to apply to ABR decisions. These are "soft" restrictions.
698
742
  * Any track that fails to meet these restrictions will not be selected
699
743
  * automatically, but will still appear in the track list and can still be
700
- * selected via selectVariantTrack(). If no tracks meet these restrictions,
701
- * AbrManager should not fail, but choose a low-res or low-bandwidth variant
702
- * instead. It is the responsibiliy of AbrManager implementations to follow
703
- * these rules and implement this behavior.
744
+ * selected via <code>selectVariantTrack()</code>. If no tracks meet these
745
+ * restrictions, AbrManager should not fail, but choose a low-res or
746
+ * low-bandwidth variant instead. It is the responsibiliy of AbrManager
747
+ * implementations to follow these rules and implement this behavior.
704
748
  * @property {number} switchInterval
705
749
  * The minimum amount of time that must pass between switches, in
706
750
  * seconds. This keeps us from changing too often and annoying the user.
@@ -725,19 +769,21 @@ shaka.extern.AbrConfiguration;
725
769
  *
726
770
  * @property {function(!Array.<shaka.extern.Track>):!Array.<shaka.extern.Track>}
727
771
  * trackSelectionCallback
728
- * Called inside store() to determine which tracks to save from a manifest.
729
- * It is passed an array of Tracks from the manifest and it should return
730
- * an array of the tracks to store. This is called for each Period in the
731
- * manifest (in order).
772
+ * Called inside <code>store()</code> to determine which tracks to save from a
773
+ * manifest. It is passed an array of Tracks from the manifest and it should
774
+ * return an array of the tracks to store. This is called for each Period in
775
+ * the manifest (in order).
732
776
  * @property {function(shaka.extern.StoredContent,number)} progressCallback
733
- * Called inside store() to give progress info back to the app. It is given
734
- * the current manifest being stored and the progress of it being stored.
777
+ * Called inside <code>store()</code> to give progress info back to the app.
778
+ * It is given the current manifest being stored and the progress of it being
779
+ * stored.
735
780
  * @property {boolean} usePersistentLicense
736
- * If true, store protected content with a persistent license so that no
737
- * network is required to view.
738
- * If false, store protected content without a persistent license. A network
739
- * will be required to retrieve a temporary license to view.
740
- * Defaults to true.
781
+ * If <code>true</code>, store protected content with a persistent license so
782
+ * that no network is required to view.
783
+ * If <code>false</code>, store protected content without a persistent
784
+ * license. A network will be required to retrieve a temporary license to
785
+ * view.
786
+ * Defaults to <code>true</code>.
741
787
  * @exportDoc
742
788
  */
743
789
  shaka.extern.OfflineConfiguration;
@@ -776,7 +822,7 @@ shaka.extern.OfflineConfiguration;
776
822
  * Offline configuration and settings.
777
823
  * @property {string} preferredAudioLanguage
778
824
  * The preferred language to use for audio tracks. If not given it will use
779
- * the 'main' track.
825
+ * the <code>'main'</code> track.
780
826
  * Changing this during playback will not affect the current playback.
781
827
  * @property {string} preferredTextLanguage
782
828
  * The preferred language to use for text tracks. If a matching text track
@@ -817,8 +863,8 @@ shaka.extern.PlayerConfiguration;
817
863
  * @property {string} language
818
864
  * The language code for the stream.
819
865
  * @property {string} role
820
- * The role name for the stream. If the stream has no role, |role| will be
821
- * ''.
866
+ * The role name for the stream. If the stream has no role, <code>role</code>
867
+ * will be <code>''</code>.
822
868
  * @exportDoc
823
869
  */
824
870
  shaka.extern.LanguageRole;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2016 Google Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * @fileoverview Externs for Tippy methods.
20
+ * @externs
21
+ */
22
+
23
+
24
+ /**
25
+ * This is the subset of this method that we use in our demo code.
26
+ *
27
+ * @param {!Element} element
28
+ * @param {!Object} config
29
+ */
30
+ const tippy = function(element, config) {};
@@ -61,6 +61,10 @@ WebKitMediaKeySession.prototype.update = function(message) {};
61
61
  WebKitMediaKeySession.prototype.close = function() {};
62
62
 
63
63
 
64
+ /** @type {string} */
65
+ WebKitMediaKeySession.prototype.sessionId;
66
+
67
+
64
68
  /** @type {WebKitMediaKeyError} */
65
69
  WebKitMediaKeySession.prototype.error;
66
70
 
package/karma.conf.js CHANGED
@@ -64,9 +64,8 @@ module.exports = function(config) {
64
64
  // frameworks to use
65
65
  // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
66
66
  frameworks: [
67
- 'jasmine-ajax', 'jasmine',
68
- // Fixes backtraces after Babel preprocessing
69
- 'source-map-support',
67
+ 'jasmine-ajax',
68
+ 'jasmine',
70
69
  ],
71
70
 
72
71
  plugins: [
@@ -111,7 +110,7 @@ module.exports = function(config) {
111
110
  {pattern: 'ui/**/*.js', included: false},
112
111
  {pattern: 'ui/**/*.less', included: false},
113
112
  {pattern: 'third_party/closure/goog/**/*.js', included: false},
114
- {pattern: 'third_party/language-mapping-list/**/*.js', included: false},
113
+ {pattern: 'third_party/language-mapping-list/*.js', included: false},
115
114
  {pattern: 'test/test/assets/*', included: false},
116
115
  {pattern: 'dist/shaka-player.ui.js', included: false},
117
116
  {pattern: 'dist/locales.js', included: false},
@@ -123,31 +122,35 @@ module.exports = function(config) {
123
122
  proxies: {},
124
123
 
125
124
  preprocessors: {
126
- // Compute coverage over everything but lib/debug/ or lib/polyfill/
127
- 'lib/!(debug|polyfill)/*.js': ['coverage'],
128
- // Player is not matched by the above, so add it explicitly
129
- 'lib/player.js': ['coverage'],
130
- // Compute coverage over UI, too
131
- 'ui/*.js': ['coverage'],
132
-
133
- // Convert ES6 to ES5 so we can still run tests on IE11 and Tizen.
134
- 'demo/common/*.js': ['babel'],
135
- 'lib/**/*.js': ['babel'],
136
- 'ui/**/*.js': ['babel'],
137
- 'test/**/*.js': ['babel'],
138
- 'third_party/language-mapping-list/**/*.js': ['babel'],
125
+ // Use babel to convert ES6 to ES5 so we can still run tests everywhere.
126
+ // Use sourcemap to read inline source maps from babel into karma.
127
+ 'demo/**/*.js': ['babel', 'sourcemap'],
128
+ 'lib/**/*.js': ['babel', 'sourcemap'],
129
+ 'ui/**/*.js': ['babel', 'sourcemap'],
130
+ 'test/**/*.js': ['babel', 'sourcemap'],
131
+ 'third_party/language-mapping-list/*.js': ['babel', 'sourcemap'],
139
132
  },
140
133
 
141
134
  babelPreprocessor: {
142
135
  options: {
143
- presets: [
144
- // Some of our tests are not written with strict mode in mind, but the
145
- // plugin for commonjs modules enforces strict mode. Since we do not
146
- // use modules, just disable them.
147
- ['env', { modules: false }],
148
- ],
149
- // The source-map-support framework is necessary to make this work:
136
+ presets: ['env'],
137
+ // Add source maps so that backtraces refer to the original code.
138
+ // Babel will output inline source maps, and the 'sourcemap'
139
+ // preprocessor will read them and feed them to Karma. Karma will then
140
+ // use them to reformat stack traces in errors.
150
141
  sourceMap: 'inline',
142
+ // Add instrumentation for code coverage.
143
+ plugins: [
144
+ ['istanbul', {
145
+ // Don't instrument these parts of the codebase.
146
+ exclude: [
147
+ 'demo/**/*.js',
148
+ 'lib/(debug|deprecate|polyfill)/*.js',
149
+ 'test/**/*.js',
150
+ 'third_party/**/*.js',
151
+ ],
152
+ }],
153
+ ],
151
154
  },
152
155
  },
153
156
 
@@ -193,6 +196,9 @@ module.exports = function(config) {
193
196
  // Run playback tests on a custom manifest URI.
194
197
  testCustomAsset: settings.test_custom_asset,
195
198
  testCustomLicenseServer: settings.test_custom_license_server,
199
+
200
+ // Overrides the default test timeout value.
201
+ testTimeout: settings.test_timeout,
196
202
  }],
197
203
  },
198
204