shaka-player 4.12.2 → 4.12.4

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 (51) hide show
  1. package/.csslintrc +2 -1
  2. package/dist/controls.css +3 -3
  3. package/dist/controls.css.map +1 -1
  4. package/dist/deps.js +5 -4
  5. package/dist/locales.js +35 -35
  6. package/dist/shaka-player.compiled.d.ts +1 -1
  7. package/dist/shaka-player.compiled.debug.d.ts +1 -1
  8. package/dist/shaka-player.compiled.debug.js +299 -297
  9. package/dist/shaka-player.compiled.debug.map +4 -4
  10. package/dist/shaka-player.compiled.js +1287 -1282
  11. package/dist/shaka-player.compiled.map +4 -4
  12. package/dist/shaka-player.ui.d.ts +1 -1
  13. package/dist/shaka-player.ui.debug.d.ts +1 -1
  14. package/dist/shaka-player.ui.debug.js +302 -299
  15. package/dist/shaka-player.ui.debug.map +4 -4
  16. package/dist/shaka-player.ui.js +1515 -1510
  17. package/dist/shaka-player.ui.map +4 -4
  18. package/externs/managedmediasource.js +6 -0
  19. package/externs/shaka/ads.js +3 -0
  20. package/lib/ads/ad_utils.js +1 -0
  21. package/lib/ads/interstitial_ad.js +4 -2
  22. package/lib/ads/interstitial_ad_manager.js +79 -42
  23. package/lib/cast/cast_utils.js +4 -2
  24. package/lib/media/drm_engine.js +46 -6
  25. package/lib/media/media_source_capabilities.js +6 -8
  26. package/lib/media/media_source_engine.js +3 -4
  27. package/lib/media/preload_manager.js +9 -3
  28. package/lib/media/segment_utils.js +7 -3
  29. package/lib/net/http_xhr_plugin.js +1 -0
  30. package/lib/player.js +45 -39
  31. package/lib/text/vtt_text_parser.js +9 -4
  32. package/lib/util/abortable_operation.js +3 -0
  33. package/lib/util/buffer_utils.js +10 -8
  34. package/lib/util/functional.js +27 -0
  35. package/lib/util/mime_utils.js +2 -0
  36. package/lib/util/number_utils.js +37 -0
  37. package/lib/util/object_utils.js +1 -1
  38. package/lib/util/stream_utils.js +8 -1
  39. package/lib/util/uint8array_utils.js +3 -2
  40. package/package.json +2 -2
  41. package/ui/ad_position.js +2 -2
  42. package/ui/controls.js +5 -3
  43. package/ui/language_utils.js +3 -1
  44. package/ui/less/ad_controls.less +3 -3
  45. package/ui/less/buttons.less +4 -4
  46. package/ui/less/containers.less +7 -7
  47. package/ui/less/overflow_menu.less +4 -4
  48. package/ui/less/thumbnails.less +3 -3
  49. package/ui/less/tooltip.less +1 -1
  50. package/ui/play_button.js +5 -3
  51. package/ui/presentation_time.js +1 -1
package/lib/player.js CHANGED
@@ -58,6 +58,7 @@ goog.require('shaka.util.ManifestParserUtils');
58
58
  goog.require('shaka.util.MediaReadyState');
59
59
  goog.require('shaka.util.MimeUtils');
60
60
  goog.require('shaka.util.Mutex');
61
+ goog.require('shaka.util.NumberUtils');
61
62
  goog.require('shaka.util.ObjectUtils');
62
63
  goog.require('shaka.util.Platform');
63
64
  goog.require('shaka.util.PlayerConfiguration');
@@ -752,7 +753,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
752
753
  this.externalSrcEqualsThumbnailsStreams_ = [];
753
754
 
754
755
  /** @private {number} */
755
- this.completionPercent_ = NaN;
756
+ this.completionPercent_ = -1;
756
757
 
757
758
  /** @private {?shaka.extern.PlayerConfiguration} */
758
759
  this.config_ = this.defaultConfig_();
@@ -1507,7 +1508,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1507
1508
  // after several playbacks, and they are not able anymore to properly
1508
1509
  // create MediaKeys objects. To prevent it, clear the cache after
1509
1510
  // each playback.
1510
- if (this.config_.streaming.clearDecodingCache) {
1511
+ if (this.config_ && this.config_.streaming.clearDecodingCache) {
1511
1512
  shaka.util.StreamUtils.clearDecodingConfigCache();
1512
1513
  shaka.util.DrmUtils.clearMediaKeySystemAccessMap();
1513
1514
  }
@@ -1522,7 +1523,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
1522
1523
 
1523
1524
  this.externalSrcEqualsThumbnailsStreams_ = [];
1524
1525
 
1525
- this.completionPercent_ = NaN;
1526
+ this.completionPercent_ = -1;
1526
1527
 
1527
1528
  // Make sure that the app knows of the new buffering state.
1528
1529
  this.updateBufferState_();
@@ -6983,7 +6984,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6983
6984
  's). Updating playbackRate to ' + minPlaybackRate);
6984
6985
  this.trickPlay(minPlaybackRate, /* useTrickPlayTrack= */ false);
6985
6986
  }
6986
- } else if (maxLatency && maxPlaybackRate &&
6987
+ } else if (maxLatency != undefined && maxPlaybackRate &&
6987
6988
  (latency - offset) > maxLatency) {
6988
6989
  if (playbackRate != maxPlaybackRate) {
6989
6990
  shaka.log.debug('Latency (' + latency + 's) is greater than ' +
@@ -6992,7 +6993,7 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
6992
6993
  this.trickPlay(maxPlaybackRate, /* useTrickPlayTrack= */ false);
6993
6994
  }
6994
6995
  this.targetLatencyReached_ = null;
6995
- } else if (minLatency && minPlaybackRate &&
6996
+ } else if (minLatency != undefined && minPlaybackRate &&
6996
6997
  (latency - offset) < minLatency) {
6997
6998
  if (playbackRate != minPlaybackRate) {
6998
6999
  shaka.log.debug('Latency (' + latency + 's) is smaller than ' +
@@ -7016,41 +7017,46 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
7016
7017
  if (!this.video_) {
7017
7018
  return;
7018
7019
  }
7019
- let hasNewCompletionPercent = false;
7020
- const completionRatio = this.video_.currentTime / this.video_.duration;
7021
- if (!isNaN(completionRatio)) {
7022
- const percent = Math.round(100 * completionRatio);
7023
- if (isNaN(this.completionPercent_)) {
7024
- this.completionPercent_ = percent;
7025
- hasNewCompletionPercent = true;
7026
- } else {
7027
- const newCompletionPercent = Math.max(this.completionPercent_, percent);
7028
- if (this.completionPercent_ != newCompletionPercent) {
7029
- this.completionPercent_ = newCompletionPercent;
7030
- hasNewCompletionPercent = true;
7031
- }
7020
+
7021
+ const isQuartile = (quartilePercent, currentPercent) => {
7022
+ const NumberUtils = shaka.util.NumberUtils;
7023
+
7024
+ if ((NumberUtils.isFloatEqual(quartilePercent, currentPercent) ||
7025
+ currentPercent > quartilePercent) &&
7026
+ this.completionPercent_ < quartilePercent) {
7027
+ this.completionPercent_ = quartilePercent;
7028
+ return true;
7032
7029
  }
7030
+ return false;
7031
+ };
7032
+
7033
+ const completionRatio = this.video_.currentTime / this.video_.duration;
7034
+
7035
+ if (isNaN(completionRatio)) {
7036
+ return;
7033
7037
  }
7034
- if (hasNewCompletionPercent) {
7035
- let event;
7036
- if (this.completionPercent_ == 0) {
7037
- event = shaka.Player.makeEvent_(shaka.util.FakeEvent.EventName.Started);
7038
- } else if (this.completionPercent_ == 25) {
7039
- event = shaka.Player.makeEvent_(
7040
- shaka.util.FakeEvent.EventName.FirstQuartile);
7041
- } else if (this.completionPercent_ == 50) {
7042
- event = shaka.Player.makeEvent_(
7043
- shaka.util.FakeEvent.EventName.Midpoint);
7044
- } else if (this.completionPercent_ == 75) {
7045
- event = shaka.Player.makeEvent_(
7046
- shaka.util.FakeEvent.EventName.ThirdQuartile);
7047
- } else if (this.completionPercent_ == 100) {
7048
- event = shaka.Player.makeEvent_(
7049
- shaka.util.FakeEvent.EventName.Complete);
7050
- }
7051
- if (event) {
7052
- this.dispatchEvent(event);
7053
- }
7038
+
7039
+ const percent = completionRatio * 100;
7040
+
7041
+ let event;
7042
+ if (isQuartile(0, percent)) {
7043
+ event = shaka.Player.makeEvent_(shaka.util.FakeEvent.EventName.Started);
7044
+ } else if (isQuartile(25, percent)) {
7045
+ event = shaka.Player.makeEvent_(
7046
+ shaka.util.FakeEvent.EventName.FirstQuartile);
7047
+ } else if (isQuartile(50, percent)) {
7048
+ event = shaka.Player.makeEvent_(
7049
+ shaka.util.FakeEvent.EventName.Midpoint);
7050
+ } else if (isQuartile(75, percent)) {
7051
+ event = shaka.Player.makeEvent_(
7052
+ shaka.util.FakeEvent.EventName.ThirdQuartile);
7053
+ } else if (isQuartile(100, percent)) {
7054
+ event = shaka.Player.makeEvent_(
7055
+ shaka.util.FakeEvent.EventName.Complete);
7056
+ }
7057
+
7058
+ if (event) {
7059
+ this.dispatchEvent(event);
7054
7060
  }
7055
7061
  }
7056
7062
 
@@ -8269,7 +8275,7 @@ shaka.Player.TYPICAL_BUFFERING_THRESHOLD_ = 0.5;
8269
8275
  * @export
8270
8276
  */
8271
8277
  // eslint-disable-next-line no-useless-concat, max-len
8272
- shaka.Player.version = 'v4.12.2' + '-uncompiled'; // x-release-please-version
8278
+ shaka.Player.version = 'v4.12.4' + '-uncompiled'; // x-release-please-version
8273
8279
 
8274
8280
  // Initialize the deprecation system using the version string we just set
8275
8281
  // on the player.
@@ -83,10 +83,15 @@ shaka.text.VttTextParser = class {
83
83
  // HLS content, which should use X-TIMESTAMP-MAP and periodStart instead.
84
84
  let offset = time.vttOffset;
85
85
 
86
- // Only use 'X-TIMESTAMP-MAP' with HLS. This overrides offset above.
87
- if (blocks[0].includes('X-TIMESTAMP-MAP') &&
88
- this.manifestType_ == shaka.media.ManifestParser.HLS) {
89
- offset = this.computeHlsOffset_(blocks[0], time);
86
+ if (this.manifestType_ == shaka.media.ManifestParser.HLS) {
87
+ // Only use 'X-TIMESTAMP-MAP' with HLS.
88
+ if (blocks[0].includes('X-TIMESTAMP-MAP')) {
89
+ offset = this.computeHlsOffset_(blocks[0], time);
90
+ } else if (time.periodStart && time.vttOffset == time.periodStart) {
91
+ // In the case where X-TIMESTAMP-MAP is not used and it is HLS, we
92
+ // should not use offset unless segment-relative times are used.
93
+ offset = 0;
94
+ }
90
95
  }
91
96
 
92
97
  // Parse VTT regions.
@@ -166,6 +166,9 @@ shaka.util.AbortableOperation = class {
166
166
  */
167
167
  chain(onSuccess, onError) {
168
168
  const newPromise = new shaka.util.PublicPromise();
169
+ // Silence uncaught rejection errors, which may otherwise occur any place
170
+ // we don't explicitly handle aborted operations.
171
+ newPromise.catch(() => {});
169
172
  const abortError = shaka.util.AbortableOperation.abortError();
170
173
 
171
174
  // If called before "this" completes, just abort "this".
@@ -62,10 +62,10 @@ shaka.util.BufferUtils = class {
62
62
  * @private
63
63
  */
64
64
  static unsafeGetArrayBuffer_(view) {
65
- if (view instanceof ArrayBuffer) {
66
- return view;
65
+ if (!ArrayBuffer.isView(view)) {
66
+ return /** @type {!ArrayBuffer} */(view);
67
67
  } else {
68
- return view.buffer;
68
+ return /** @type {!ArrayBufferView} */(view).buffer;
69
69
  }
70
70
  }
71
71
 
@@ -79,17 +79,19 @@ shaka.util.BufferUtils = class {
79
79
  * @export
80
80
  */
81
81
  static toArrayBuffer(view) {
82
- if (view instanceof ArrayBuffer) {
83
- return view;
82
+ if (!ArrayBuffer.isView(view)) {
83
+ return /** @type {!ArrayBuffer} */(view);
84
84
  } else {
85
- if (view.byteOffset == 0 && view.byteLength == view.buffer.byteLength) {
85
+ const aView = /** @type {!ArrayBufferView} */(view);
86
+ if (aView.byteOffset == 0 &&
87
+ aView.byteLength == aView.buffer.byteLength) {
86
88
  // This is a TypedArray over the whole buffer.
87
- return view.buffer;
89
+ return aView.buffer;
88
90
  }
89
91
  // This is a "view" on the buffer. Create a new buffer that only contains
90
92
  // the data. Note that since this isn't an ArrayBuffer, the "new" call
91
93
  // will allocate a new buffer to hold the copy.
92
- return new Uint8Array(view).buffer;
94
+ return new Uint8Array(aView).buffer;
93
95
  }
94
96
  }
95
97
 
@@ -6,6 +6,8 @@
6
6
 
7
7
  goog.provide('shaka.util.Functional');
8
8
 
9
+ goog.require('shaka.util.Timer');
10
+
9
11
  /**
10
12
  * @summary A set of functional utility functions.
11
13
  */
@@ -67,4 +69,29 @@ shaka.util.Functional = class {
67
69
  static isNotNull(value) {
68
70
  return value != null;
69
71
  }
72
+
73
+ /**
74
+ * Returns a Promise which is resolved only if |asyncProcess| is resolved, and
75
+ * only if it is resolved in less than |seconds| seconds.
76
+ *
77
+ * If the returned Promise is resolved, it returns the same value as
78
+ * |asyncProcess|.
79
+ *
80
+ * If |asyncProcess| fails, the returned Promise is rejected.
81
+ * If |asyncProcess| takes too long, the returned Promise is rejected, but
82
+ * |asyncProcess| is still allowed to complete.
83
+ *
84
+ * @param {number} seconds
85
+ * @param {!Promise.<T>} asyncProcess
86
+ * @return {!Promise.<T>}
87
+ * @template T
88
+ */
89
+ static promiseWithTimeout(seconds, asyncProcess) {
90
+ return Promise.race([
91
+ asyncProcess,
92
+ new Promise(((_, reject) => {
93
+ new shaka.util.Timer(reject).tickAfter(seconds);
94
+ })),
95
+ ]);
96
+ }
70
97
  };
@@ -166,6 +166,8 @@ shaka.util.MimeUtils = class {
166
166
  return 'dtsx'; // DTS:X
167
167
  case base === 'mp4a' && profile === 'a9':
168
168
  return 'dtsc'; // DTS Digital Surround
169
+ case base === 'vp09':
170
+ return 'vp9';
169
171
  case base === 'avc1':
170
172
  case base === 'avc3':
171
173
  return 'avc'; // H264
@@ -0,0 +1,37 @@
1
+ /*! @license
2
+ * Shaka Player
3
+ * Copyright 2016 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ goog.provide('shaka.util.NumberUtils');
8
+
9
+
10
+ shaka.util.NumberUtils = class {
11
+ /**
12
+ * Compare two float numbers, taking a configurable tolerance margin into
13
+ * account.
14
+ *
15
+ * @param {number} a
16
+ * @param {number} b
17
+ * @param {number=} tolerance
18
+ * @return {boolean}
19
+ */
20
+ static isFloatEqual(a, b, tolerance = Number.EPSILON) {
21
+ if (a === b) {
22
+ return true;
23
+ }
24
+
25
+ const error = Math.abs(a - b);
26
+
27
+ if (error <= tolerance) {
28
+ return true;
29
+ }
30
+
31
+ if (tolerance !== Number.EPSILON) {
32
+ return Math.abs(error - tolerance) <= Number.EPSILON;
33
+ }
34
+
35
+ return false;
36
+ }
37
+ };
@@ -41,7 +41,7 @@ shaka.util.ObjectUtils = class {
41
41
 
42
42
  // This covers Uint8Array and friends, even without a TypedArray
43
43
  // base-class constructor.
44
- const isTypedArray = val.buffer instanceof ArrayBuffer;
44
+ const isTypedArray = ArrayBuffer.isView(val);
45
45
  if (isTypedArray) {
46
46
  return val;
47
47
  }
@@ -727,7 +727,14 @@ shaka.util.StreamUtils = class {
727
727
  mimeType, audioCodec);
728
728
  }
729
729
  promises.push(new Promise((resolve, reject) => {
730
- navigator.mediaCapabilities.decodingInfo(copy).then((res) => {
730
+ // On some (Android) WebView environments, decodingInfo will
731
+ // not resolve or reject, at least if RESOURCE_PROTECTED_MEDIA_ID
732
+ // is not set. This is a workaround for that issue.
733
+ const TIMEOUT_FOR_DECODING_INFO_IN_SECONDS = 1;
734
+ shaka.util.Functional.promiseWithTimeout(
735
+ TIMEOUT_FOR_DECODING_INFO_IN_SECONDS,
736
+ navigator.mediaCapabilities.decodingInfo(copy),
737
+ ).then((res) => {
731
738
  resolve(res);
732
739
  }).catch(reject);
733
740
  }));
@@ -119,8 +119,9 @@ shaka.util.Uint8ArrayUtils = class {
119
119
 
120
120
  for (let i = 0; i < varArgs.length; ++i) {
121
121
  const value = varArgs[i];
122
- if (value instanceof Uint8Array) {
123
- result.set(value, offset);
122
+ if (ArrayBuffer.isView(value) &&
123
+ /** @type {TypedArray} */ (value).BYTES_PER_ELEMENT === 1) {
124
+ result.set(/** @type {!Uint8Array} */(value), offset);
124
125
  } else {
125
126
  result.set(BufferUtils.toUint8(value), offset);
126
127
  }
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.12.2",
4
+ "version": "4.12.4",
5
5
  "homepage": "https://github.com/shaka-project/shaka-player",
6
6
  "author": "Google",
7
7
  "maintainers": [
@@ -105,7 +105,7 @@
105
105
  "prepublishOnly": "python build/checkversion.py && python build/all.py --force"
106
106
  },
107
107
  "dependencies": {
108
- "eme-encryption-scheme-polyfill": "^2.1.5"
108
+ "eme-encryption-scheme-polyfill": "^2.1.6"
109
109
  },
110
110
  "clean-package": {
111
111
  "remove": [
package/ui/ad_position.js CHANGED
@@ -91,9 +91,9 @@ shaka.ui.AdPosition = class extends shaka.ui.Element {
91
91
  */
92
92
  setPosition_() {
93
93
  const adsInAdPod = this.ad.getSequenceLength();
94
- if (adsInAdPod > 1) {
94
+ if (adsInAdPod > 1 && this.ad.isLinear()) {
95
95
  // If it's a single ad, showing 'Ad 1 of 1' isn't helpful.
96
- // Only show this element if there's more than 1 ad.
96
+ // Only show this element if there's more than 1 ad and it's a linear ad.
97
97
  const LocIds = shaka.ui.Locales.Ids;
98
98
  const adPosition = this.ad.getPositionInSequence();
99
99
  this.span_.textContent = this.localization.resolve(LocIds.AD_PROGRESS)
package/ui/controls.js CHANGED
@@ -1638,11 +1638,13 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
1638
1638
 
1639
1639
  /** @private */
1640
1640
  onPlayPauseClick_() {
1641
- if (this.ad_ && this.ad_.isLinear()) {
1641
+ if (this.ad_) {
1642
1642
  this.playPauseAd();
1643
- } else {
1644
- this.playPausePresentation();
1643
+ if (this.ad_.isLinear()) {
1644
+ return;
1645
+ }
1645
1646
  }
1647
+ this.playPausePresentation();
1646
1648
  }
1647
1649
 
1648
1650
  /** @private */
@@ -14,6 +14,7 @@ goog.require('shaka.ui.Overlay.TrackLabelFormat');
14
14
  goog.require('shaka.ui.Utils');
15
15
  goog.require('shaka.util.Dom');
16
16
  goog.require('shaka.util.LanguageUtils');
17
+ goog.require('shaka.util.MimeUtils');
17
18
  goog.requireType('shaka.ui.Localization');
18
19
 
19
20
 
@@ -48,7 +49,8 @@ shaka.ui.LanguageUtils = class {
48
49
  if (!codecsByLanguage.has(track.language)) {
49
50
  codecsByLanguage.set(track.language, new Set());
50
51
  }
51
- codecsByLanguage.get(track.language).add(track.audioCodec);
52
+ codecsByLanguage.get(track.language).add(
53
+ shaka.util.MimeUtils.getNormalizedCodec(track.audioCodec));
52
54
  }
53
55
  const hasDifferentAudioCodecs = (language) =>
54
56
  codecsByLanguage.has(language) && codecsByLanguage.get(language).size > 1;
@@ -95,11 +95,11 @@
95
95
 
96
96
  .shaka-skip-ad-button {
97
97
  padding: 5px 15px;
98
- background: rgba(0 0 0 / 70%);
98
+ background: rgba(0, 0, 0, 70%);
99
99
  border: none;
100
100
 
101
101
  &:disabled {
102
- background: rgba(0 0 0 / 30%);
102
+ background: rgba(0, 0, 0, 30%);
103
103
  }
104
104
 
105
105
  cursor: pointer;
@@ -107,6 +107,6 @@
107
107
 
108
108
  .shaka-skip-ad-counter {
109
109
  padding: 5px;
110
- background: rgba(0 0 0 / 70%);
110
+ background: rgba(0, 0, 0, 70%);
111
111
  margin: 0;
112
112
  }
@@ -38,7 +38,7 @@
38
38
  border-radius: 50%;
39
39
 
40
40
  /* A small drop shadow below the button. */
41
- box-shadow: rgba(0 0 0 / 10%) 0 0 20px 0;
41
+ box-shadow: rgba(0, 0, 0, 10%) 0 0 20px 0;
42
42
 
43
43
  /* No border. */
44
44
  border: none;
@@ -51,7 +51,7 @@
51
51
  background-position: center center;
52
52
 
53
53
  /* A background color behind the play arrow. */
54
- background-color: rgba(255 255 255 / 90%);
54
+ background-color: rgba(255, 255, 255, 90%);
55
55
 
56
56
  .show-when-controls-shown();
57
57
 
@@ -127,10 +127,10 @@
127
127
  border: none;
128
128
 
129
129
  /* Setting text color to white */
130
- color: rgb(255 255 255);
130
+ color: rgb(255, 255, 255);
131
131
 
132
132
  /* Setting background color to black so white text can be seen clearly */
133
- background-color: rgb(0 0 0 / 50%);
133
+ background-color: rgb(0, 0, 0, 50%);
134
134
 
135
135
  cursor: default;
136
136
  font-size: 20px;
@@ -222,7 +222,7 @@
222
222
  min-width: 300px;
223
223
 
224
224
  color: white;
225
- background-color: rgba(35 35 35 / 90%);
225
+ background-color: rgba(35, 35, 35, 90%);
226
226
 
227
227
  font-size: 14px;
228
228
 
@@ -243,7 +243,7 @@
243
243
  }
244
244
 
245
245
  span {
246
- color: rgb(150 150 150);
246
+ color: rgb(150, 150, 150);
247
247
  }
248
248
  }
249
249
 
@@ -254,7 +254,7 @@
254
254
  min-width: 150px;
255
255
 
256
256
  color: white;
257
- background-color: rgba(35 35 35 / 90%);
257
+ background-color: rgba(35, 35, 35, 90%);
258
258
 
259
259
  font-size: 14px;
260
260
 
@@ -275,12 +275,12 @@
275
275
  }
276
276
 
277
277
  span {
278
- color: rgb(150 150 150);
278
+ color: rgb(150, 150, 150);
279
279
  }
280
280
  }
281
281
 
282
282
  .shaka-context-menu {
283
- background-color: rgba(35 35 35 / 90%);
283
+ background-color: rgba(35, 35, 35, 90%);
284
284
 
285
285
  border-radius: 2px;
286
286
 
@@ -300,7 +300,7 @@
300
300
  cursor: pointer;
301
301
 
302
302
  &:hover {
303
- background-color: rgba(50 50 50 / 90%);
303
+ background-color: rgba(50, 50, 50, 90%);
304
304
  }
305
305
  }
306
306
 
@@ -406,7 +406,7 @@
406
406
 
407
407
  /* Add a bit of a white shadow to keep our black spinner visible
408
408
  on a black background. */
409
- filter: drop-shadow(0 0 2px rgba(255 255 255 / 50%));
409
+ filter: drop-shadow(0 0 2px rgba(255, 255, 255, 50%));
410
410
  }
411
411
 
412
412
  .shaka-hidden-fast-forward-container,
@@ -18,7 +18,7 @@
18
18
 
19
19
  /* Styles for the menu itself. */
20
20
  background: white;
21
- box-shadow: 0 1px 9px 0 rgba(0 0 0 / 40%);
21
+ box-shadow: 0 1px 9px 0 rgba(0, 0, 0, 40%);
22
22
  border-radius: 2px;
23
23
  max-height: 250px;
24
24
  min-width: 180px;
@@ -53,7 +53,7 @@
53
53
 
54
54
  /* When hovered, the button's background is highlighted. */
55
55
  &:hover {
56
- background: rgb(224 224 224);
56
+ background: rgb(224, 224, 224);
57
57
  }
58
58
 
59
59
  /* The button is clickable, showing cursor pointer */
@@ -65,7 +65,7 @@
65
65
  }
66
66
 
67
67
  .shaka-keyboard-navigation &:focus {
68
- background: rgb(224 224 224);
68
+ background: rgb(224, 224, 224);
69
69
  }
70
70
  }
71
71
 
@@ -110,7 +110,7 @@
110
110
  * language, the currently-selected resolution, etc. */
111
111
  .shaka-current-selection-span {
112
112
  /* This is dimmer than the other span, which is the name of the submenu. */
113
- color: rgba(0 0 0 / 54%);
113
+ color: rgba(0, 0, 0, 54%);
114
114
  }
115
115
 
116
116
  /* The submenus have somewhat different margins inside them. */
@@ -1,7 +1,7 @@
1
1
  #shaka-player-ui-thumbnail-container {
2
2
  background-color: black;
3
3
  border: 1px solid black;
4
- box-shadow: 0 8px 8px 0 rgb(0 0 0 / 50%);
4
+ box-shadow: 0 8px 8px 0 rgb(0, 0, 0, 50%);
5
5
  min-width: 150px;
6
6
  overflow: hidden;
7
7
  position: absolute;
@@ -14,7 +14,7 @@
14
14
  }
15
15
 
16
16
  #shaka-player-ui-thumbnail-time {
17
- background-color: rgb(0 0 0 / 50%);
17
+ background-color: rgb(0, 0, 0, 50%);
18
18
  bottom: 0;
19
19
  color: white;
20
20
  font-size: 16px;
@@ -29,7 +29,7 @@
29
29
  background-color: white;
30
30
  border: 1px solid black;
31
31
  border-radius: 10px;
32
- box-shadow: 0 8px 8px 0 rgb(0 0 0 / 50%);
32
+ box-shadow: 0 8px 8px 0 rgb(0, 0, 0, 50%);
33
33
  color: black;
34
34
  overflow: hidden;
35
35
  padding: 1px 7px;
@@ -53,7 +53,7 @@
53
53
  font-size: 13px;
54
54
 
55
55
  /* Styling */
56
- background: rgba(35 35 35 / 90%);
56
+ background: rgba(35, 35, 35, 90%);
57
57
  color: white;
58
58
  border-radius: 3px;
59
59
  padding: 5px 10px;
package/ui/play_button.js CHANGED
@@ -77,11 +77,13 @@ shaka.ui.PlayButton = class extends shaka.ui.Element {
77
77
  });
78
78
 
79
79
  this.eventManager.listen(this.button, 'click', () => {
80
- if (this.ad && this.ad.isLinear()) {
80
+ if (this.ad) {
81
81
  this.controls.playPauseAd();
82
- } else {
83
- this.controls.playPausePresentation();
82
+ if (this.ad.isLinear()) {
83
+ return;
84
+ }
84
85
  }
86
+ this.controls.playPausePresentation();
85
87
  });
86
88
 
87
89
  if (this.ad) {
@@ -55,7 +55,7 @@ shaka.ui.PresentationTimeTracker = class extends shaka.ui.Element {
55
55
 
56
56
  this.eventManager.listen(
57
57
  this.adManager, shaka.ads.Utils.AD_STARTED, () => {
58
- shaka.ui.Utils.setDisplay(this.currentTime_, false);
58
+ shaka.ui.Utils.setDisplay(this.currentTime_, !this.ad.isLinear());
59
59
  });
60
60
 
61
61
  this.eventManager.listen(