@stremio/stremio-video 0.0.50 → 0.0.52

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": "@stremio/stremio-video",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "description": "Abstraction layer on top of different media players",
5
5
  "author": "Smart Code OOD",
6
6
  "main": "src/index.js",
@@ -189,7 +189,7 @@ function HTMLVideo(options) {
189
189
  return Object.freeze({
190
190
  id: 'EMBEDDED_' + String(index),
191
191
  lang: track.language,
192
- label: track.label,
192
+ label: track.label || null,
193
193
  origin: 'EMBEDDED',
194
194
  embedded: true
195
195
  });
@@ -20,6 +20,8 @@ var stremioToMPVProps = {
20
20
  'subtitlesTracks': 'subtitlesTracks',
21
21
  'selectedSubtitlesTrackId': 'sid',
22
22
  'subtitlesSize': 'sub-scale',
23
+ 'subtitlesOffset': 'sub-pos',
24
+ 'subtitlesDelay': 'sub-delay',
23
25
  'subtitlesTextColor': 'sub-color',
24
26
  'subtitlesBackgroundColor': 'sub-back-color',
25
27
  'subtitlesOutlineColor': 'sub-border-color',
@@ -77,6 +79,7 @@ function ShellVideo(options) {
77
79
  ipc.send('mpv-observe-prop', 'sid');
78
80
  ipc.send('mpv-observe-prop', 'sub-scale');
79
81
  ipc.send('mpv-observe-prop', 'sub-pos');
82
+ ipc.send('mpv-observe-prop', 'sub-delay');
80
83
  ipc.send('mpv-observe-prop', 'speed');
81
84
 
82
85
  ipc.send('mpv-observe-prop', 'mpv-version');
@@ -122,7 +125,6 @@ function ShellVideo(options) {
122
125
  break;
123
126
  }
124
127
  case 'duration': {
125
- setBackground(false);
126
128
  var intDuration = args.data | 0;
127
129
  // Accumulate average duration over time. if it is greater than minClipDuration
128
130
  // and equal to the currently reported duration, it is returned as video length.
@@ -137,7 +139,10 @@ function ShellVideo(options) {
137
139
  // which is around 34 years of playback time.
138
140
  avgDuration = avgDuration ? (avgDuration + intDuration) >> 1 : intDuration;
139
141
  props.loaded = intDuration > 0;
140
- if(props.loaded) onPropChanged('loaded');
142
+ if(props.loaded) {
143
+ setBackground(false);
144
+ onPropChanged('loaded');
145
+ }
141
146
  break;
142
147
  }
143
148
  case 'time-pos': {
@@ -148,6 +153,14 @@ function ShellVideo(options) {
148
153
  props[args.name] = Math.round(args.data / SUBS_SCALE_FACTOR);
149
154
  break;
150
155
  }
156
+ case 'sub-pos': {
157
+ props[args.name] = 100 - args.data;
158
+ break;
159
+ }
160
+ case 'sub-delay': {
161
+ props[args.name] = Math.round(args.data*1000);
162
+ break;
163
+ }
151
164
  case 'paused-for-cache':
152
165
  case 'seeking':
153
166
  {
@@ -304,10 +317,14 @@ function ShellVideo(options) {
304
317
  ipc.send('mpv-set-prop', [stremioToMPVProps[propName], propValue * SUBS_SCALE_FACTOR]);
305
318
  break;
306
319
  }
307
- case 'subtitlesOffset': {
320
+ case 'subtitlesDelay': {
308
321
  ipc.send('mpv-set-prop', [stremioToMPVProps[propName], propValue]);
309
322
  break;
310
323
  }
324
+ case 'subtitlesOffset': {
325
+ ipc.send('mpv-set-prop', [stremioToMPVProps[propName], 100 - propValue]);
326
+ break;
327
+ }
311
328
  case 'subtitlesTextColor':
312
329
  case 'subtitlesBackgroundColor':
313
330
  case 'subtitlesOutlineColor':
@@ -342,7 +359,7 @@ function ShellVideo(options) {
342
359
  var separateWindow = options.mpvSeparateWindow ? 'yes' : 'no';
343
360
  ipc.send('mpv-set-prop', ['vo', videoOutput]);
344
361
  ipc.send('mpv-set-prop', ['osc', separateWindow]);
345
- ipc.send('mpv-set-prop', ['input-defalt-bindings', separateWindow]);
362
+ ipc.send('mpv-set-prop', ['input-default-bindings', separateWindow]);
346
363
  ipc.send('mpv-set-prop', ['input-vo-keyboard', separateWindow]);
347
364
 
348
365
  var startAt = Math.floor(parseInt(commandArgs.time, 10) / 1000) || 0;
@@ -192,7 +192,7 @@ function TitanVideo(options) {
192
192
  return Object.freeze({
193
193
  id: 'EMBEDDED_' + String(index),
194
194
  lang: track.language,
195
- label: track.label || track.language,
195
+ label: track.label || null,
196
196
  origin: 'EMBEDDED',
197
197
  embedded: true
198
198
  });
@@ -265,7 +265,7 @@ function TitanVideo(options) {
265
265
  return Object.freeze({
266
266
  id: 'EMBEDDED_' + String(index),
267
267
  lang: track.language,
268
- label: track.label || track.language,
268
+ label: track.label || null,
269
269
  origin: 'EMBEDDED',
270
270
  embedded: true
271
271
  });
@@ -244,18 +244,20 @@ function TizenVideo(options) {
244
244
  extra = JSON.parse(textTrack.extra_info);
245
245
  } catch(e) {}
246
246
  var textTrackLang = typeof extra.track_lang === 'string' && extra.track_lang.length > 0 ? extra.track_lang.trim() : null;
247
+ var textTrackLabel = null;
247
248
  if (((tracksData || {}).subs || []).length) {
248
249
  var extendedTrackData = tracksData.subs.find(function(el) {
249
250
  return (el || {}).id-1 === textTrack.index;
250
251
  });
251
252
  if (extendedTrackData) {
252
253
  textTrackLang = extendedTrackData.lang || 'eng';
254
+ textTrackLabel = extendedTrackData.label || null;
253
255
  }
254
256
  }
255
257
  textTracks.push({
256
258
  id: textTrackId,
257
259
  lang: textTrackLang,
258
- label: textTrackLang,
260
+ label: textTrackLabel,
259
261
  origin: 'EMBEDDED',
260
262
  embedded: true,
261
263
  mode: !disabledSubs && textTrackId === currentSubTrack ? 'showing' : 'disabled',
@@ -346,18 +348,20 @@ function TizenVideo(options) {
346
348
  extra = JSON.parse(audioTrack.extra_info);
347
349
  } catch(e) {}
348
350
  var audioTrackLang = typeof extra.language === 'string' && extra.language.length > 0 ? extra.language : null;
351
+ var audioTrackLabel = null;
349
352
  if (((tracksData || {}).audio || []).length) {
350
353
  var extendedTrackData = tracksData.audio.find(function(el) {
351
354
  return (el || {}).id-1 === audioTrack.index;
352
355
  });
353
356
  if (extendedTrackData) {
354
357
  audioTrackLang = extendedTrackData.lang || 'eng';
358
+ audioTrackLabel = extendedTrackData.label || null;
355
359
  }
356
360
  }
357
361
  audioTracks.push({
358
362
  id: audioTrackId,
359
363
  lang: audioTrackLang,
360
- label: audioTrackLang,
364
+ label: audioTrackLabel,
361
365
  origin: 'EMBEDDED',
362
366
  embedded: true,
363
367
  mode: audioTrackId === currentAudioTrack ? 'showing' : 'disabled',
@@ -370,7 +370,7 @@ function WebOsVideo(options) {
370
370
  textTracks.push({
371
371
  id: 'EMBEDDED_' + textTrackId,
372
372
  lang: track.lang || 'eng',
373
- label: track.lang || 'eng',
373
+ label: track.label || null,
374
374
  origin: 'EMBEDDED',
375
375
  embedded: true,
376
376
  mode: textTrackId === currentSubTrack ? 'showing' : 'disabled',
@@ -392,7 +392,7 @@ function WebOsVideo(options) {
392
392
  audioTracks.push({
393
393
  id: 'EMBEDDED_' + audioTrackId,
394
394
  lang: track.lang || 'eng',
395
- label: track.lang || 'eng',
395
+ label: track.label || null,
396
396
  origin: 'EMBEDDED',
397
397
  embedded: true,
398
398
  mode: audioTrackId === currentAudioTrack ? 'showing' : 'disabled',