@stremio/stremio-video 0.0.81 → 0.0.83
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 +1 -1
- package/src/ShellVideo/ShellVideo.js +14 -1
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ var deepFreeze = require('deep-freeze');
|
|
|
4
4
|
var ERROR = require('../error');
|
|
5
5
|
|
|
6
6
|
var SUBS_SCALE_FACTOR = 0.0066;
|
|
7
|
+
var EOF_END_TOLERANCE = 60000;
|
|
7
8
|
|
|
8
9
|
var stremioToMPVProps = {
|
|
9
10
|
'loaded': 'loaded',
|
|
@@ -259,7 +260,9 @@ function ShellVideo(options) {
|
|
|
259
260
|
ipc.on('mpv-event-ended', function(args) {
|
|
260
261
|
// older shells report 'other' for every non-error reason, including eof
|
|
261
262
|
if (args.error) onError(args.error);
|
|
262
|
-
else if (!args.reason || args.reason === 'eof' || args.reason === 'other')
|
|
263
|
+
else if (!args.reason || args.reason === 'eof' || args.reason === 'other') {
|
|
264
|
+
if (!isKnownEarlyEof()) onEnded();
|
|
265
|
+
}
|
|
263
266
|
});
|
|
264
267
|
|
|
265
268
|
function getProp(propName) {
|
|
@@ -279,6 +282,15 @@ function ShellVideo(options) {
|
|
|
279
282
|
function onEnded() {
|
|
280
283
|
events.emit('ended');
|
|
281
284
|
}
|
|
285
|
+
function isKnownEarlyEof() {
|
|
286
|
+
var time = props['time-pos'];
|
|
287
|
+
var duration = props.duration;
|
|
288
|
+
return typeof time === 'number' &&
|
|
289
|
+
isFinite(time) &&
|
|
290
|
+
typeof duration === 'number' &&
|
|
291
|
+
isFinite(duration) &&
|
|
292
|
+
time + EOF_END_TOLERANCE < duration;
|
|
293
|
+
}
|
|
282
294
|
function onPropChanged(propName) {
|
|
283
295
|
if (observedProps[propName]) {
|
|
284
296
|
events.emit('propChanged', propName, getProp(propName));
|
|
@@ -441,6 +453,7 @@ function ShellVideo(options) {
|
|
|
441
453
|
} else {
|
|
442
454
|
ipc.send('mpv-command', ['loadfile', stream.url]);
|
|
443
455
|
}
|
|
456
|
+
ipc.send('mpv-set-prop', ['sid', 'no']);
|
|
444
457
|
ipc.send('mpv-set-prop', ['pause', false]);
|
|
445
458
|
ipc.send('mpv-set-prop', ['speed', props.speed]);
|
|
446
459
|
if (props.aid) {
|