@eluvio/elv-player-js 2.0.30 → 2.0.32

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.
@@ -17,6 +17,20 @@ export const Spinner = ({light, className=""}) => (
17
17
 
18
18
  export const SVG = ({icon, className=""}) => <div className={`${CommonStyles["svg"]} ${className}`} dangerouslySetInnerHTML={{__html: icon}} />;
19
19
 
20
+ export const Copy = async (value) => {
21
+ try {
22
+ value = (value || "").toString();
23
+
24
+ await navigator.clipboard.writeText(value);
25
+ } catch(error) {
26
+ const input = document.createElement("input");
27
+
28
+ input.value = value;
29
+ input.select();
30
+ input.setSelectionRange(0, 99999);
31
+ document.execCommand("copy");
32
+ }
33
+ };
20
34
 
21
35
  const icons = {
22
36
  [ACTIONS.PLAY]: Icons.PlayIcon,
@@ -209,6 +223,15 @@ export const SettingsMenu = ({player, Hide, className=""}) => {
209
223
  rate: {
210
224
  label: "Playback Rate",
211
225
  Update: index => player.controls.SetPlaybackRate({index})
226
+ },
227
+ advanced: {
228
+ label: "Advanced",
229
+ Update: option => {
230
+ if(option === "copy_debug_info") {
231
+ Copy(JSON.stringify(player.controls.GetDebugInfo(), null, 2));
232
+ Hide();
233
+ }
234
+ }
212
235
  }
213
236
  };
214
237
 
@@ -225,23 +248,36 @@ export const SettingsMenu = ({player, Hide, className=""}) => {
225
248
  <div>{ settings[activeMenu].label }</div>
226
249
  </button>
227
250
  {
228
- options[activeMenu].options.map(option =>
251
+ activeMenu === "advanced" ?
229
252
  <button
230
- key={`option-${option.index}`}
231
- role="menuitemradio"
232
- aria-checked={option.active}
233
- autoFocus={option.active}
234
- aria-label={`${settings[activeMenu].label}: ${option.label || ""}`}
253
+ role="button"
254
+ autoFocus
255
+ aria-label="Copy Debug Info"
235
256
  onClick={() => {
236
- settings[activeMenu].Update(option.index);
257
+ settings[activeMenu].Update("copy_debug_info");
237
258
  SetSubmenu(undefined);
238
259
  }}
239
- className={`${CommonStyles["menu-option"]} ${option.active ? CommonStyles["menu-option-active"] : ""}`}
260
+ className={CommonStyles["menu-option"]}
240
261
  >
241
- { option.label || "" }
242
- { option.active ? <SVG icon={Icons.CheckmarkIcon} className={CommonStyles["menu-option-icon"]} /> : null }
243
- </button>
244
- )
262
+ Copy Debug Info
263
+ </button> :
264
+ options[activeMenu].options.map(option =>
265
+ <button
266
+ key={`option-${option.index}`}
267
+ role="menuitemradio"
268
+ aria-checked={option.active}
269
+ autoFocus={option.active}
270
+ aria-label={`${settings[activeMenu].label}: ${option.label || ""}`}
271
+ onClick={() => {
272
+ settings[activeMenu].Update(option.index);
273
+ SetSubmenu(undefined);
274
+ }}
275
+ className={`${CommonStyles["menu-option"]} ${option.active ? CommonStyles["menu-option-active"] : ""}`}
276
+ >
277
+ {option.label || ""}
278
+ {option.active ? <SVG icon={Icons.CheckmarkIcon} className={CommonStyles["menu-option-icon"]}/> : null}
279
+ </button>
280
+ )
245
281
  }
246
282
  </div>
247
283
  );
@@ -250,47 +286,79 @@ export const SettingsMenu = ({player, Hide, className=""}) => {
250
286
  <div key="menu" role="menu" className={`${CommonStyles["menu"]} ${className}`}>
251
287
  {
252
288
  !options.hasQualityOptions ? null :
253
- <button autoFocus role="menuitem" onClick={() => SetSubmenu("quality")}
254
- className={CommonStyles["menu-option"]}>
289
+ <button
290
+ autoFocus role="menuitem"
291
+ onClick={() => SetSubmenu("quality")}
292
+ className={CommonStyles["menu-option"]}
293
+ >
255
294
  {`${settings.quality.label}: ${(options.quality.active && options.quality.active.activeLabel) || ""}`}
256
295
  <SVG icon={Icons.ChevronRightIcon} className={CommonStyles["menu-option-icon"]}/>
257
296
  </button>
258
297
  }
259
298
  {
260
299
  !options.hasAudioOptions ? null :
261
- <button autoFocus={!options.hasQualityOptions} role="menuitem" onClick={() => SetSubmenu("audio")} className={CommonStyles["menu-option"]}>
300
+ <button
301
+ autoFocus={!options.hasQualityOptions}
302
+ role="menuitem"
303
+ onClick={() => SetSubmenu("audio")}
304
+ className={CommonStyles["menu-option"]}
305
+ >
262
306
  {`${settings.audio.label}: ${(options.audio.active && options.audio.active.label) || ""}`}
263
307
  <SVG icon={Icons.ChevronRightIcon} className={CommonStyles["menu-option-icon"]}/>
264
308
  </button>
265
309
  }
266
310
  {
267
311
  !options.hasTextOptions ? null :
268
- <button autoFocus={!options.hasQualityOptions && !options.hasAudioOptions} role="menuitem" onClick={() => SetSubmenu("text")} className={CommonStyles["menu-option"]}>
312
+ <button
313
+ autoFocus={!options.hasQualityOptions && !options.hasAudioOptions}
314
+ role="menuitem"
315
+ onClick={() => SetSubmenu("text")}
316
+ className={CommonStyles["menu-option"]}
317
+ >
269
318
  {`${settings.text.label}: ${(options.text.active && options.text.active.label) || ""}`}
270
319
  <SVG icon={Icons.ChevronRightIcon} className={CommonStyles["menu-option-icon"]}/>
271
320
  </button>
272
321
  }
273
322
  {
274
323
  !options.hasProfileOptons ? null :
275
- <button autoFocus={!options.hasQualityOptions && !options.hasAudioOptions && !options.hasTextOptions} role="menuitem" onClick={() => SetSubmenu("profile")} className={CommonStyles["menu-option"]}>
324
+ <button
325
+ autoFocus={!options.hasQualityOptions && !options.hasAudioOptions && !options.hasTextOptions}
326
+ role="menuitem"
327
+ onClick={() => SetSubmenu("profile")}
328
+ className={CommonStyles["menu-option"]}
329
+ >
276
330
  {`${settings.profile.label}: ${(options.profile.active && options.profile.active.label) || ""}`}
277
331
  <SVG icon={Icons.ChevronRightIcon} className={CommonStyles["menu-option-icon"]}/>
278
332
  </button>
279
333
  }
280
334
  {
281
335
  !options.hasRateOptions ? null :
282
- <button autoFocus={!options.hasQualityOptions && !options.hasAudioOptions && !options.hasTextOptions && !options.hasProfileOptons} role="menuitem" onClick={() => SetSubmenu("rate")} className={CommonStyles["menu-option"]}>
336
+ <button
337
+ autoFocus={!options.hasQualityOptions && !options.hasAudioOptions && !options.hasTextOptions && !options.hasProfileOptons}
338
+ role="menuitem"
339
+ onClick={() => SetSubmenu("rate")}
340
+ className={CommonStyles["menu-option"]}
341
+ >
283
342
  {`${settings.rate.label}: ${(options.rate.active && options.rate.active.label) || ""}`}
284
343
  <SVG icon={Icons.ChevronRightIcon} className={CommonStyles["menu-option-icon"]}/>
285
344
  </button>
286
345
  }
346
+ <button
347
+ autoFocus={!options.hasRateOptions && !options.hasQualityOptions && !options.hasAudioOptions && !options.hasTextOptions && !options.hasProfileOptons}
348
+ role="button"
349
+ onClick={() => SetSubmenu("advanced")}
350
+ className={CommonStyles["menu-option"]}
351
+ >
352
+ { settings.advanced.label }
353
+ <SVG icon={Icons.ChevronRightIcon} className={CommonStyles["menu-option-icon"]}/>
354
+ </button>
287
355
  </div>
288
356
  );
289
357
  }
290
358
 
291
359
  return (
292
360
  <div ref={menuRef}>
293
- { content }
361
+ {content}
294
362
  </div>
295
363
  );
296
364
  };
@@ -302,7 +370,7 @@ export const DVRToggle = ({player}) => {
302
370
  const disposer = player.controls.RegisterSettingsListener(() => {
303
371
  if(!player.controls) { return; }
304
372
 
305
- setDVREnabled(player.controls.IsDVREnabled())
373
+ setDVREnabled(player.controls.IsDVREnabled());
306
374
  });
307
375
 
308
376
  return () => disposer && disposer();
@@ -327,21 +395,6 @@ export const DVRToggle = ({player}) => {
327
395
  );
328
396
  };
329
397
 
330
- export const Copy = async (value) => {
331
- try {
332
- value = (value || "").toString();
333
-
334
- await navigator.clipboard.writeText(value);
335
- } catch(error) {
336
- const input = document.createElement("input");
337
-
338
- input.value = value;
339
- input.select();
340
- input.setSelectionRange(0, 99999);
341
- document.execCommand("copy");
342
- }
343
- };
344
-
345
398
  export const CopyButton = ({label, value, className=""}) => {
346
399
  const [copied, setCopied] = useState(false);
347
400
 
@@ -15,11 +15,12 @@ import {
15
15
  } from "./Observers.js";
16
16
  import WebControls from "./WebControls.jsx";
17
17
  import TicketForm from "./TicketForm.jsx";
18
- import {Spinner, UserActionIndicator} from "./Components.jsx";
18
+ import {Copy, Spinner, SVG, UserActionIndicator} from "./Components.jsx";
19
19
  import TVControls from "./TVControls.jsx";
20
20
  import PlayerProfileForm from "./PlayerProfileForm.jsx";
21
21
  import {ImageUrl, MergeDefaultParameters} from "./Common.js";
22
22
  import {ChromecastIcon} from "../static/icons/Icons.js";
23
+ import * as Icons from "../static/icons/Icons";
23
24
 
24
25
  const Poster = ({player}) => {
25
26
  const [imageUrl, setImageUrl] = useState(undefined);
@@ -249,7 +250,18 @@ const PlayerUI = ({target, parameters, InitCallback, ErrorCallback, Unmount, Res
249
250
  }
250
251
  {
251
252
  !errorMessage ? null :
252
- <div className={PlayerStyles["error-message"]}>{ errorMessage }</div>
253
+ <div className={PlayerStyles["error-message"]}>
254
+ <div className={PlayerStyles["error-message__message"]}>
255
+ { errorMessage }
256
+ </div>
257
+ <button
258
+ className={PlayerStyles["error-message__copy-debug-button"]}
259
+ onClick={() => Copy(JSON.stringify(player.controls.GetDebugInfo(), null, 2))}
260
+ >
261
+ <SVG icon={Icons.InfoIcon} className={PlayerStyles["error-message__icon"]}/>
262
+ Copy Troubleshooting Info
263
+ </button>
264
+ </div>
253
265
  }
254
266
  {
255
267
  !player ? null :
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-player-js",
3
- "version": "2.0.30",
3
+ "version": "2.0.32",
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",