shaka-player 4.10.21 → 4.10.22

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.
@@ -1322,11 +1322,13 @@ shaka.dash.DashParser = class {
1322
1322
  for (let i = 0; i < periodNodes.length; i++) {
1323
1323
  const elem = periodNodes[i];
1324
1324
  const next = periodNodes[i + 1];
1325
- const start = /** @type {number} */ (
1325
+ let start = /** @type {number} */ (
1326
1326
  TXml.parseAttr(elem, 'start', TXml.parseDuration, prevEnd));
1327
1327
  const periodId = elem.attributes['id'];
1328
1328
  const givenDuration =
1329
1329
  TXml.parseAttr(elem, 'duration', TXml.parseDuration);
1330
+ start = (i == 0 && start == 0 && this.isTransitionFromDynamicToStatic_) ?
1331
+ seekRangeStart : start;
1330
1332
 
1331
1333
  let periodDuration = null;
1332
1334
  if (next) {
@@ -1336,7 +1338,7 @@ shaka.dash.DashParser = class {
1336
1338
  const nextStart =
1337
1339
  TXml.parseAttr(next, 'start', TXml.parseDuration);
1338
1340
  if (nextStart != null) {
1339
- periodDuration = nextStart - start;
1341
+ periodDuration = nextStart - start + seekRangeStart;
1340
1342
  }
1341
1343
  } else if (presentationDuration != null) {
1342
1344
  // "The Period extends until the Period.start of the next Period, or
@@ -787,7 +787,7 @@ shaka.dash.TimelineSegmentIndex = class extends shaka.media.SegmentIndex {
787
787
  if (currentTimeline.length) {
788
788
  const lastCurrentEntry = currentTimeline[currentTimeline.length - 1];
789
789
  newEntries = info.timeline.filter((entry) => {
790
- return entry.start >= lastCurrentEntry.end;
790
+ return entry.end > lastCurrentEntry.end;
791
791
  });
792
792
  } else {
793
793
  newEntries = info.timeline.slice();
@@ -116,7 +116,7 @@ shaka.media.MediaSourceEngine = class {
116
116
  /** @private {boolean} */
117
117
  this.playbackHasBegun_ = false;
118
118
 
119
- /** @private {(MediaSource|ManagedMediaSource)} */
119
+ /** @private {MediaSource} */
120
120
  this.mediaSource_ = this.createMediaSource(this.mediaSourceOpen_);
121
121
 
122
122
  /** @private {boolean} */
@@ -175,13 +175,16 @@ shaka.media.MediaSourceEngine = class {
175
175
  * Replaced by unit tests.
176
176
  *
177
177
  * @param {!shaka.util.PublicPromise} p
178
- * @return {!(MediaSource|ManagedMediaSource)}
178
+ * @return {!MediaSource}
179
179
  */
180
180
  createMediaSource(p) {
181
+ /** @type {!MediaSource} */
182
+ let mediaSource;
183
+
181
184
  if (window.ManagedMediaSource) {
182
185
  this.video_.disableRemotePlayback = true;
183
186
 
184
- const mediaSource = new ManagedMediaSource();
187
+ mediaSource = new ManagedMediaSource();
185
188
 
186
189
  this.eventManager_.listen(
187
190
  mediaSource, 'startstreaming', () => {
@@ -192,39 +195,25 @@ shaka.media.MediaSourceEngine = class {
192
195
  mediaSource, 'endstreaming', () => {
193
196
  this.streamingAllowed_ = false;
194
197
  });
195
-
196
- this.eventManager_.listenOnce(
197
- mediaSource, 'sourceopen', () => this.onSourceOpen_(p));
198
-
199
- // Correctly set when playback has begun.
200
- this.eventManager_.listenOnce(this.video_, 'playing', () => {
201
- this.playbackHasBegun_ = true;
202
- });
203
-
204
- this.url_ = shaka.media.MediaSourceEngine.createObjectURL(mediaSource);
205
-
206
- this.video_.src = this.url_;
207
-
208
- return mediaSource;
209
198
  } else {
210
- const mediaSource = new MediaSource();
199
+ mediaSource = new MediaSource();
200
+ }
211
201
 
212
- // Set up MediaSource on the video element.
213
- this.eventManager_.listenOnce(
214
- mediaSource, 'sourceopen', () => this.onSourceOpen_(p));
202
+ // Set up MediaSource on the video element.
203
+ this.eventManager_.listenOnce(
204
+ mediaSource, 'sourceopen', () => this.onSourceOpen_(p));
215
205
 
216
- // Correctly set when playback has begun.
217
- this.eventManager_.listenOnce(this.video_, 'playing', () => {
218
- this.playbackHasBegun_ = true;
219
- });
206
+ // Correctly set when playback has begun.
207
+ this.eventManager_.listenOnce(this.video_, 'playing', () => {
208
+ this.playbackHasBegun_ = true;
209
+ });
220
210
 
221
- // Store the object URL for releasing it later.
222
- this.url_ = shaka.media.MediaSourceEngine.createObjectURL(mediaSource);
211
+ // Store the object URL for releasing it later.
212
+ this.url_ = shaka.media.MediaSourceEngine.createObjectURL(mediaSource);
223
213
 
224
- this.video_.src = this.url_;
214
+ this.video_.src = this.url_;
225
215
 
226
- return mediaSource;
227
- }
216
+ return mediaSource;
228
217
  }
229
218
 
230
219
  /**
@@ -427,7 +427,9 @@ shaka.media.MediaSourcePlayhead = class {
427
427
  // infinite loop on systems where changing currentTime takes a
428
428
  // significant amount of time (e.g. Chromecast).
429
429
  const time = Date.now() / 1000;
430
- if (!this.lastCorrectiveSeek_ || this.lastCorrectiveSeek_ < time - 1) {
430
+ const seekDelay = shaka.util.Platform.isFuchsiaCastDevice() ? 3 : 1;
431
+ if (!this.lastCorrectiveSeek_ ||
432
+ this.lastCorrectiveSeek_ < time - seekDelay) {
431
433
  this.lastCorrectiveSeek_ = time;
432
434
  canCorrectiveSeek = true;
433
435
  }
package/lib/player.js CHANGED
@@ -2890,6 +2890,11 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
2890
2890
  }
2891
2891
  }
2892
2892
  mediaElement.src = playbackUri;
2893
+ // If ManagedMediaSource exists, we've disabled remote playback on our own.
2894
+ // Reenable it so AirPlay can be used via RemotePlayback API.
2895
+ if (this.mediaSourceEngine_ && window.ManagedMediaSource) {
2896
+ mediaElement.disableRemotePlayback = false;
2897
+ }
2893
2898
 
2894
2899
  // Tizen 3 / WebOS won't load anything unless you call load() explicitly,
2895
2900
  // no matter the value of the preload attribute. This is harmful on some
@@ -7859,7 +7864,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
7859
7864
  * @export
7860
7865
  */
7861
7866
  // eslint-disable-next-line no-useless-concat, max-len
7862
- shaka.Player.version = 'v4.10.21' + '-uncompiled'; // x-release-please-version
7867
+ shaka.Player.version = 'v4.10.22' + '-uncompiled'; // x-release-please-version
7863
7868
 
7864
7869
  // Initialize the deprecation system using the version string we just set
7865
7870
  // on the player.
@@ -629,7 +629,7 @@ shaka.util.Platform = class {
629
629
  *
630
630
  * Some devices are known not to support `MediaSource.changeType`
631
631
  * well. These devices should use the reload strategy. If a device
632
- * reports that it supports `changeType` but support it reliabley
632
+ * reports that it supports `changeType` but support it unreliably
633
633
  * it should be added to this list.
634
634
  *
635
635
  * @return {boolean}
@@ -638,7 +638,8 @@ shaka.util.Platform = class {
638
638
  const Platform = shaka.util.Platform;
639
639
  if (Platform.isTizen2() || Platform.isTizen3() || Platform.isTizen4() ||
640
640
  Platform.isTizen5() || Platform.isTizen6() || Platform.isWebOS3() ||
641
- Platform.isWebOS4() || Platform.isWebOS5()) {
641
+ Platform.isWebOS4() || Platform.isWebOS5() || Platform.isPS4() ||
642
+ Platform.isPS5()) {
642
643
  return false;
643
644
  }
644
645
  // Older chromecasts without GoogleTV seem to not support SMOOTH properly.
@@ -11,6 +11,7 @@ goog.require('shaka.abr.SimpleAbrManager');
11
11
  goog.require('shaka.config.AutoShowText');
12
12
  goog.require('shaka.config.CodecSwitchingStrategy');
13
13
  goog.require('shaka.log');
14
+ goog.require('shaka.media.Capabilities');
14
15
  goog.require('shaka.net.NetworkingEngine');
15
16
  goog.require('shaka.util.ConfigUtils');
16
17
  goog.require('shaka.util.FairPlayUtils');
@@ -103,7 +104,8 @@ shaka.util.PlayerConfiguration = class {
103
104
 
104
105
  let codecSwitchingStrategy = shaka.config.CodecSwitchingStrategy.RELOAD;
105
106
  let multiTypeVariantsAllowed = false;
106
- if (shaka.util.Platform.supportsSmoothCodecSwitching()) {
107
+ if (shaka.media.Capabilities.isChangeTypeSupported() &&
108
+ shaka.util.Platform.supportsSmoothCodecSwitching()) {
107
109
  codecSwitchingStrategy = shaka.config.CodecSwitchingStrategy.SMOOTH;
108
110
  multiTypeVariantsAllowed = true;
109
111
  }
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.10.21",
4
+ "version": "4.10.22",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -72,7 +72,7 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
72
72
 
73
73
  shaka.ui.Utils.setDisplay(this.remoteButton_, false);
74
74
 
75
- if (!this.video.remote || this.video.disableRemotePlayback) {
75
+ if (!this.video.remote) {
76
76
  this.remoteButton_.classList.add('shaka-hidden');
77
77
  } else {
78
78
  this.eventManager.listen(
@@ -138,10 +138,11 @@ shaka.ui.RemoteButton = class extends shaka.ui.Element {
138
138
  } else if (this.video.remote.state == 'disconnected') {
139
139
  const handleAvailabilityChange = (availability) => {
140
140
  if (this.player) {
141
+ const disableRemote = this.video.disableRemotePlayback;
141
142
  const loadMode = this.player.getLoadMode();
142
143
  const srcMode = loadMode == shaka.Player.LoadMode.SRC_EQUALS;
143
144
  shaka.ui.Utils.setDisplay(
144
- this.remoteButton_, srcMode && availability);
145
+ this.remoteButton_, srcMode && availability && !disableRemote);
145
146
  } else {
146
147
  shaka.ui.Utils.setDisplay(this.remoteButton_, false);
147
148
  }
@@ -159,6 +159,9 @@ shaka.ui.SaveVideoFrameButton = class extends shaka.ui.Element {
159
159
  if (this.ad) {
160
160
  available = false;
161
161
  }
162
+ if (this.video.remote && this.video.remote.state != 'disconnected') {
163
+ available = false;
164
+ }
162
165
  shaka.ui.Utils.setDisplay(this.button_, available);
163
166
  }
164
167