@stremio/stremio-video 0.0.69 → 0.0.70

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.
@@ -0,0 +1,91 @@
1
+ import { defineConfig, globalIgnores } from "eslint/config";
2
+ import globals from "globals";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import js from "@eslint/js";
6
+ import { FlatCompat } from "@eslint/eslintrc";
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+ const compat = new FlatCompat({
11
+ baseDirectory: __dirname,
12
+ recommendedConfig: js.configs.recommended,
13
+ allConfig: js.configs.all
14
+ });
15
+
16
+ export default defineConfig([globalIgnores(["*", "!src"]), {
17
+ extends: compat.extends("eslint:recommended"),
18
+
19
+ languageOptions: {
20
+ globals: {
21
+ ...globals.commonjs,
22
+ ...globals.browser,
23
+ YT: "readonly",
24
+ Promise: "readonly",
25
+ cast: "readonly",
26
+ },
27
+
28
+ ecmaVersion: 8,
29
+ sourceType: "script",
30
+ },
31
+
32
+ rules: {
33
+ "arrow-parens": "error",
34
+ "arrow-spacing": "error",
35
+ "block-spacing": "error",
36
+ "comma-spacing": "error",
37
+ "eol-last": "error",
38
+ eqeqeq: "error",
39
+ "func-call-spacing": "error",
40
+
41
+ indent: ["error", 4, {
42
+ SwitchCase: 1,
43
+ }],
44
+
45
+ "no-console": ["error", {
46
+ allow: ["warn"],
47
+ }],
48
+
49
+ "no-extra-semi": "error",
50
+ "no-eq-null": "error",
51
+ "no-multi-spaces": "error",
52
+
53
+ "no-multiple-empty-lines": ["error", {
54
+ max: 1,
55
+ }],
56
+
57
+ "no-empty": ["error", {
58
+ allowEmptyCatch: true,
59
+ }],
60
+
61
+ "no-inner-declarations": "off",
62
+ "no-prototype-builtins": "off",
63
+ "no-template-curly-in-string": "error",
64
+ "no-trailing-spaces": "error",
65
+ "no-useless-concat": "error",
66
+ "no-unreachable": "error",
67
+
68
+ "no-unused-vars": ["error", {
69
+ varsIgnorePattern: "^_",
70
+ argsIgnorePattern: "^_",
71
+ caughtErrorsIgnorePattern: "^_"
72
+ }],
73
+
74
+ quotes: ["error", "single"],
75
+
76
+ "quote-props": ["error", "as-needed", {
77
+ unnecessary: false,
78
+ }],
79
+
80
+ semi: "error",
81
+ "semi-spacing": "error",
82
+ curly: ["error", "multi-line"],
83
+ "space-before-blocks": "error",
84
+
85
+ "valid-typeof": ["error", {
86
+ requireStringLiterals: true,
87
+ }],
88
+
89
+ "no-redeclare": "off",
90
+ },
91
+ }]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stremio/stremio-video",
3
- "version": "0.0.69",
3
+ "version": "0.0.70",
4
4
  "description": "Abstraction layer on top of different media players",
5
5
  "author": "Smart Code OOD",
6
6
  "main": "src/index.js",
@@ -21,11 +21,11 @@
21
21
  "hls.js": "https://github.com/Stremio/hls.js/releases/download/v1.5.4-patch2/hls.js-1.5.4-patch2.tgz",
22
22
  "lodash.clonedeep": "4.5.0",
23
23
  "magnet-uri": "6.2.0",
24
- "url": "0.11.0",
24
+ "url": "0.11.4",
25
25
  "video-name-parser": "1.4.6",
26
26
  "vtt.js": "github:jaruba/vtt.js#84d33d157848407d790d78423dacc41a096294f0"
27
27
  },
28
28
  "devDependencies": {
29
- "eslint": "7.32.0"
29
+ "eslint": "9.39.2"
30
30
  }
31
31
  }
@@ -238,7 +238,7 @@ function TizenVideo(options) {
238
238
  var extra = {};
239
239
  try {
240
240
  extra = JSON.parse(textTrack.extra_info);
241
- } catch(e) {}
241
+ } catch(_e) {}
242
242
  var textTrackLang = typeof extra.track_lang === 'string' && extra.track_lang.length > 0 ? extra.track_lang.trim() : null;
243
243
  var textTrackLabel = null;
244
244
  if (((tracksData || {}).subs || []).length) {
@@ -342,7 +342,7 @@ function TizenVideo(options) {
342
342
  var extra = {};
343
343
  try {
344
344
  extra = JSON.parse(audioTrack.extra_info);
345
- } catch(e) {}
345
+ } catch(_e) {}
346
346
  var audioTrackLang = typeof extra.language === 'string' && extra.language.length > 0 ? extra.language : null;
347
347
  var audioTrackLabel = null;
348
348
  if (((tracksData || {}).audio || []).length) {
@@ -605,7 +605,7 @@ function TizenVideo(options) {
605
605
 
606
606
  try {
607
607
  AVPlay.setSpeed(videoSpeed);
608
- } catch (e) {}
608
+ } catch (_e) {}
609
609
 
610
610
  onPropChanged('playbackSpeed');
611
611
  }
@@ -663,7 +663,7 @@ function TizenVideo(options) {
663
663
  retries++;
664
664
  try {
665
665
  AVPlay.stop();
666
- } catch(e) {}
666
+ } catch(_e) {}
667
667
  command('load', commandArgs);
668
668
  } else {
669
669
  onError(Object.assign({}, ERROR.STREAM_FAILED_TO_LOAD, {
@@ -3,7 +3,7 @@ var cloneDeep = require('lodash.clonedeep');
3
3
  var deepFreeze = require('deep-freeze');
4
4
  var ERROR = require('../error');
5
5
 
6
- var SSA_DESCRIPTORS_REGEX = /^\{(\\an[1-8])+\}/i;
6
+ var _SSA_DESCRIPTORS_REGEX = /^\{(\\an[1-8])+\}/i;
7
7
 
8
8
  function VidaaVideo(options) {
9
9
  options = options || {};
@@ -33,48 +33,39 @@ function VidaaVideo(options) {
33
33
  };
34
34
  videoElement.ontimeupdate = function() {
35
35
  onPropChanged('time');
36
- onPropChanged('buffered');
37
36
  };
38
37
  videoElement.ondurationchange = function() {
39
38
  onPropChanged('duration');
40
39
  };
41
40
  videoElement.onwaiting = function() {
42
41
  onPropChanged('buffering');
43
- onPropChanged('buffered');
44
42
  };
45
43
  videoElement.onseeking = function() {
46
44
  onPropChanged('time');
47
45
  onPropChanged('buffering');
48
- onPropChanged('buffered');
49
46
  };
50
47
  videoElement.onseeked = function() {
51
48
  onPropChanged('time');
52
49
  onPropChanged('buffering');
53
- onPropChanged('buffered');
54
50
  };
55
51
  videoElement.onstalled = function() {
56
52
  onPropChanged('buffering');
57
- onPropChanged('buffered');
58
53
  };
59
54
  videoElement.onplaying = function() {
60
55
  onPropChanged('time');
61
56
  onPropChanged('buffering');
62
- onPropChanged('buffered');
63
57
  };
64
58
  videoElement.oncanplay = function() {
65
59
  onPropChanged('buffering');
66
- onPropChanged('buffered');
67
60
  };
68
61
  videoElement.canplaythrough = function() {
69
62
  onPropChanged('buffering');
70
- onPropChanged('buffered');
71
63
  };
72
64
  videoElement.onloadedmetadata = function() {
73
65
  onPropChanged('loaded');
74
66
  };
75
67
  videoElement.onloadeddata = function() {
76
68
  onPropChanged('buffering');
77
- onPropChanged('buffered');
78
69
  };
79
70
  videoElement.onvolumechange = function() {
80
71
  onPropChanged('volume');
@@ -114,7 +105,6 @@ function VidaaVideo(options) {
114
105
  time: false,
115
106
  duration: false,
116
107
  buffering: false,
117
- buffered: false,
118
108
  subtitlesTracks: false,
119
109
  selectedSubtitlesTrackId: false,
120
110
  audioTracks: false,
@@ -164,20 +154,6 @@ function VidaaVideo(options) {
164
154
 
165
155
  return videoElement.readyState < videoElement.HAVE_FUTURE_DATA;
166
156
  }
167
- case 'buffered': {
168
- if (stream === null) {
169
- return null;
170
- }
171
-
172
- var time = videoElement.currentTime !== null && isFinite(videoElement.currentTime) ? videoElement.currentTime : 0;
173
- for (var i = 0; i < videoElement.buffered.length; i++) {
174
- if (videoElement.buffered.start(i) <= time && time <= videoElement.buffered.end(i)) {
175
- return Math.floor(videoElement.buffered.end(i) * 1000);
176
- }
177
- }
178
-
179
- return Math.floor(time * 1000);
180
- }
181
157
  case 'subtitlesTracks': {
182
158
  if (stream === null) {
183
159
  return [];
@@ -435,7 +411,6 @@ function VidaaVideo(options) {
435
411
  onPropChanged('time');
436
412
  onPropChanged('duration');
437
413
  onPropChanged('buffering');
438
- onPropChanged('buffered');
439
414
  if (videoElement.textTracks) {
440
415
  videoElement.textTracks.onaddtrack = function() {
441
416
  setTimeout(function() {
@@ -494,7 +469,6 @@ function VidaaVideo(options) {
494
469
  onPropChanged('time');
495
470
  onPropChanged('duration');
496
471
  onPropChanged('buffering');
497
- onPropChanged('buffered');
498
472
  onPropChanged('subtitlesTracks');
499
473
  onPropChanged('selectedSubtitlesTrackId');
500
474
  onPropChanged('audioTracks');
@@ -576,7 +550,7 @@ VidaaVideo.canPlayStream = function(stream) {
576
550
  VidaaVideo.manifest = {
577
551
  name: 'VidaaVideo',
578
552
  external: false,
579
- props: ['stream', 'loaded', 'paused', 'time', 'duration', 'buffering', 'buffered', 'audioTracks', 'selectedAudioTrackId', 'subtitlesTracks', 'selectedSubtitlesTrackId', 'volume', 'muted', 'playbackSpeed'],
553
+ props: ['stream', 'loaded', 'paused', 'time', 'duration', 'buffering', 'audioTracks', 'selectedAudioTrackId', 'subtitlesTracks', 'selectedSubtitlesTrackId', 'volume', 'muted', 'playbackSpeed'],
580
554
  commands: ['load', 'unload', 'destroy'],
581
555
  events: ['propValue', 'propChanged', 'ended', 'error', 'subtitlesTrackLoaded', 'audioTrackLoaded']
582
556
  };
@@ -154,7 +154,7 @@ function WebOsVideo(options) {
154
154
 
155
155
  var audioTracks = [];
156
156
 
157
- var count_message = 0;
157
+ var _count_message = 0;
158
158
 
159
159
  var subStyles = {
160
160
  color: 'white',
@@ -565,7 +565,7 @@ function WebOsVideo(options) {
565
565
  try {
566
566
  videoElement.currentTime = parseInt(propValue, 10) / 1000;
567
567
  onPropChanged('time');
568
- } catch(e) {
568
+ } catch(_e) {
569
569
  // console.log('webos video change time error');
570
570
  // console.error(e);
571
571
  }
@@ -899,7 +899,7 @@ function WebOsVideo(options) {
899
899
 
900
900
  try {
901
901
  videoElement.load();
902
- } catch(e) {
902
+ } catch(_e) {
903
903
  // console.log('can\'t load video');
904
904
  // console.error(e);
905
905
  }
@@ -907,7 +907,7 @@ function WebOsVideo(options) {
907
907
  try {
908
908
  // console.log('try play');
909
909
  videoElement.play();
910
- } catch(e) {
910
+ } catch(_e) {
911
911
  // console.log('can\'t start video');
912
912
  // console.error(e);
913
913
  }