@gcorevideo/player 2.8.0 → 2.8.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcorevideo/player",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "description": "Gcore JavaScript video player",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -37,9 +37,6 @@
37
37
  "assert": "^2.1.0",
38
38
  "rollup": "^4.27.4",
39
39
  "rollup-plugin-polyfill-node": "^0.13.0",
40
- "rollup-plugin-sass": "^1.14.0",
41
- "rollup-plugin-string": "^3.0.0",
42
- "sass": "^1.83.0",
43
40
  "typescript": "^5.7.2"
44
41
  },
45
42
  "dependencies": {
package/rollup.config.js CHANGED
@@ -2,27 +2,15 @@
2
2
  import commonjs from '@rollup/plugin-commonjs';
3
3
  import json from '@rollup/plugin-json';
4
4
  import resolve from '@rollup/plugin-node-resolve';
5
- import sass from 'rollup-plugin-sass';
6
- import { string } from 'rollup-plugin-string';
7
5
  import polyfillNode from 'rollup-plugin-polyfill-node';
8
6
 
9
7
  export default [
10
8
  {
11
9
  input: 'lib/index.js',
12
10
  plugins: [
13
- sass({
14
- output: 'dist/index.css',
15
- verbose: true,
16
- }),
17
11
  resolve(),
18
12
  commonjs(),
19
13
  json(),
20
- string({
21
- include: [
22
- '**/*.ejs',
23
- '**/*.svg',
24
- ],
25
- }),
26
14
  polyfillNode(),
27
15
  ],
28
16
  output: [
@@ -13,7 +13,7 @@ import DASHJS, {
13
13
  } from 'dashjs'
14
14
  import { trace } from '../../trace/index.js'
15
15
 
16
- import { BitrateInfo, QualityLevel, TimePosition, TimeValue } from '../../playback.types.js'
16
+ import { QualityLevel, TimePosition, TimeValue } from '../../playback.types.js'
17
17
 
18
18
  const AUTO = -1
19
19
 
@@ -34,6 +34,7 @@ type LocalTimeCorrelation = {
34
34
 
35
35
  const T = 'DashPlayback'
36
36
 
37
+ // @ts-expect-error
37
38
  export default class DashPlayback extends HTML5Video {
38
39
  _levels: QualityLevel[] | null = null
39
40
 
@@ -299,7 +300,7 @@ export default class DashPlayback extends HTML5Video {
299
300
  }
300
301
 
301
302
  // override
302
- _setupSrc() {
303
+ private override _setupSrc() {
303
304
  // this playback manages the src on the video element itself
304
305
  }
305
306
 
@@ -386,27 +387,31 @@ export default class DashPlayback extends HTML5Video {
386
387
  this.trigger(Events.PLAYBACK_STATS_ADD, { dvr: status })
387
388
  }
388
389
 
389
- _updateSettings() {
390
+ override _updateSettings() {
390
391
  if (this._playbackType === Playback.VOD) {
392
+ // @ts-expect-error
391
393
  this.settings.left = ['playpause', 'position', 'duration']
392
394
  } else if (this.dvrEnabled) {
395
+ // @ts-expect-error
393
396
  this.settings.left = ['playpause']
394
397
  } else {
398
+ // @ts-expect-error
395
399
  this.settings.left = ['playstop']
396
400
  }
397
-
401
+ // @ts-expect-error
398
402
  this.settings.seekEnabled = this.isSeekEnabled()
399
403
  this.trigger(Events.PLAYBACK_SETTINGSUPDATE)
400
404
  }
401
405
 
402
- _onPlaybackError = (event: DashPlaybackErrorEvent) => {
406
+ private _onPlaybackError = (event: DashPlaybackErrorEvent) => {
403
407
  // TODO
408
+ trace(`${T} _onPlaybackError`, { event })
404
409
  }
405
410
 
406
- _onDASHJSSError = (event: DashErrorEvent) => {
411
+ private _onDASHJSSError = (event: DashErrorEvent) => {
412
+ trace(`${T} _onDASHJSSError`, { event })
407
413
  // TODO
408
414
  // only report/handle errors if they are fatal
409
- // hlsjs should automatically handle non fatal errors
410
415
  this._stopTimeUpdateTimer()
411
416
  if (event.error === 'capability' && event.event === 'mediasource') {
412
417
  // No support for MSE
@@ -542,10 +547,10 @@ export default class DashPlayback extends HTML5Video {
542
547
  }
543
548
 
544
549
  get dvrEnabled() {
545
- assert.ok(
546
- this._dash,
547
- 'An instance of dashjs MediaPlayer is required to get the DVR status',
548
- )
550
+ if (!this._dash) {
551
+ trace(`${T} dvrEnable no dash player instance`)
552
+ return false
553
+ }
549
554
  return (
550
555
  this._dash?.getDVRWindowSize() >= this._minDvrSize &&
551
556
  this.getPlaybackType() === Playback.LIVE
@@ -61,6 +61,7 @@ type CustomListener = {
61
61
  // TODO level, code, description, etc
62
62
  type ErrorInfo = Record<string, unknown>;
63
63
 
64
+ // @ts-expect-error
64
65
  export default class HlsPlayback extends HTML5Video {
65
66
  private _ccIsSetup = false;
66
67
 
@@ -436,7 +437,7 @@ export default class HlsPlayback extends HTML5Video {
436
437
 
437
438
  // override
438
439
  // this playback manages the src on the video element itself
439
- _setupSrc(srcUrl: string) { } // eslint-disable-line no-unused-vars
440
+ private override _setupSrc(srcUrl: string) { } // eslint-disable-line no-unused-vars
440
441
 
441
442
  _startTimeUpdateTimer() {
442
443
  if (this._timeUpdateTimer) {
@@ -511,13 +512,17 @@ export default class HlsPlayback extends HTML5Video {
511
512
 
512
513
  _updateSettings() {
513
514
  if (this._playbackType === Playback.VOD) {
515
+ // @ts-expect-error
514
516
  this.settings.left = ['playpause', 'position', 'duration'];
515
517
  } else if (this.dvrEnabled) {
518
+ // @ts-expect-error
516
519
  this.settings.left = ['playpause'];
517
520
  } else {
521
+ // @ts-expect-error
518
522
  this.settings.left = ['playstop'];
519
523
  }
520
524
 
525
+ // @ts-expect-error
521
526
  this.settings.seekEnabled = this.isSeekEnabled();
522
527
  this.trigger(Events.PLAYBACK_SETTINGSUPDATE);
523
528
  }
@@ -65,13 +65,13 @@ export function buildSourcesPriorityList(
65
65
  }
66
66
 
67
67
  function addHls() {
68
- if (sources.hls && HlsPlayback.canPlay(sources.hls)) {
68
+ if (sources.hls && HlsPlayback.canPlay(sources.hls, undefined)) {
69
69
  msl.push(sources.hls)
70
70
  sources.hls = null
71
71
  }
72
72
  if (
73
73
  sources.master?.endsWith('.m3u8') &&
74
- HlsPlayback.canPlay(sources.master)
74
+ HlsPlayback.canPlay(sources.master, undefined)
75
75
  ) {
76
76
  msl.push(sources.master)
77
77
  sources.master = null
@@ -79,7 +79,7 @@ export function buildSourcesPriorityList(
79
79
  }
80
80
 
81
81
  function addDash() {
82
- if (sources.dash && DashPlayback.canPlay(sources.dash)) {
82
+ if (sources.dash && DashPlayback.canPlay(sources.dash, undefined)) {
83
83
  msl.push(sources.dash)
84
84
  sources.dash = null
85
85
  }