@eluvio/elv-player-js 2.1.19 → 2.1.20

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.
@@ -87,6 +87,16 @@ class PlayerControls {
87
87
  return this.player.playbackStarted;
88
88
  }
89
89
 
90
+ HasAudio() {
91
+ if(!this.player || !this.player.video) { return false; }
92
+
93
+ return (
94
+ this.player.video.mozHasAudio ||
95
+ !!this.player.video.webkitAudioDecodedByteCount ||
96
+ !!this.player.video.audioTracks && this.player.video.audioTracks.length
97
+ );
98
+ }
99
+
90
100
  /**
91
101
  * Play the video
92
102
  *
@@ -286,7 +286,7 @@ export class EluvioPlayer {
286
286
  offset = parseInt(offsetRat);
287
287
  }
288
288
  }
289
- } catch(error) {}
289
+ } catch(error) { /* empty */ }
290
290
 
291
291
  return {
292
292
  playoutParameters: {
@@ -1037,7 +1037,7 @@ export class EluvioPlayer {
1037
1037
  await this.video.play();
1038
1038
  return true;
1039
1039
  } catch(error) {
1040
- if(error.toString()?.includes("AbortError")) {
1040
+ if(error && (error.toString() || "").includes("AbortError")) {
1041
1041
  return false;
1042
1042
  }
1043
1043
 
@@ -188,7 +188,7 @@ class ThumbnailHandler {
188
188
 
189
189
  if(!thumbnailIndex) { return; }
190
190
 
191
- const tag = this.thumbnails?.[thumbnailIndex?.toString()];
191
+ const tag = this.thumbnails && this.thumbnails[thumbnailIndex?.toString()];
192
192
 
193
193
  if(!tag) {
194
194
  return;
@@ -198,7 +198,7 @@ class ThumbnailHandler {
198
198
  this.thumbnailCanvas = document.createElement("canvas");
199
199
  }
200
200
 
201
- const image = this.thumbnailImages[tag?.imageUrl];
201
+ const image = this.thumbnailImages[tag.imageUrl];
202
202
 
203
203
  if(image) {
204
204
  const [x, y, w, h] = tag.thumbnailPosition;
@@ -52,7 +52,8 @@
52
52
 
53
53
  &:not(:has(:focus-visible)) {
54
54
  .info-container,
55
- .bottom-controls-container--autohide {
55
+ .bottom-controls-container--autohide,
56
+ .floating-volume-toggle {
56
57
  opacity: 0;
57
58
  pointer-events: none;
58
59
  user-select: none;
@@ -323,7 +324,15 @@ google-cast-launcher {
323
324
  height: 30px;
324
325
  position: absolute;
325
326
  right: 30px;
327
+ transition: opacity 0.5s ease;
326
328
  width: 30px;
329
+
330
+ &.floating-volume-toggle {
331
+ button {
332
+ height: 100%;
333
+ width: 100%;
334
+ }
335
+ }
327
336
  }
328
337
 
329
338
  .watermark {
@@ -438,8 +447,8 @@ google-cast-launcher {
438
447
  }
439
448
 
440
449
  .live-indicator {
441
- padding: 1px 5px;
442
450
  font-size: 10px;
451
+ padding: 1px 5px;
443
452
  }
444
453
 
445
454
  .info-container {
@@ -225,7 +225,7 @@ const WebControls = ({player, playbackStarted, canPlay, recentlyInteracted, setR
225
225
 
226
226
  // Title autohide is not dependent on controls settings
227
227
  const showUI = recentlyInteracted || !playbackStarted || menuVisible;
228
- const hideControls = !showUI && player.playerOptions.controls === EluvioPlayerParameters.controls.AUTO_HIDE;
228
+ const hideControls = !showUI && [EluvioPlayerParameters.controls.AUTO_HIDE, EluvioPlayerParameters.controls.OFF_WITH_VOLUME_TOGGLE].includes(player.playerOptions.controls);
229
229
 
230
230
  player.__SetControlsVisibility(!hideControls);
231
231
 
@@ -322,7 +322,7 @@ const WebControls = ({player, playbackStarted, canPlay, recentlyInteracted, setR
322
322
  }
323
323
  {
324
324
  // Floating volume control for 'off with volume toggle' setting
325
- player.playerOptions.controls !== EluvioPlayerParameters.controls.OFF_WITH_VOLUME_TOGGLE ? null :
325
+ player.playerOptions.controls !== EluvioPlayerParameters.controls.OFF_WITH_VOLUME_TOGGLE || !player.controls.HasAudio() ? null :
326
326
  <div className={ControlStyles["floating-volume-toggle"]}>
327
327
  <IconButton
328
328
  key="mute-button"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.1.19",
3
+ "version": "2.1.20",
4
4
  "description": "![Eluvio Logo](lib/static/images/Logo.png \"Eluvio Logo\")",
5
5
  "main": "dist/elv-player-js.es.js",
6
6
  "license": "MIT",