shaka-player 4.9.6 → 4.9.8

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.
@@ -1793,6 +1793,7 @@ shaka.media.DrmEngine = class {
1793
1793
  'org.w3.clearkey',
1794
1794
  'com.widevine.alpha',
1795
1795
  'com.microsoft.playready',
1796
+ 'com.microsoft.playready.hardware',
1796
1797
  'com.microsoft.playready.recommendation',
1797
1798
  'com.chromecast.playready',
1798
1799
  'com.apple.fps.1_0',
@@ -1815,9 +1816,7 @@ shaka.media.DrmEngine = class {
1815
1816
 
1816
1817
  const testRobustness = {
1817
1818
  'com.widevine.alpha': widevineRobustness,
1818
- 'com.microsoft.playready': playreadyRobustness,
1819
1819
  'com.microsoft.playready.recommendation': playreadyRobustness,
1820
- 'com.chromecast.playready': playreadyRobustness,
1821
1820
  };
1822
1821
 
1823
1822
  const basicVideoCapabilities = [
@@ -110,19 +110,26 @@ shaka.media.SrcEqualsPlayhead = class {
110
110
  // We listen for the loaded-data-event so that we know when we can
111
111
  // interact with |currentTime|.
112
112
  const onLoaded = () => {
113
- if (this.startTime_ == null || this.startTime_ == 0) {
113
+ if (this.startTime_ == null ||
114
+ (this.startTime_ == 0 && this.mediaElement_.duration != Infinity)) {
114
115
  this.started_ = true;
115
116
  } else {
116
- // Startup is complete only when the video element acknowledges the
117
- // seek.
118
- this.eventManager_.listenOnce(this.mediaElement_, 'seeking', () => {
119
- this.started_ = true;
120
- });
121
-
122
117
  const currentTime = this.mediaElement_.currentTime;
118
+ let newTime = this.startTime_;
123
119
  // Using the currentTime allows using a negative number in Live HLS
124
- const newTime = Math.max(0, currentTime + this.startTime_);
125
- this.mediaElement_.currentTime = newTime;
120
+ if (this.startTime_ < 0) {
121
+ newTime = Math.max(0, currentTime + this.startTime_);
122
+ }
123
+ if (currentTime != newTime) {
124
+ // Startup is complete only when the video element acknowledges the
125
+ // seek.
126
+ this.eventManager_.listenOnce(this.mediaElement_, 'seeking', () => {
127
+ this.started_ = true;
128
+ });
129
+ this.mediaElement_.currentTime = newTime;
130
+ } else {
131
+ this.started_ = true;
132
+ }
126
133
  }
127
134
  };
128
135
 
@@ -179,6 +179,7 @@ shaka.media.SegmentUtils = class {
179
179
  break;
180
180
  case 'ac-3':
181
181
  case 'ec-3':
182
+ case 'ac-4':
182
183
  case 'opus':
183
184
  case 'flac':
184
185
  audioCodecs.push(codecLC);
@@ -207,6 +208,19 @@ shaka.media.SegmentUtils = class {
207
208
  /** @type {?string} */
208
209
  let baseBox;
209
210
 
211
+ const genericAudioBox = (box) => {
212
+ const parsedAudioSampleEntryBox =
213
+ shaka.util.Mp4BoxParsers.audioSampleEntry(box.reader);
214
+ channelCount = parsedAudioSampleEntryBox.channelCount;
215
+ sampleRate = parsedAudioSampleEntryBox.sampleRate;
216
+ codecBoxParser(box);
217
+ };
218
+
219
+ const genericVideoBox = (box) => {
220
+ baseBox = box.name;
221
+ Mp4Parser.visualSampleEntry(box);
222
+ };
223
+
210
224
  new Mp4Parser()
211
225
  .box('moov', Mp4Parser.children)
212
226
  .box('trak', Mp4Parser.children)
@@ -235,9 +249,10 @@ shaka.media.SegmentUtils = class {
235
249
  // AUDIO
236
250
  // These are the various boxes that signal a codec.
237
251
  .box('mp4a', (box) => {
238
- const parsedMP4ABox = shaka.util.Mp4BoxParsers.parseMP4A(box.reader);
239
- channelCount = parsedMP4ABox.channelCount;
240
- sampleRate = parsedMP4ABox.sampleRate;
252
+ const parsedAudioSampleEntryBox =
253
+ shaka.util.Mp4BoxParsers.audioSampleEntry(box.reader);
254
+ channelCount = parsedAudioSampleEntryBox.channelCount;
255
+ sampleRate = parsedAudioSampleEntryBox.sampleRate;
241
256
  if (box.reader.hasMoreData()) {
242
257
  Mp4Parser.children(box);
243
258
  } else {
@@ -249,54 +264,24 @@ shaka.media.SegmentUtils = class {
249
264
  audioCodecs.push(parsedESDSBox.codec);
250
265
  hasAudio = true;
251
266
  })
252
- .box('ac-3', codecBoxParser)
253
- .box('ec-3', codecBoxParser)
254
- .box('opus', codecBoxParser)
255
- .box('Opus', codecBoxParser)
256
- .box('fLaC', codecBoxParser)
267
+ .box('ac-3', genericAudioBox)
268
+ .box('ec-3', genericAudioBox)
269
+ .box('ac-4', genericAudioBox)
270
+ .box('Opus', genericAudioBox)
271
+ .box('fLaC', genericAudioBox)
257
272
 
258
273
  // VIDEO
259
274
  // These are the various boxes that signal a codec.
260
- .box('avc1', (box) => {
261
- baseBox = box.name;
262
- Mp4Parser.visualSampleEntry(box);
263
- })
264
- .box('avc3', (box) => {
265
- baseBox = box.name;
266
- Mp4Parser.visualSampleEntry(box);
267
- })
268
- .box('hev1', (box) => {
269
- baseBox = box.name;
270
- Mp4Parser.visualSampleEntry(box);
271
- })
272
- .box('hvc1', (box) => {
273
- baseBox = box.name;
274
- Mp4Parser.visualSampleEntry(box);
275
- })
276
- .box('dva1', (box) => {
277
- baseBox = box.name;
278
- Mp4Parser.visualSampleEntry(box);
279
- })
280
- .box('dvav', (box) => {
281
- baseBox = box.name;
282
- Mp4Parser.visualSampleEntry(box);
283
- })
284
- .box('dvh1', (box) => {
285
- baseBox = box.name;
286
- Mp4Parser.visualSampleEntry(box);
287
- })
288
- .box('dvhe', (box) => {
289
- baseBox = box.name;
290
- Mp4Parser.visualSampleEntry(box);
291
- })
292
- .box('vp09', (box) => {
293
- baseBox = box.name;
294
- Mp4Parser.visualSampleEntry(box);
295
- })
296
- .box('av01', (box) => {
297
- baseBox = box.name;
298
- Mp4Parser.visualSampleEntry(box);
299
- })
275
+ .box('avc1', genericVideoBox)
276
+ .box('avc3', genericVideoBox)
277
+ .box('hev1', genericVideoBox)
278
+ .box('hvc1', genericVideoBox)
279
+ .box('dva1', genericVideoBox)
280
+ .box('dvav', genericVideoBox)
281
+ .box('dvh1', genericVideoBox)
282
+ .box('dvhe', genericVideoBox)
283
+ .box('vp09', genericVideoBox)
284
+ .box('av01', genericVideoBox)
300
285
  .box('avcC', (box) => {
301
286
  let codecBase = baseBox || '';
302
287
  switch (baseBox) {
@@ -134,6 +134,12 @@ shaka.media.StreamingEngine = class {
134
134
  projection: null,
135
135
  hfov: null,
136
136
  };
137
+
138
+ /** @private {number} */
139
+ this.playRangeStart_ = 0;
140
+
141
+ /** @private {number} */
142
+ this.playRangeEnd_ = Infinity;
137
143
  }
138
144
 
139
145
  /** @override */
@@ -251,6 +257,20 @@ shaka.media.StreamingEngine = class {
251
257
  }
252
258
 
253
259
 
260
+ /**
261
+ * Applies a playback range. This will only affect non-live content.
262
+ *
263
+ * @param {number} playRangeStart
264
+ * @param {number} playRangeEnd
265
+ */
266
+ applyPlayRange(playRangeStart, playRangeEnd) {
267
+ if (!this.manifest_.presentationTimeline.isLive()) {
268
+ this.playRangeStart_ = playRangeStart;
269
+ this.playRangeEnd_ = playRangeEnd;
270
+ }
271
+ }
272
+
273
+
254
274
  /**
255
275
  * Initialize and start streaming.
256
276
  *
@@ -1899,10 +1919,11 @@ shaka.media.StreamingEngine = class {
1899
1919
  // Rounding issues can cause us to remove the first frame of a Period, so
1900
1920
  // reduce the window start time slightly.
1901
1921
  const appendWindowStart = Math.max(0,
1902
- reference.appendWindowStart -
1922
+ Math.max(reference.appendWindowStart, this.playRangeStart_) -
1903
1923
  StreamingEngine.APPEND_WINDOW_START_FUDGE_);
1904
1924
  const appendWindowEnd =
1905
- reference.appendWindowEnd + StreamingEngine.APPEND_WINDOW_END_FUDGE_;
1925
+ Math.min(reference.appendWindowEnd, this.playRangeEnd_) +
1926
+ StreamingEngine.APPEND_WINDOW_END_FUDGE_;
1906
1927
 
1907
1928
  goog.asserts.assert(
1908
1929
  reference.startTime <= appendWindowEnd,
package/lib/player.js CHANGED
@@ -2401,6 +2401,8 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2401
2401
  this.config_.playRangeStart,
2402
2402
  this.config_.playRangeEnd);
2403
2403
 
2404
+ this.streamingEngine_.applyPlayRange(
2405
+ this.config_.playRangeStart, this.config_.playRangeEnd);
2404
2406
 
2405
2407
  const setupPlayhead = (startTime) => {
2406
2408
  this.playhead_ = this.createPlayhead(startTime);
@@ -7457,7 +7459,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7457
7459
  * @export
7458
7460
  */
7459
7461
  // eslint-disable-next-line no-useless-concat
7460
- shaka.Player.version = 'v4.9.6' + '-uncompiled'; // x-release-please-version
7462
+ shaka.Player.version = 'v4.9.8' + '-uncompiled'; // x-release-please-version
7461
7463
 
7462
7464
  // Initialize the deprecation system using the version string we just set
7463
7465
  // on the player.
@@ -174,7 +174,12 @@ shaka.util.MimeUtils = class {
174
174
  return 'hevc'; // H265
175
175
  case base === 'dvh1':
176
176
  case base === 'dvhe':
177
- return 'dovi'; // Dolby Vision
177
+ return 'dovi-hevc'; // Dolby Vision based in HEVC
178
+ case base === 'dvav':
179
+ case base === 'dva1':
180
+ return 'dovi-avc'; // Dolby Vision based in AVC
181
+ case base === 'dav1':
182
+ return 'dovi-av1'; // Dolby Vision based in AV1
178
183
  }
179
184
  return base;
180
185
  }
@@ -275,11 +275,11 @@ shaka.util.Mp4BoxParsers = class {
275
275
  }
276
276
 
277
277
  /**
278
- * Parses a MP4A box.
278
+ * Parses an audio sample entry box.
279
279
  * @param {!shaka.util.DataViewReader} reader
280
- * @return {!shaka.util.ParsedMP4ABox}
280
+ * @return {!shaka.util.ParsedAudioSampleEntryBox}
281
281
  */
282
- static parseMP4A(reader) {
282
+ static audioSampleEntry(reader) {
283
283
  reader.skip(6); // Skip "reserved"
284
284
  reader.skip(2); // Skip "data_reference_index"
285
285
  reader.skip(8); // Skip "reserved"
@@ -820,7 +820,7 @@ shaka.util.ParsedTENCBox;
820
820
  *
821
821
  * @exportDoc
822
822
  */
823
- shaka.util.ParsedMP4ABox;
823
+ shaka.util.ParsedAudioSampleEntryBox;
824
824
 
825
825
  /**
826
826
  * @typedef {{
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "shaka-player",
3
3
  "description": "DASH/EME video player library",
4
- "version": "4.9.6",
4
+ "version": "4.9.8",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -2,6 +2,7 @@
2
2
  "AD_DURATION": "Duración del anuncio",
3
3
  "AD_PROGRESS": "Anuncio [AD_ON] de [NUM_ADS]",
4
4
  "AD_TIME": "Anuncio: [AD_TIME]",
5
+ "AIRPLAY": "AirPlay",
5
6
  "AUTO_QUALITY": "Automático",
6
7
  "BACK": "Atrás",
7
8
  "CAPTIONS": "Subtítulos",
@@ -26,6 +27,7 @@
26
27
  "PICTURE_IN_PICTURE": "Imagen en imagen",
27
28
  "PLAY": "Reproducir",
28
29
  "PLAYBACK_RATE": "Velocidad de reproducción",
30
+ "QUALITY": "Calidad",
29
31
  "RECENTER_VR": "Recentrar",
30
32
  "RESOLUTION": "Resolución",
31
33
  "REWIND": "Rebobinar",
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "AD_DURATION": "Durée de l'annonce",
3
- "AD_PROGRESS": "Annonce [AD_ON] sur [NUM_ADS]",
4
- "AD_TIME": "Annonce : [AD_TIME]",
3
+ "AD_PROGRESS": "Annonce [AD_ON] sur [NUM_ADS]",
4
+ "AD_STATISTICS": "Statistiques de la annonce",
5
+ "AD_TIME": "Annonce : [AD_TIME]",
6
+ "AIRPLAY": "AirPlay",
5
7
  "AUTO_QUALITY": "Automatique",
6
8
  "BACK": "Retour",
7
9
  "CAPTIONS": "Sous-titres",
@@ -10,7 +12,7 @@
10
12
  "ENTER_PICTURE_IN_PICTURE": "Utiliser le mode Picture-in-Picture",
11
13
  "EXIT_FULL_SCREEN": "Quitter le mode plein écran",
12
14
  "EXIT_LOOP_MODE": "Arrêter la lecture en boucle de la vidéo en cours",
13
- "EXIT_PICTURE_IN_PICTURE": "Quitter le mode PIP (Picture-in-picture)",
15
+ "EXIT_PICTURE_IN_PICTURE": "Quitter le mode PIP (Picture-in-picture)",
14
16
  "FAST_FORWARD": "Avance rapide",
15
17
  "FULL_SCREEN": "Plein écran",
16
18
  "LANGUAGE": "Langue",
@@ -26,11 +28,18 @@
26
28
  "PICTURE_IN_PICTURE": "Picture-in-Picture",
27
29
  "PLAY": "Visionner",
28
30
  "PLAYBACK_RATE": "Vitesse de lecture",
31
+ "QUALITY": "Qualité",
32
+ "RECENTER_VR": "Recentrer",
33
+ "REPLAY": "Rejouer",
29
34
  "RESOLUTION": "Résolution",
30
35
  "REWIND": "Retour arrière",
31
36
  "SEEK": "Chercher",
32
37
  "SKIP_AD": "Passer l'annonce",
33
38
  "SKIP_TO_LIVE": "Accéder à la partie la plus récente du direct",
39
+ "STATISTICS": "Statistiques",
40
+ "SUBTITLE_FORCED": "Forcé",
41
+ "SURROUND": "Surround",
42
+ "TOGGLE_STEREOSCOPIC": "Stéréoscopique ON/OFF",
34
43
  "UNDETERMINED_LANGUAGE": "Langue indéterminée",
35
44
  "UNMUTE": "Réactiver le son",
36
45
  "UNRECOGNIZED_LANGUAGE": "Non reconnu",
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "AD_DURATION": "Duração do anúncio",
3
3
  "AD_PROGRESS": "Anúncio [AD_ON] de [NUM_ADS]",
4
+ "AD_STATISTICS": "Estatísticas de anúncios",
4
5
  "AD_TIME": "Anúncio: [AD_TIME]",
6
+ "AIRPLAY": "AirPlay",
5
7
  "AUTO_QUALITY": "Automática",
6
8
  "BACK": "Voltar",
7
9
  "CAPTIONS": "Legendas",
@@ -26,11 +28,18 @@
26
28
  "PICTURE_IN_PICTURE": "Picture-in-picture",
27
29
  "PLAY": "Reproduzir",
28
30
  "PLAYBACK_RATE": "Velocidade da reprodução",
31
+ "QUALITY": "Qualidade",
32
+ "RECENTER_VR": "Recentralizar",
33
+ "REPLAY": "Replay",
29
34
  "RESOLUTION": "Resolução",
30
35
  "REWIND": "Retroceder",
31
36
  "SEEK": "Procurar",
32
37
  "SKIP_AD": "Pular anúncio",
33
38
  "SKIP_TO_LIVE": "Pular para transmissão ao vivo",
39
+ "STATISTICS": "Estatísticas",
40
+ "SUBTITLE_FORCED": "Forçado",
41
+ "SURROUND": "Surround",
42
+ "TOGGLE_STEREOSCOPIC": "Alternar estereoscópico",
34
43
  "UNDETERMINED_LANGUAGE": "Indeterminado",
35
44
  "UNMUTE": "Ativar som",
36
45
  "UNRECOGNIZED_LANGUAGE": "Não reconhecido",
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "AD_DURATION": "Duração do anúncio",
3
3
  "AD_PROGRESS": "Anúncio [AD_ON] de [NUM_ADS]",
4
+ "AD_STATISTICS": "Estatísticas de anúncios",
4
5
  "AD_TIME": "Anúncio: [AD_TIME]",
6
+ "AIRPLAY": "AirPlay",
5
7
  "AUTO_QUALITY": "Automático",
6
8
  "BACK": "Anterior",
7
9
  "CAPTIONS": "Legendas",
@@ -26,11 +28,18 @@
26
28
  "PICTURE_IN_PICTURE": "Ecrã no ecrã",
27
29
  "PLAY": "Reproduzir",
28
30
  "PLAYBACK_RATE": "Velocidade de reprodução",
31
+ "QUALITY": "Qualidade",
32
+ "RECENTER_VR": "Recentrar",
33
+ "REPLAY": "Repetição",
29
34
  "RESOLUTION": "Resolução",
30
35
  "REWIND": "Rebobinar",
31
36
  "SEEK": "Procurar",
32
37
  "SKIP_AD": "Ignorar anúncio",
33
38
  "SKIP_TO_LIVE": "Avançar para o direto",
39
+ "STATISTICS": "Estatísticas",
40
+ "SUBTITLE_FORCED": "Forçado",
41
+ "SURROUND": "Envolvente",
42
+ "TOGGLE_STEREOSCOPIC": "Alternar estereoscópico",
34
43
  "UNDETERMINED_LANGUAGE": "Indeterminado",
35
44
  "UNMUTE": "Reativar o som",
36
45
  "UNRECOGNIZED_LANGUAGE": "Não reconhecido",