@stremio/stremio-video 0.0.74 → 0.0.76
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
|
@@ -26,6 +26,7 @@ var stremioToMPVProps = {
|
|
|
26
26
|
'subtitlesTextColor': 'sub-color',
|
|
27
27
|
'subtitlesBackgroundColor': 'sub-back-color',
|
|
28
28
|
'subtitlesOutlineColor': 'sub-border-color',
|
|
29
|
+
'hdrInfo': null,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
function parseVersion(version) {
|
|
@@ -191,6 +192,23 @@ function ShellVideo(options) {
|
|
|
191
192
|
props[args.name] = embeddedProp(args);
|
|
192
193
|
break;
|
|
193
194
|
}
|
|
195
|
+
case 'video-params': {
|
|
196
|
+
props[args.name] = args.data;
|
|
197
|
+
var params = args.data || {};
|
|
198
|
+
var gamma = typeof params.gamma === 'string' ? params.gamma : null;
|
|
199
|
+
if (gamma === 'pq' || gamma === 'hlg') {
|
|
200
|
+
props.hdrInfo = {
|
|
201
|
+
gamma: gamma,
|
|
202
|
+
primaries: typeof params.primaries === 'string' ? params.primaries : null,
|
|
203
|
+
maxCll: typeof params['max-cll'] === 'number' ? params['max-cll'] : null,
|
|
204
|
+
maxLuma: typeof params['max-luma'] === 'number' ? params['max-luma'] : null,
|
|
205
|
+
};
|
|
206
|
+
} else {
|
|
207
|
+
props.hdrInfo = null;
|
|
208
|
+
}
|
|
209
|
+
onPropChanged('hdrInfo');
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
194
212
|
// In that case onPropChanged() is manually invoked as track-list contains all
|
|
195
213
|
// the tracks but we have different event for each track type
|
|
196
214
|
case 'track-list': {
|
|
@@ -243,6 +261,7 @@ function ShellVideo(options) {
|
|
|
243
261
|
});
|
|
244
262
|
|
|
245
263
|
function getProp(propName) {
|
|
264
|
+
if (propName === 'hdrInfo') return props.hdrInfo || null;
|
|
246
265
|
if(stremioToMPVProps[propName]) return props[stremioToMPVProps[propName]];
|
|
247
266
|
// eslint-disable-next-line no-console
|
|
248
267
|
console.log('Unsupported prop requested', propName);
|
|
@@ -371,9 +390,14 @@ function ShellVideo(options) {
|
|
|
371
390
|
var hwdecValue = commandArgs.hardwareDecoding ? 'auto-copy' : 'no';
|
|
372
391
|
ipc.send('mpv-set-prop', ['hwdec', hwdecValue]);
|
|
373
392
|
|
|
374
|
-
//
|
|
375
|
-
|
|
376
|
-
|
|
393
|
+
// On macOS the shell manages vo and HDR/EDR configuration
|
|
394
|
+
// directly — do not override vo here.
|
|
395
|
+
var platformLower = String(commandArgs.platform || '').toLowerCase();
|
|
396
|
+
var isMac = platformLower.indexOf('mac') !== -1;
|
|
397
|
+
if (!isMac) {
|
|
398
|
+
var videoOutput = platformLower === 'windows' ? (commandArgs.videoMode === null ? 'gpu-next' : 'gpu') : 'libmpv';
|
|
399
|
+
ipc.send('mpv-set-prop', ['vo', videoOutput]);
|
|
400
|
+
}
|
|
377
401
|
|
|
378
402
|
var separateWindow = options.mpvSeparateWindow ? 'yes' : 'no';
|
|
379
403
|
ipc.send('mpv-set-prop', ['osc', separateWindow]);
|
|
@@ -43,6 +43,7 @@ function withHTMLSubtitles(Video) {
|
|
|
43
43
|
var videoState = {
|
|
44
44
|
time: null,
|
|
45
45
|
paused: false,
|
|
46
|
+
buffering: false,
|
|
46
47
|
lastSyncAt: null,
|
|
47
48
|
playbackSpeed: 1
|
|
48
49
|
};
|
|
@@ -78,7 +79,7 @@ function withHTMLSubtitles(Video) {
|
|
|
78
79
|
if (videoState.time === null || !isFinite(videoState.time)) {
|
|
79
80
|
return null;
|
|
80
81
|
}
|
|
81
|
-
if (videoState.paused || videoState.lastSyncAt === null) {
|
|
82
|
+
if (videoState.paused || videoState.buffering || videoState.lastSyncAt === null) {
|
|
82
83
|
return videoState.time;
|
|
83
84
|
}
|
|
84
85
|
return videoState.time + (Date.now() - videoState.lastSyncAt) * videoState.playbackSpeed;
|
|
@@ -156,7 +157,7 @@ function withHTMLSubtitles(Video) {
|
|
|
156
157
|
break;
|
|
157
158
|
}
|
|
158
159
|
case 'paused': {
|
|
159
|
-
if (propValue && !videoState.paused && videoState.lastSyncAt !== null && videoState.time !== null) {
|
|
160
|
+
if (propValue && !videoState.paused && !videoState.buffering && videoState.lastSyncAt !== null && videoState.time !== null) {
|
|
160
161
|
videoState.time = videoState.time + (Date.now() - videoState.lastSyncAt) * videoState.playbackSpeed;
|
|
161
162
|
videoState.lastSyncAt = Date.now();
|
|
162
163
|
} else if (!propValue && videoState.paused) {
|
|
@@ -165,9 +166,19 @@ function withHTMLSubtitles(Video) {
|
|
|
165
166
|
videoState.paused = propValue;
|
|
166
167
|
break;
|
|
167
168
|
}
|
|
169
|
+
case 'buffering': {
|
|
170
|
+
if (propValue && !videoState.buffering && !videoState.paused && videoState.lastSyncAt !== null && videoState.time !== null) {
|
|
171
|
+
videoState.time = videoState.time + (Date.now() - videoState.lastSyncAt) * videoState.playbackSpeed;
|
|
172
|
+
videoState.lastSyncAt = Date.now();
|
|
173
|
+
} else if (!propValue && videoState.buffering) {
|
|
174
|
+
videoState.lastSyncAt = Date.now();
|
|
175
|
+
}
|
|
176
|
+
videoState.buffering = propValue;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
168
179
|
case 'playbackSpeed': {
|
|
169
180
|
if (propValue !== null && isFinite(propValue)) {
|
|
170
|
-
if (!videoState.paused && videoState.lastSyncAt !== null && videoState.time !== null) {
|
|
181
|
+
if (!videoState.paused && !videoState.buffering && videoState.lastSyncAt !== null && videoState.time !== null) {
|
|
171
182
|
videoState.time = videoState.time + (Date.now() - videoState.lastSyncAt) * videoState.playbackSpeed;
|
|
172
183
|
videoState.lastSyncAt = Date.now();
|
|
173
184
|
}
|
|
@@ -289,6 +300,9 @@ function withHTMLSubtitles(Video) {
|
|
|
289
300
|
function setProp(propName, propValue) {
|
|
290
301
|
switch (propName) {
|
|
291
302
|
case 'selectedExtraSubtitlesTrackId': {
|
|
303
|
+
if (propValue !== null && selectedTrackId === propValue) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
292
306
|
cuesByTime = null;
|
|
293
307
|
selectedTrackId = null;
|
|
294
308
|
delay = null;
|