@stremio/stremio-video 0.0.30 → 0.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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stremio/stremio-video",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Abstraction layer on top of different media players",
|
|
5
5
|
"author": "Smart Code OOD",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"deep-freeze": "0.0.1",
|
|
19
19
|
"eventemitter3": "4.0.7",
|
|
20
20
|
"hat": "0.0.3",
|
|
21
|
-
"hls.js": "https://github.com/Stremio/hls.js/releases/download/v1.
|
|
21
|
+
"hls.js": "https://github.com/Stremio/hls.js/releases/download/v1.5.1-patch1/hls.js-1.5.1-patch1.tgz",
|
|
22
22
|
"lodash.clonedeep": "4.5.0",
|
|
23
23
|
"magnet-uri": "6.2.0",
|
|
24
24
|
"url": "0.11.0",
|
|
@@ -24,6 +24,7 @@ function TizenVideo(options) {
|
|
|
24
24
|
var textColor = 'rgb(255, 255, 255)';
|
|
25
25
|
var backgroundColor = 'rgba(0, 0, 0, 0)';
|
|
26
26
|
var outlineColor = 'rgb(34, 34, 34)';
|
|
27
|
+
var subtitlesOpacity = 1;
|
|
27
28
|
|
|
28
29
|
var objElement = document.createElement('object');
|
|
29
30
|
objElement.type = 'application/avplayer';
|
|
@@ -59,6 +60,8 @@ function TizenVideo(options) {
|
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
subtitlesElement.style.bottom = offset + '%';
|
|
63
|
+
subtitlesElement.style.opacity = subtitlesOpacity;
|
|
64
|
+
|
|
62
65
|
var cueNode = document.createElement('span');
|
|
63
66
|
cueNode.innerHTML = text;
|
|
64
67
|
cueNode.style.display = 'inline-block';
|
|
@@ -138,6 +141,7 @@ function TizenVideo(options) {
|
|
|
138
141
|
subtitlesTextColor: false,
|
|
139
142
|
subtitlesBackgroundColor: false,
|
|
140
143
|
subtitlesOutlineColor: false,
|
|
144
|
+
subtitlesOpacity: false,
|
|
141
145
|
audioTracks: false,
|
|
142
146
|
selectedAudioTrackId: false,
|
|
143
147
|
playbackSpeed: false
|
|
@@ -272,6 +276,13 @@ function TizenVideo(options) {
|
|
|
272
276
|
|
|
273
277
|
return outlineColor;
|
|
274
278
|
}
|
|
279
|
+
case 'subtitlesOpacity': {
|
|
280
|
+
if (destroyed) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return subtitlesOpacity;
|
|
285
|
+
}
|
|
275
286
|
case 'audioTracks': {
|
|
276
287
|
if (stream === null) {
|
|
277
288
|
return [];
|
|
@@ -506,6 +517,22 @@ function TizenVideo(options) {
|
|
|
506
517
|
|
|
507
518
|
break;
|
|
508
519
|
}
|
|
520
|
+
case 'subtitlesOpacity': {
|
|
521
|
+
if (typeof propValue === 'number') {
|
|
522
|
+
try {
|
|
523
|
+
subtitlesOpacity = Math.min(Math.max(propValue / 100, 0), 1);
|
|
524
|
+
} catch (error) {
|
|
525
|
+
// eslint-disable-next-line no-console
|
|
526
|
+
console.error('Tizen player with HTML Subtitles', error);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
refreshSubtitle();
|
|
530
|
+
|
|
531
|
+
onPropChanged('subtitlesOpacity');
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
509
536
|
case 'selectedAudioTrackId': {
|
|
510
537
|
if (stream !== null) {
|
|
511
538
|
|
|
@@ -608,6 +635,7 @@ function TizenVideo(options) {
|
|
|
608
635
|
onPropChanged('subtitlesTextColor');
|
|
609
636
|
onPropChanged('subtitlesBackgroundColor');
|
|
610
637
|
onPropChanged('subtitlesOutlineColor');
|
|
638
|
+
onPropChanged('subtitlesOpacity');
|
|
611
639
|
onPropChanged('playbackSpeed');
|
|
612
640
|
events.removeAllListeners();
|
|
613
641
|
containerElement.removeChild(objElement);
|
|
@@ -657,7 +685,7 @@ TizenVideo.canPlayStream = function() {
|
|
|
657
685
|
TizenVideo.manifest = {
|
|
658
686
|
name: 'TizenVideo',
|
|
659
687
|
external: false,
|
|
660
|
-
props: ['stream', 'paused', 'time', 'duration', 'buffering', 'audioTracks', 'selectedAudioTrackId', 'subtitlesTracks', 'selectedSubtitlesTrackId', 'subtitlesOffset', 'subtitlesSize', 'subtitlesTextColor', 'subtitlesBackgroundColor', 'subtitlesOutlineColor', 'playbackSpeed'],
|
|
688
|
+
props: ['stream', 'paused', 'time', 'duration', 'buffering', 'audioTracks', 'selectedAudioTrackId', 'subtitlesTracks', 'selectedSubtitlesTrackId', 'subtitlesOffset', 'subtitlesSize', 'subtitlesTextColor', 'subtitlesBackgroundColor', 'subtitlesOutlineColor', 'subtitlesOpacity', 'playbackSpeed'],
|
|
661
689
|
commands: ['load', 'unload', 'destroy'],
|
|
662
690
|
events: ['propValue', 'propChanged', 'ended', 'error', 'subtitlesTrackLoaded', 'audioTrackLoaded']
|
|
663
691
|
};
|
|
@@ -430,6 +430,7 @@ function WebOsVideo(options) {
|
|
|
430
430
|
var stream = null;
|
|
431
431
|
var startTime = null;
|
|
432
432
|
var subtitlesOffset = 0;
|
|
433
|
+
var subtitlesOpacity = 255;
|
|
433
434
|
var observedProps = {
|
|
434
435
|
stream: false,
|
|
435
436
|
paused: false,
|
|
@@ -443,6 +444,7 @@ function WebOsVideo(options) {
|
|
|
443
444
|
subtitlesSize: false,
|
|
444
445
|
subtitlesTextColor: false,
|
|
445
446
|
subtitlesBackgroundColor: false,
|
|
447
|
+
subtitlesOpacity: false,
|
|
446
448
|
audioTracks: false,
|
|
447
449
|
selectedAudioTrackId: false,
|
|
448
450
|
volume: false,
|
|
@@ -539,6 +541,13 @@ function WebOsVideo(options) {
|
|
|
539
541
|
|
|
540
542
|
return lastSubBgColor || 'rgba(255, 255, 255, 0)';
|
|
541
543
|
}
|
|
544
|
+
case 'subtitlesOpacity': {
|
|
545
|
+
if (destroyed) {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return subtitlesOpacity || 255;
|
|
550
|
+
}
|
|
542
551
|
case 'audioTracks': {
|
|
543
552
|
return audioTracks;
|
|
544
553
|
}
|
|
@@ -821,6 +830,22 @@ function WebOsVideo(options) {
|
|
|
821
830
|
|
|
822
831
|
break;
|
|
823
832
|
}
|
|
833
|
+
case 'subtitlesOpacity': {
|
|
834
|
+
if (typeof propValue === 'number') {
|
|
835
|
+
luna({
|
|
836
|
+
method: 'setSubtitleBackgroundOpacity',
|
|
837
|
+
parameters: {
|
|
838
|
+
'mediaId': knownMediaId,
|
|
839
|
+
'bgOpacity': Math.min(Math.max(propValue / 0.4, 0), 255),
|
|
840
|
+
}
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
subtitlesOpacity = propValue;
|
|
844
|
+
onPropChanged('subtitlesOpacity');
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
824
849
|
case 'selectedAudioTrackId': {
|
|
825
850
|
// console.log('WebOS', 'change audio track for id: ', knownMediaId, ' index:', propValue);
|
|
826
851
|
|
|
@@ -1014,6 +1039,7 @@ function WebOsVideo(options) {
|
|
|
1014
1039
|
onPropChanged('subtitlesSize');
|
|
1015
1040
|
onPropChanged('subtitlesTextColor');
|
|
1016
1041
|
onPropChanged('subtitlesBackgroundColor');
|
|
1042
|
+
onPropChanged('subtitlesOpacity');
|
|
1017
1043
|
onPropChanged('volume');
|
|
1018
1044
|
onPropChanged('muted');
|
|
1019
1045
|
onPropChanged('playbackSpeed');
|
|
@@ -1084,7 +1110,7 @@ WebOsVideo.canPlayStream = function() { // function(stream)
|
|
|
1084
1110
|
WebOsVideo.manifest = {
|
|
1085
1111
|
name: 'WebOsVideo',
|
|
1086
1112
|
external: false,
|
|
1087
|
-
props: ['stream', 'paused', 'time', 'duration', 'buffering', 'buffered', 'audioTracks', 'selectedAudioTrackId', 'subtitlesTracks', 'selectedSubtitlesTrackId', 'subtitlesOffset', 'subtitlesSize', 'subtitlesTextColor', 'subtitlesBackgroundColor', 'volume', 'muted', 'playbackSpeed'],
|
|
1113
|
+
props: ['stream', 'paused', 'time', 'duration', 'buffering', 'buffered', 'audioTracks', 'selectedAudioTrackId', 'subtitlesTracks', 'selectedSubtitlesTrackId', 'subtitlesOffset', 'subtitlesSize', 'subtitlesTextColor', 'subtitlesBackgroundColor', 'subtitlesOpacity', 'volume', 'muted', 'playbackSpeed'],
|
|
1088
1114
|
commands: ['load', 'unload', 'destroy'],
|
|
1089
1115
|
events: ['propValue', 'propChanged', 'ended', 'error', 'subtitlesTrackLoaded', 'audioTrackLoaded']
|
|
1090
1116
|
};
|
|
@@ -53,6 +53,7 @@ function withHTMLSubtitles(Video) {
|
|
|
53
53
|
var textColor = 'rgb(255, 255, 255)';
|
|
54
54
|
var backgroundColor = 'rgba(0, 0, 0, 0)';
|
|
55
55
|
var outlineColor = 'rgb(34, 34, 34)';
|
|
56
|
+
var opacity = 1;
|
|
56
57
|
var observedProps = {
|
|
57
58
|
extraSubtitlesTracks: false,
|
|
58
59
|
selectedExtraSubtitlesTrackId: false,
|
|
@@ -61,7 +62,8 @@ function withHTMLSubtitles(Video) {
|
|
|
61
62
|
extraSubtitlesOffset: false,
|
|
62
63
|
extraSubtitlesTextColor: false,
|
|
63
64
|
extraSubtitlesBackgroundColor: false,
|
|
64
|
-
extraSubtitlesOutlineColor: false
|
|
65
|
+
extraSubtitlesOutlineColor: false,
|
|
66
|
+
extraSubtitlesOpacity: false
|
|
65
67
|
};
|
|
66
68
|
|
|
67
69
|
function renderSubtitles() {
|
|
@@ -74,7 +76,8 @@ function withHTMLSubtitles(Video) {
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
subtitlesElement.style.bottom = offset + '%';
|
|
77
|
-
|
|
79
|
+
subtitlesElement.style.opacity = opacity;
|
|
80
|
+
subtitlesRenderer.render(cuesByTime, videoState.time - delay).forEach(function(cueNode) {
|
|
78
81
|
cueNode.style.display = 'inline-block';
|
|
79
82
|
cueNode.style.padding = '0.2em';
|
|
80
83
|
cueNode.style.whiteSpace = 'pre-wrap';
|
|
@@ -178,6 +181,13 @@ function withHTMLSubtitles(Video) {
|
|
|
178
181
|
|
|
179
182
|
return outlineColor;
|
|
180
183
|
}
|
|
184
|
+
case 'extraSubtitlesOpacity': {
|
|
185
|
+
if (destroyed) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return opacity;
|
|
190
|
+
}
|
|
181
191
|
default: {
|
|
182
192
|
return videoPropValue;
|
|
183
193
|
}
|
|
@@ -192,7 +202,8 @@ function withHTMLSubtitles(Video) {
|
|
|
192
202
|
case 'extraSubtitlesOffset':
|
|
193
203
|
case 'extraSubtitlesTextColor':
|
|
194
204
|
case 'extraSubtitlesBackgroundColor':
|
|
195
|
-
case 'extraSubtitlesOutlineColor':
|
|
205
|
+
case 'extraSubtitlesOutlineColor':
|
|
206
|
+
case 'extraSubtitlesOpacity': {
|
|
196
207
|
events.emit('propValue', propName, getProp(propName, null));
|
|
197
208
|
observedProps[propName] = true;
|
|
198
209
|
return true;
|
|
@@ -326,6 +337,21 @@ function withHTMLSubtitles(Video) {
|
|
|
326
337
|
|
|
327
338
|
return true;
|
|
328
339
|
}
|
|
340
|
+
case 'extraSubtitlesOpacity': {
|
|
341
|
+
if (typeof propValue === 'number') {
|
|
342
|
+
try {
|
|
343
|
+
opacity = Math.min(Math.max(propValue / 100, 0), 1);
|
|
344
|
+
} catch (error) {
|
|
345
|
+
// eslint-disable-next-line no-console
|
|
346
|
+
console.error('withHTMLSubtitles', error);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
renderSubtitles();
|
|
350
|
+
onPropChanged('extraSubtitlesOpacity');
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
329
355
|
default: {
|
|
330
356
|
return false;
|
|
331
357
|
}
|
|
@@ -387,6 +413,7 @@ function withHTMLSubtitles(Video) {
|
|
|
387
413
|
onPropChanged('extraSubtitlesTextColor');
|
|
388
414
|
onPropChanged('extraSubtitlesBackgroundColor');
|
|
389
415
|
onPropChanged('extraSubtitlesOutlineColor');
|
|
416
|
+
onPropChanged('extraSubtitlesOpacity');
|
|
390
417
|
video.dispatch({ type: 'command', commandName: 'destroy' });
|
|
391
418
|
events.removeAllListeners();
|
|
392
419
|
containerElement.removeChild(subtitlesElement);
|
|
@@ -448,7 +475,7 @@ function withHTMLSubtitles(Video) {
|
|
|
448
475
|
VideoWithHTMLSubtitles.manifest = {
|
|
449
476
|
name: Video.manifest.name + 'WithHTMLSubtitles',
|
|
450
477
|
external: Video.manifest.external,
|
|
451
|
-
props: Video.manifest.props.concat(['extraSubtitlesTracks', 'selectedExtraSubtitlesTrackId', 'extraSubtitlesDelay', 'extraSubtitlesSize', 'extraSubtitlesOffset', 'extraSubtitlesTextColor', 'extraSubtitlesBackgroundColor', 'extraSubtitlesOutlineColor'])
|
|
478
|
+
props: Video.manifest.props.concat(['extraSubtitlesTracks', 'selectedExtraSubtitlesTrackId', 'extraSubtitlesDelay', 'extraSubtitlesSize', 'extraSubtitlesOffset', 'extraSubtitlesTextColor', 'extraSubtitlesBackgroundColor', 'extraSubtitlesOutlineColor', 'extraSubtitlesOpacity'])
|
|
452
479
|
.filter(function(value, index, array) { return array.indexOf(value) === index; }),
|
|
453
480
|
commands: Video.manifest.commands.concat(['load', 'unload', 'destroy', 'addExtraSubtitlesTracks'])
|
|
454
481
|
.filter(function(value, index, array) { return array.indexOf(value) === index; }),
|