shaka-player 3.1.5 → 3.2.3

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 (134) hide show
  1. package/CHANGELOG.md +129 -6
  2. package/README.md +4 -4
  3. package/build/types/polyfill +1 -0
  4. package/demo/common/asset.js +9 -7
  5. package/demo/common/assets.js +10 -1
  6. package/demo/common/message_ids.js +2 -1
  7. package/demo/config.js +5 -2
  8. package/demo/index.html +1 -1
  9. package/demo/locales/en.json +2 -1
  10. package/demo/locales/source.json +8 -4
  11. package/demo/main.js +2 -1
  12. package/dist/demo.compiled.debug.js +14 -14
  13. package/dist/demo.compiled.debug.map +2 -2
  14. package/dist/demo.compiled.js +14 -14
  15. package/dist/demo.compiled.map +2 -2
  16. package/dist/deps.js +21 -20
  17. package/dist/locales.js +30 -30
  18. package/dist/receiver.compiled.debug.js +8 -8
  19. package/dist/receiver.compiled.debug.map +2 -2
  20. package/dist/receiver.compiled.js +8 -8
  21. package/dist/receiver.compiled.map +2 -2
  22. package/dist/shaka-player.compiled.d.ts +63 -10
  23. package/dist/shaka-player.compiled.debug.d.ts +63 -10
  24. package/dist/shaka-player.compiled.debug.externs.js +786 -716
  25. package/dist/shaka-player.compiled.debug.js +563 -534
  26. package/dist/shaka-player.compiled.debug.map +4 -4
  27. package/dist/shaka-player.compiled.externs.js +786 -716
  28. package/dist/shaka-player.compiled.js +820 -809
  29. package/dist/shaka-player.compiled.map +4 -4
  30. package/dist/shaka-player.ui.d.ts +63 -10
  31. package/dist/shaka-player.ui.debug.d.ts +63 -10
  32. package/dist/shaka-player.ui.debug.externs.js +542 -472
  33. package/dist/shaka-player.ui.debug.js +594 -566
  34. package/dist/shaka-player.ui.debug.map +4 -4
  35. package/dist/shaka-player.ui.externs.js +542 -472
  36. package/dist/shaka-player.ui.js +938 -927
  37. package/dist/shaka-player.ui.map +4 -4
  38. package/docs/tutorials/ui.md +5 -5
  39. package/externs/aria.js +6 -0
  40. package/externs/shaka/ads.js +24 -1
  41. package/externs/shaka/manifest.js +6 -1
  42. package/externs/shaka/offline.js +5 -0
  43. package/externs/shaka/player.js +61 -9
  44. package/externs/shaka/text.js +10 -10
  45. package/externs/texttrack.js +3 -0
  46. package/lib/ads/ad_manager.js +16 -15
  47. package/lib/ads/client_side_ad_manager.js +6 -2
  48. package/lib/ads/server_side_ad_manager.js +19 -2
  49. package/lib/cast/cast_proxy.js +8 -0
  50. package/lib/cast/cast_utils.js +6 -1
  51. package/lib/cea/cea608_data_channel.js +56 -56
  52. package/lib/cea/cea608_memory.js +33 -33
  53. package/lib/cea/cea708_service.js +43 -43
  54. package/lib/cea/cea708_window.js +38 -38
  55. package/lib/cea/cea_decoder.js +13 -14
  56. package/lib/cea/cea_utils.js +23 -23
  57. package/lib/cea/dtvcc_packet_builder.js +7 -7
  58. package/lib/cea/i_caption_decoder.js +2 -3
  59. package/lib/cea/i_cea_parser.js +2 -2
  60. package/lib/cea/mp4_cea_parser.js +6 -6
  61. package/lib/dash/dash_parser.js +5 -0
  62. package/lib/hls/hls_parser.js +159 -12
  63. package/lib/media/closed_caption_parser.js +1 -2
  64. package/lib/media/drm_engine.js +162 -192
  65. package/lib/media/segment_index.js +4 -1
  66. package/lib/media/segment_reference.js +37 -2
  67. package/lib/media/streaming_engine.js +6 -6
  68. package/lib/net/networking_engine.js +1 -0
  69. package/lib/offline/download_manager.js +1 -2
  70. package/lib/offline/indexeddb/v1_storage_cell.js +1 -0
  71. package/lib/offline/indexeddb/v2_storage_cell.js +1 -0
  72. package/lib/offline/manifest_converter.js +3 -1
  73. package/lib/offline/storage.js +12 -14
  74. package/lib/player.js +426 -149
  75. package/lib/polyfill/aria.js +82 -0
  76. package/lib/routing/walker.js +2 -3
  77. package/lib/text/srt_text_parser.js +4 -4
  78. package/lib/text/text_engine.js +2 -2
  79. package/lib/text/vtt_text_parser.js +2 -2
  80. package/lib/text/web_vtt_generator.js +55 -12
  81. package/lib/util/error.js +6 -0
  82. package/lib/util/manifest_parser_utils.js +1 -0
  83. package/lib/util/mp4_box_parsers.js +20 -20
  84. package/lib/util/multi_map.js +8 -0
  85. package/lib/util/player_configuration.js +13 -1
  86. package/lib/util/stream_utils.js +168 -88
  87. package/lib/util/xml_utils.js +31 -12
  88. package/package.json +1 -1
  89. package/roadmap.md +24 -22
  90. package/shaka-player.uncompiled.js +1 -0
  91. package/test/cast/cast_utils_unit.js +1 -0
  92. package/test/cea/cea608_memory_unit.js +1 -1
  93. package/test/cea/cea708_service_unit.js +8 -8
  94. package/test/cea/cea708_window_unit.js +6 -6
  95. package/test/cea/cea_decoder_unit.js +1 -1
  96. package/test/cea/dtvcc_packet_builder_unit.js +2 -2
  97. package/test/dash/dash_parser_manifest_unit.js +43 -1
  98. package/test/hls/hls_parser_unit.js +250 -0
  99. package/test/media/drm_engine_integration.js +86 -12
  100. package/test/media/drm_engine_unit.js +310 -450
  101. package/test/offline/manifest_convert_unit.js +2 -0
  102. package/test/offline/storage_integration.js +9 -19
  103. package/test/player_integration.js +85 -0
  104. package/test/player_src_equals_integration.js +85 -0
  105. package/test/player_unit.js +25 -37
  106. package/test/test/assets/chapters.srt +11 -0
  107. package/test/test/assets/chapters.vtt +10 -0
  108. package/test/test/assets/chapters2.vtt +10 -0
  109. package/test/test/util/cea_utils.js +12 -12
  110. package/test/test/util/fake_ad_manager.js +7 -0
  111. package/test/test/util/manifest_generator.js +2 -0
  112. package/test/test/util/manifest_parser_util.js +3 -1
  113. package/test/text/web_vtt_generator_unit.js +81 -7
  114. package/test/util/stream_utils_unit.js +118 -10
  115. package/ui/airplay_button.js +1 -1
  116. package/ui/audio_language_selection.js +2 -5
  117. package/ui/cast_button.js +4 -6
  118. package/ui/constants.js +0 -3
  119. package/ui/fast_forward_button.js +2 -3
  120. package/ui/fullscreen_button.js +1 -3
  121. package/ui/language_utils.js +1 -1
  122. package/ui/loop_button.js +1 -3
  123. package/ui/mute_button.js +1 -3
  124. package/ui/overflow_menu.js +2 -3
  125. package/ui/pip_button.js +5 -7
  126. package/ui/playback_rate_selection.js +3 -6
  127. package/ui/presentation_time.js +1 -3
  128. package/ui/resolution_selection.js +4 -7
  129. package/ui/rewind_button.js +2 -3
  130. package/ui/seek_bar.js +2 -4
  131. package/ui/spacer.js +1 -1
  132. package/ui/text_selection.js +8 -11
  133. package/ui/ui_utils.js +1 -1
  134. package/ui/volume_bar.js +1 -3
@@ -30,7 +30,7 @@ Set up controls with HTML data attributes:
30
30
  The data-shaka-player-cast-receiver-id tag allows you to provide a Cast Application ID that
31
31
  the cast button will cast to; the value provided here is the sample cast receiver. -->
32
32
  <div data-shaka-player-container style="max-width:40em"
33
- data-shaka-player-cast-receiver-id="1BA79154">
33
+ data-shaka-player-cast-receiver-id="E7271BEC">
34
34
  <!-- The data-shaka-player tag will make the UI library use this video element.
35
35
  If no video is provided, the UI will automatically make one inside the container div. -->
36
36
  <video autoplay data-shaka-player id="video" style="width:100%;height:100%"></video>
@@ -111,7 +111,7 @@ set up a listener for the 'caststatuschanged' events.
111
111
  <!-- Add a data-shaka-player-cast-receiver-id tag to provide a Cast Application ID that
112
112
  the cast button will cast to; the value provided here is the sample cast receiver. -->
113
113
  <div data-shaka-player-container style="max-width:40em"
114
- data-shaka-player-cast-receiver-id="1BA79154">
114
+ data-shaka-player-cast-receiver-id="E7271BEC">
115
115
  </div>
116
116
  ```
117
117
 
@@ -137,7 +137,7 @@ or a `<source>` tag inside it to enable auto loading of the specified content.
137
137
 
138
138
  ```html
139
139
  <div data-shaka-player-container style="max-width:40em"
140
- data-shaka-player-cast-receiver-id="1BA79154">
140
+ data-shaka-player-cast-receiver-id="E7271BEC">
141
141
  <!-- The manifest url in the src attribute will be automatically loaded -->
142
142
  <video autoplay data-shaka-player id="video" style="width:100%;height:100%"
143
143
  src="https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"></video>
@@ -148,7 +148,7 @@ or
148
148
 
149
149
  ```html
150
150
  <div data-shaka-player-container style="max-width:40em"
151
- data-shaka-player-cast-receiver-id="1BA79154">
151
+ data-shaka-player-cast-receiver-id="E7271BEC">
152
152
  <video autoplay data-shaka-player id="video" style="width:100%;height:100%">
153
153
  <!-- The manifest url in the src attribute will be auto loaded -->
154
154
  <source src="https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"/>
@@ -161,7 +161,7 @@ call to the first one fails.
161
161
 
162
162
  ```html
163
163
  <div data-shaka-player-container style="max-width:40em"
164
- data-shaka-player-cast-receiver-id="1BA79154">
164
+ data-shaka-player-cast-receiver-id="E7271BEC">
165
165
  <video autoplay data-shaka-player id="video" style="width:100%;height:100%">
166
166
  <!-- Try this first -->
167
167
  <source src="https://storage.googleapis.com/shaka-demo-assets/angel-one/dash.mpd"/>
package/externs/aria.js CHANGED
@@ -16,3 +16,9 @@ Element.prototype.ariaLabel;
16
16
 
17
17
  /** @type {string} */
18
18
  Element.prototype.ariaPressed;
19
+
20
+ /** @type {string} */
21
+ Element.prototype.ariaSelected;
22
+
23
+ /** @type {string} */
24
+ Element.prototype.ariaHidden;
@@ -33,6 +33,24 @@
33
33
  shaka.extern.AdsStats;
34
34
 
35
35
 
36
+ /**
37
+ * @typedef {{
38
+ * start: number,
39
+ * end: ?number
40
+ * }}
41
+ *
42
+ * @description
43
+ * Contains the times of a range of an Ad.
44
+ *
45
+ * @property {number} start
46
+ * The start time of the range, in milliseconds.
47
+ * @property {number} end
48
+ * The end time of the range, in milliseconds.
49
+ * @exportDoc
50
+ */
51
+ shaka.extern.AdCuePoint;
52
+
53
+
36
54
  /**
37
55
  * An object that's responsible for all the ad-related logic
38
56
  * in the player.
@@ -70,7 +88,7 @@ shaka.extern.IAdManager = class extends EventTarget {
70
88
  /**
71
89
  * @param {!google.ima.dai.api.StreamRequest} imaRequest
72
90
  * @param {string=} backupUrl
73
- * @return {!Promise.<!string>}
91
+ * @return {!Promise.<string>}
74
92
  */
75
93
  requestServerSideStream(imaRequest, backupUrl) {}
76
94
 
@@ -79,6 +97,11 @@ shaka.extern.IAdManager = class extends EventTarget {
79
97
  */
80
98
  replaceServerSideAdTagParameters(adTagParameters) {}
81
99
 
100
+ /**
101
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
102
+ */
103
+ getServerSideCuePoints() {}
104
+
82
105
  /**
83
106
  * Get statistics for the current playback session. If the player is not
84
107
  * playing content, this will return an empty stats object.
@@ -111,6 +111,7 @@ shaka.extern.InitDataOverride;
111
111
  * audioRobustness: string,
112
112
  * videoRobustness: string,
113
113
  * serverCertificate: Uint8Array,
114
+ * serverCertificateUri: string,
114
115
  * sessionType: string,
115
116
  * initData: Array.<!shaka.extern.InitDataOverride>,
116
117
  * keyIds: Set.<string>
@@ -150,6 +151,10 @@ shaka.extern.InitDataOverride;
150
151
  * A key-system-specific server certificate used to encrypt license requests.
151
152
  * Its use is optional and is meant as an optimization to avoid a round-trip
152
153
  * to request a certificate.
154
+ * @property {string} serverCertificateUri
155
+ * <i>Defaults to '', e.g., server certificate will be requested from the
156
+ * given URI if serverCertificate is not provided. Can be filled in by
157
+ * advanced DRM config.</i>
153
158
  * @property {Array.<!shaka.extern.InitDataOverride>} initData
154
159
  * <i>Defaults to [], e.g., no override.</i> <br>
155
160
  * A list of initialization data which override any initialization data found
@@ -328,7 +333,7 @@ shaka.extern.CreateSegmentIndexFunction;
328
333
  * The Stream's label, unique text that should describe the audio/text track.
329
334
  * @property {string} type
330
335
  * <i>Required.</i> <br>
331
- * Content type (e.g. 'video', 'audio' or 'text')
336
+ * Content type (e.g. 'video', 'audio' or 'text', 'image')
332
337
  * @property {boolean} primary
333
338
  * <i>Defaults to false.</i> <br>
334
339
  * True indicates that the player should use this Stream over others if user
@@ -194,6 +194,7 @@ shaka.extern.StreamDB;
194
194
  * appendWindowStart: number,
195
195
  * appendWindowEnd: number,
196
196
  * timestampOffset: number,
197
+ * tilesLayout: ?string,
197
198
  * dataKey: number
198
199
  * }}
199
200
  *
@@ -210,6 +211,10 @@ shaka.extern.StreamDB;
210
211
  * @property {number} timestampOffset
211
212
  * An offset which MediaSource will add to the segment's media timestamps
212
213
  * during ingestion, to align to the presentation timeline.
214
+ * @property {?string} tilesLayout
215
+ * The value is a grid-item-dimension consisting of two positive decimal
216
+ * integers in the format: column-x-row ('4x3'). It describes the
217
+ * arrangement of Images in a Grid. The minimum valid LAYOUT is '1x1'.
213
218
  * @property {number} dataKey
214
219
  * The key to the data in storage.
215
220
  */
@@ -516,6 +516,7 @@ shaka.extern.EmsgInfo;
516
516
  * videoRobustness: string,
517
517
  * audioRobustness: string,
518
518
  * serverCertificate: Uint8Array,
519
+ * serverCertificateUri: string,
519
520
  * individualizationServer: string,
520
521
  * sessionType: string
521
522
  * }}
@@ -545,6 +546,10 @@ shaka.extern.EmsgInfo;
545
546
  * A key-system-specific server certificate used to encrypt license requests.
546
547
  * Its use is optional and is meant as an optimization to avoid a round-trip
547
548
  * to request a certificate.
549
+ * @property {string} serverCertificateUri
550
+ * <i>Defaults to <code>''</code>.</i><br>
551
+ * If given, will make a request to the given URI to get the server
552
+ * certificate. This is ignored if <code>serverCertificate</code> is set.
548
553
  * @property {string} individualizationServer
549
554
  * The server that handles an <code>'individualiation-request'</code>. If the
550
555
  * server isn't given, it will default to the license server.
@@ -569,7 +574,8 @@ shaka.extern.AdvancedDrmConfiguration;
569
574
  * ((function(!Uint8Array, string, ?shaka.extern.DrmInfo):!Uint8Array)|
570
575
  * undefined),
571
576
  * logLicenseExchange: boolean,
572
- * updateExpirationTime: number
577
+ * updateExpirationTime: number,
578
+ * preferredKeySystems: !Array.<string>
573
579
  * }}
574
580
  *
575
581
  * @property {shaka.extern.RetryParameters} retryParameters
@@ -607,6 +613,9 @@ shaka.extern.AdvancedDrmConfiguration;
607
613
  * @property {number} updateExpirationTime
608
614
  * <i>Defaults to 1.</i> <br>
609
615
  * The frequency in seconds with which to check the expiration of a session.
616
+ * @property {!Array.<string>} preferredKeySystems
617
+ * <i>Defaults to an empty array. </i> <br>
618
+ * Specifies the priorties of available DRM key systems.
610
619
  *
611
620
  * @exportDoc
612
621
  */
@@ -625,7 +634,8 @@ shaka.extern.DrmConfiguration;
625
634
  * ignoreSuggestedPresentationDelay: boolean,
626
635
  * ignoreEmptyAdaptationSet: boolean,
627
636
  * ignoreMaxSegmentDuration: boolean,
628
- * keySystemsByURI: !Object.<string, string>
637
+ * keySystemsByURI: !Object.<string, string>,
638
+ * manifestPreprocessor: function(!Element)
629
639
  * }}
630
640
  *
631
641
  * @property {string} clockSyncUri
@@ -675,6 +685,10 @@ shaka.extern.DrmConfiguration;
675
685
  * @property {Object.<string, string>} keySystemsByURI
676
686
  * A map of scheme URI to key system name. Defaults to default key systems
677
687
  * mapping handled by Shaka.
688
+ * @property {function(!Element)} manifestPreprocessor
689
+ * Called immediately after the DASH manifest has been parsed into an
690
+ * XMLDocument. Provides a way for applications to perform efficient
691
+ * preprocessing of the manifest.
678
692
  * @exportDoc
679
693
  */
680
694
  shaka.extern.DashManifestConfiguration;
@@ -683,12 +697,16 @@ shaka.extern.DashManifestConfiguration;
683
697
  /**
684
698
  * @typedef {{
685
699
  * ignoreTextStreamFailures: boolean,
700
+ * ignoreImageStreamFailures: boolean,
686
701
  * useFullSegmentsForStartTime: boolean
687
702
  * }}
688
703
  *
689
704
  * @property {boolean} ignoreTextStreamFailures
690
705
  * If <code>true</code>, ignore any errors in a text stream and filter out
691
706
  * those streams.
707
+ * @property {boolean} ignoreImageStreamFailures
708
+ * If <code>true</code>, ignore any errors in a image stream and filter out
709
+ * those streams.
692
710
  * @property {boolean} useFullSegmentsForStartTime
693
711
  * If <code>true</code>, force HlsParser to use a full segment request for
694
712
  * determining start time in case the server does not support partial requests
@@ -771,7 +789,8 @@ shaka.extern.ManifestConfiguration;
771
789
  * lowLatencyMode: boolean,
772
790
  * autoLowLatencyMode: boolean,
773
791
  * forceHTTPS: boolean,
774
- * preferNativeHls: boolean
792
+ * preferNativeHls: boolean,
793
+ * updateIntervalSeconds: number
775
794
  * }}
776
795
  *
777
796
  * @description
@@ -878,6 +897,8 @@ shaka.extern.ManifestConfiguration;
878
897
  * If true, if the protocol is HTTP change it to HTTPs.
879
898
  * @property {boolean} preferNativeHls
880
899
  * If true, prefer native HLS playback when possible, regardless of platform.
900
+ * @property {number} updateIntervalSeconds
901
+ * The minimum number of seconds to see if the manifest has changes.
881
902
  *
882
903
  * @exportDoc
883
904
  */
@@ -971,13 +992,15 @@ shaka.extern.OfflineConfiguration;
971
992
  * preferredTextLanguage: string,
972
993
  * preferredVariantRole: string,
973
994
  * preferredTextRole: string,
995
+ * preferredVideoCodecs: !Array.<string>,
996
+ * preferredAudioCodecs: !Array.<string>,
974
997
  * preferredAudioChannelCount: number,
998
+ * preferredDecodingAttributes: !Array.<string>,
975
999
  * preferForcedSubs: boolean,
976
1000
  * restrictions: shaka.extern.Restrictions,
977
1001
  * playRangeStart: number,
978
1002
  * playRangeEnd: number,
979
- * textDisplayFactory: shaka.extern.TextDisplayer.Factory,
980
- * useMediaCapabilities: boolean
1003
+ * textDisplayFactory: shaka.extern.TextDisplayer.Factory
981
1004
  * }}
982
1005
  *
983
1006
  * @property {shaka.extern.DrmConfiguration} drm
@@ -1005,8 +1028,15 @@ shaka.extern.OfflineConfiguration;
1005
1028
  * The preferred role to use for variants.
1006
1029
  * @property {string} preferredTextRole
1007
1030
  * The preferred role to use for text tracks.
1031
+ * @property {!Array.<string>} preferredVideoCodecs
1032
+ * The list of preferred video codecs, in order of highest to lowest priority.
1033
+ * @property {!Array.<string>} preferredAudioCodecs
1034
+ * The list of preferred audio codecs, in order of highest to lowest priority.
1008
1035
  * @property {number} preferredAudioChannelCount
1009
1036
  * The preferred number of audio channels.
1037
+ * @property {!Array.<string>} preferredDecodingAttributes
1038
+ * The list of preferred attributes of decodingInfo, in the order of their
1039
+ * priorities.
1010
1040
  * @property {boolean} preferForcedSubs
1011
1041
  * If true, a forced text track is preferred. Defaults to false.
1012
1042
  * If the content has no forced captions and the value is true,
@@ -1026,10 +1056,6 @@ shaka.extern.OfflineConfiguration;
1026
1056
  * @property {shaka.extern.TextDisplayer.Factory} textDisplayFactory
1027
1057
  * A factory to construct a text displayer. Note that, if this is changed
1028
1058
  * during playback, it will cause the text tracks to be reloaded.
1029
- * @property {boolean} useMediaCapabilities
1030
- * If true, use MediaCapabilities.decodingInfo() to filter the manifest, and
1031
- * get MediaKeys information for encrypted content. Default to false.
1032
- * Shaka Player's integration with MediaCapabilities is now in BETA.
1033
1059
  * @exportDoc
1034
1060
  */
1035
1061
  shaka.extern.PlayerConfiguration;
@@ -1056,6 +1082,8 @@ shaka.extern.LanguageRole;
1056
1082
 
1057
1083
  /**
1058
1084
  * @typedef {{
1085
+ * imageHeight: number,
1086
+ * imageWidth: number,
1059
1087
  * height: number,
1060
1088
  * positionX: number,
1061
1089
  * positionY: number,
@@ -1065,6 +1093,12 @@ shaka.extern.LanguageRole;
1065
1093
  * width: number
1066
1094
  * }}
1067
1095
  *
1096
+ * @property {number} imageHeight
1097
+ * The image height in px. The image height could be different to height if
1098
+ * the layout is different to 1x1.
1099
+ * @property {number} imageWidth
1100
+ * The image width in px. The image width could be different to width if
1101
+ * the layout is different to 1x1.
1068
1102
  * @property {number} height
1069
1103
  * The thumbnail height in px.
1070
1104
  * @property {number} positionX
@@ -1083,3 +1117,21 @@ shaka.extern.LanguageRole;
1083
1117
  * @exportDoc
1084
1118
  */
1085
1119
  shaka.extern.Thumbnail;
1120
+
1121
+
1122
+ /**
1123
+ * @typedef {{
1124
+ * title: string,
1125
+ * startTime: number,
1126
+ * endTime: number
1127
+ * }}
1128
+ *
1129
+ * @property {string} title
1130
+ * The title of the chapter.
1131
+ * @property {number} startTime
1132
+ * The time that describes the beginning of the range of the chapter.
1133
+ * @property {number} endTime
1134
+ * The time that describes the end of the range of chapter.
1135
+ * @exportDoc
1136
+ */
1137
+ shaka.extern.Chapter;
@@ -128,7 +128,7 @@ shaka.extern.Cue = class {
128
128
  /**
129
129
  * The text payload of the cue. If nestedCues is non-empty, this should be
130
130
  * empty. Top-level block containers should have no payload of their own.
131
- * @type {!string}
131
+ * @type {string}
132
132
  * @exportDoc
133
133
  */
134
134
  this.payload;
@@ -234,14 +234,14 @@ shaka.extern.Cue = class {
234
234
 
235
235
  /**
236
236
  * Text color as a CSS color, e.g. "#FFFFFF" or "white".
237
- * @type {!string}
237
+ * @type {string}
238
238
  * @exportDoc
239
239
  */
240
240
  this.color;
241
241
 
242
242
  /**
243
243
  * Text background color as a CSS color, e.g. "#FFFFFF" or "white".
244
- * @type {!string}
244
+ * @type {string}
245
245
  * @exportDoc
246
246
  */
247
247
  this.backgroundColor;
@@ -257,14 +257,14 @@ shaka.extern.Cue = class {
257
257
 
258
258
  /**
259
259
  * The URL of the background image, e.g. "data:[mime type];base64,[data]".
260
- * @type {!string}
260
+ * @type {string}
261
261
  * @exportDoc
262
262
  */
263
263
  this.backgroundImage;
264
264
 
265
265
  /**
266
266
  * The border around this cue as a CSS border.
267
- * @type {!string}
267
+ * @type {string}
268
268
  * @exportDoc
269
269
  */
270
270
  this.border;
@@ -292,28 +292,28 @@ shaka.extern.Cue = class {
292
292
 
293
293
  /**
294
294
  * Text font family.
295
- * @type {!string}
295
+ * @type {string}
296
296
  * @exportDoc
297
297
  */
298
298
  this.fontFamily;
299
299
 
300
300
  /**
301
301
  * Text letter spacing as a CSS letter-spacing value.
302
- * @type {!string}
302
+ * @type {string}
303
303
  * @exportDoc
304
304
  */
305
305
  this.letterSpacing;
306
306
 
307
307
  /**
308
308
  * Text line padding as a CSS line-padding value.
309
- * @type {!string}
309
+ * @type {string}
310
310
  * @exportDoc
311
311
  */
312
312
  this.linePadding;
313
313
 
314
314
  /**
315
315
  * Opacity of the cue element, from 0-1.
316
- * @type {!number}
316
+ * @type {number}
317
317
  * @exportDoc
318
318
  */
319
319
  this.opacity;
@@ -335,7 +335,7 @@ shaka.extern.Cue = class {
335
335
 
336
336
  /**
337
337
  * Id of the cue.
338
- * @type {!string}
338
+ * @type {string}
339
339
  * @exportDoc
340
340
  */
341
341
  this.id;
@@ -20,3 +20,6 @@ TextTrack.prototype.kind;
20
20
 
21
21
  /** @type {string} */
22
22
  TextTrack.prototype.label;
23
+
24
+ /** @type {string} */
25
+ TextTrack.prototype.language;
@@ -6,7 +6,6 @@
6
6
 
7
7
 
8
8
  goog.provide('shaka.ads.AdManager');
9
- goog.provide('shaka.ads.CuePoint');
10
9
 
11
10
  goog.require('shaka.Player');
12
11
  goog.require('shaka.ads.AdsStats');
@@ -594,6 +593,22 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
594
593
  }
595
594
 
596
595
 
596
+ /**
597
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
598
+ * @override
599
+ * @export
600
+ */
601
+ getServerSideCuePoints() {
602
+ if (!this.ssAdManager_) {
603
+ throw new shaka.util.Error(
604
+ shaka.util.Error.Severity.RECOVERABLE,
605
+ shaka.util.Error.Category.ADS,
606
+ shaka.util.Error.Code.SS_AD_MANAGER_NOT_INITIALIZED);
607
+ }
608
+ return this.ssAdManager_.getCuePoints();
609
+ }
610
+
611
+
597
612
  /**
598
613
  * @return {shaka.extern.AdsStats}
599
614
  * @override
@@ -646,20 +661,6 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
646
661
  }
647
662
  };
648
663
 
649
-
650
- shaka.ads.CuePoint = class {
651
- /**
652
- * @param {number} start
653
- * @param {?number=} end
654
- */
655
- constructor(start, end = null) {
656
- /** @public {number} */
657
- this.start = start;
658
- /** @public {?number} */
659
- this.end = end;
660
- }
661
- };
662
-
663
664
  /**
664
665
  * The event name for when a sequence of ads has been loaded.
665
666
  *
@@ -162,10 +162,14 @@ shaka.ads.ClientSideAdManager = class {
162
162
 
163
163
  const cuePointStarts = this.imaAdsManager_.getCuePoints();
164
164
  if (cuePointStarts.length) {
165
- /** @type {!Array.<!shaka.ads.CuePoint>} */
165
+ /** @type {!Array.<!shaka.extern.AdCuePoint>} */
166
166
  const cuePoints = [];
167
167
  for (const start of cuePointStarts) {
168
- const shakaCuePoint = new shaka.ads.CuePoint(start);
168
+ /** @type {shaka.extern.AdCuePoint} */
169
+ const shakaCuePoint = {
170
+ start: start,
171
+ end: null,
172
+ };
169
173
  cuePoints.push(shakaCuePoint);
170
174
  }
171
175
 
@@ -64,6 +64,9 @@ shaka.ads.ServerSideAdManager = class {
64
64
  /** @private {string} */
65
65
  this.backupUrl_ = '';
66
66
 
67
+ /** @private {!Array.<!shaka.extern.AdCuePoint>} */
68
+ this.currentCuePoints_ = [];
69
+
67
70
  /** @private {shaka.util.EventManager} */
68
71
  this.eventManager_ = new shaka.util.EventManager();
69
72
 
@@ -212,6 +215,7 @@ shaka.ads.ServerSideAdManager = class {
212
215
  // this.streamManager_.reset();
213
216
  this.backupUrl_ = '';
214
217
  this.snapForwardTime_ = null;
218
+ this.currentCuePoints_ = [];
215
219
  }
216
220
 
217
221
  /** @override */
@@ -249,6 +253,13 @@ shaka.ads.ServerSideAdManager = class {
249
253
  }
250
254
  }
251
255
 
256
+ /**
257
+ * @return {!Array.<!shaka.extern.AdCuePoint>}
258
+ */
259
+ getCuePoints() {
260
+ return this.currentCuePoints_;
261
+ }
262
+
252
263
  /**
253
264
  * If a seek jumped over the ad break, return to the start of the
254
265
  * ad break, then complete the seek after the ad played through.
@@ -376,13 +387,19 @@ shaka.ads.ServerSideAdManager = class {
376
387
  onCuePointsChanged_(e) {
377
388
  const streamData = e.getStreamData();
378
389
 
379
- /** @type {!Array.<!shaka.ads.CuePoint>} */
390
+ /** @type {!Array.<!shaka.extern.AdCuePoint>} */
380
391
  const cuePoints = [];
381
392
  for (const point of streamData.cuepoints) {
382
- const shakaCuePoint = new shaka.ads.CuePoint(point.start, point.end);
393
+ /** @type {shaka.extern.AdCuePoint} */
394
+ const shakaCuePoint = {
395
+ start: point.start,
396
+ end: point.end,
397
+ };
383
398
  cuePoints.push(shakaCuePoint);
384
399
  }
385
400
 
401
+ this.currentCuePoints_ = cuePoints;
402
+
386
403
  this.onEvent_(new shaka.util.FakeEvent(
387
404
  shaka.ads.AdManager.CUEPOINTS_CHANGED,
388
405
  (new Map()).set('cuepoints', cuePoints)));
@@ -648,6 +648,14 @@ shaka.cast.CastProxy = class extends shaka.util.FakeEventTarget {
648
648
  return () => this.localPlayer_.getNetworkingEngine();
649
649
  }
650
650
 
651
+ if (name == 'getDrmEngine') {
652
+ // Always returns a local instance.
653
+ if (this.sender_.isCasting()) {
654
+ shaka.log.warning('NOTE: getDrmEngine() is always local!');
655
+ }
656
+ return () => this.localPlayer_.getDrmEngine();
657
+ }
658
+
651
659
  if (name == 'getAdManager') {
652
660
  // Always returns a local instance.
653
661
  if (this.sender_.isCasting()) {
@@ -305,10 +305,11 @@ shaka.cast.CastUtils.PlayerGetterMethods = {
305
305
  'getAssetUri': 2,
306
306
  'getAudioLanguages': 4,
307
307
  'getAudioLanguagesAndRoles': 4,
308
+ 'getBufferFullness': 1,
308
309
  'getBufferedInfo': 2,
309
310
  // NOTE: The 'getSharedConfiguration' property is not proxied as it would
310
311
  // not be possible to share a reference.
311
- 'getConfiguration': 2,
312
+ 'getConfiguration': 4,
312
313
  'getExpiration': 2,
313
314
  'getKeyStatuses': 2,
314
315
  // NOTE: The 'getManifest' property is not proxied, as it is very large.
@@ -371,10 +372,13 @@ shaka.cast.CastUtils.PlayerInitAfterLoadState = [
371
372
  * @const {!Array.<string>}
372
373
  */
373
374
  shaka.cast.CastUtils.PlayerVoidMethods = [
375
+ 'addChaptersTrack',
374
376
  'addTextTrack',
375
377
  'addTextTrackAsync',
376
378
  'cancelTrickPlay',
377
379
  'configure',
380
+ 'getChapters',
381
+ 'getChaptersTracks',
378
382
  'resetConfiguration',
379
383
  'retryStreaming',
380
384
  'selectAudioLanguage',
@@ -384,6 +388,7 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
384
388
  'selectVariantsByLabel',
385
389
  'setTextTrackVisibility',
386
390
  'trickPlay',
391
+ 'goToLive',
387
392
  ];
388
393
 
389
394