@stremio/stremio-video 0.0.46 → 0.0.48

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.46",
3
+ "version": "0.0.48",
4
4
  "description": "Abstraction layer on top of different media players",
5
5
  "author": "Smart Code OOD",
6
6
  "main": "src/index.js",
@@ -95,6 +95,12 @@ function ShellVideo(options) {
95
95
  for(var container = options.containerElement; container; container = container.parentElement) {
96
96
  container.style.background = bg;
97
97
  }
98
+ if (((window || {}).document || {}).getElementsByTagName) {
99
+ var body = window.document.getElementsByTagName('body');
100
+ if ((body || [])[0]) {
101
+ body[0].style.background = bg;
102
+ }
103
+ }
98
104
  }
99
105
  function logProp(args) {
100
106
  // eslint-disable-next-line no-console
@@ -116,6 +122,7 @@ function ShellVideo(options) {
116
122
  break;
117
123
  }
118
124
  case 'duration': {
125
+ setBackground(false);
119
126
  var intDuration = args.data | 0;
120
127
  // Accumulate average duration over time. if it is greater than minClipDuration
121
128
  // and equal to the currently reported duration, it is returned as video length.
@@ -325,8 +332,6 @@ function ShellVideo(options) {
325
332
  stream = commandArgs.stream;
326
333
  onPropChanged('stream');
327
334
 
328
- setBackground(false);
329
-
330
335
  ipc.send('mpv-set-prop', ['no-sub-ass']);
331
336
 
332
337
  // opengl-cb is an alias for the new name "libmpv", as shown in mpv's video/out/vo.c aliases
@@ -352,7 +357,13 @@ function ShellVideo(options) {
352
357
  }
353
358
  ipc.send('mpv-set-prop', ['pause', false]);
354
359
  ipc.send('mpv-set-prop', ['speed', props.speed]);
355
- ipc.send('mpv-set-prop', ['aid', props.aid]);
360
+ if (props.aid) {
361
+ if (typeof props.aid === 'string' && props.aid.startsWith('EMBEDDED_')) {
362
+ ipc.send('mpv-set-prop', ['aid', props.aid.slice('EMBEDDED_'.length)]);
363
+ } else {
364
+ ipc.send('mpv-set-prop', ['aid', props.aid]);
365
+ }
366
+ }
356
367
  ipc.send('mpv-set-prop', ['mute', 'no']);
357
368
 
358
369
  onPropChanged('paused');
@@ -6,6 +6,8 @@ var ERROR = require('../error');
6
6
  var getTracksData = require('../tracksData');
7
7
  var createAVPlay = require('./AVPlay');
8
8
 
9
+ var SSA_DESCRIPTORS_REGEX = /^\{(\\an[1-8])+\}/i;
10
+
9
11
  function TizenVideo(options) {
10
12
  options = options || {};
11
13
 
@@ -50,10 +52,12 @@ function TizenVideo(options) {
50
52
  async function renderSubtitle(duration, text) {
51
53
  if (disabledSubs) return;
52
54
  var now = await getProp('time');
55
+ var cleanedText = text.replace(SSA_DESCRIPTORS_REGEX, '');
56
+
53
57
  // we ignore custom delay here, it's not needed for embedded subs
54
58
  lastSub = {
55
59
  duration: duration,
56
- text: text,
60
+ text: cleanedText,
57
61
  now: now,
58
62
  };
59
63
  if (subtitleTimeout) {
@@ -69,7 +73,7 @@ function TizenVideo(options) {
69
73
  subtitlesElement.style.opacity = subtitlesOpacity;
70
74
 
71
75
  var cueNode = document.createElement('span');
72
- cueNode.innerHTML = text;
76
+ cueNode.innerHTML = cleanedText;
73
77
  cueNode.style.display = 'inline-block';
74
78
  cueNode.style.padding = '0.2em';
75
79
  cueNode.style.fontSize = Math.floor(size / 25) + 'vmin';