@stremio/stremio-video 0.0.77 → 0.0.78
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
|
@@ -255,39 +255,49 @@ function HTMLVideo(options) {
|
|
|
255
255
|
return Math.round(subtitlesOpacity * 100);
|
|
256
256
|
}
|
|
257
257
|
case 'audioTracks': {
|
|
258
|
-
if (hls === null || !Array.isArray(hls.
|
|
258
|
+
if (hls === null || !Array.isArray(hls.allAudioTracks)) {
|
|
259
259
|
return [];
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
return hls.
|
|
263
|
-
.map(function(track) {
|
|
262
|
+
return hls.allAudioTracks
|
|
263
|
+
.map(function(track, index) {
|
|
264
264
|
return Object.freeze({
|
|
265
|
-
id: 'EMBEDDED_' + String(
|
|
265
|
+
id: 'EMBEDDED_' + String(index),
|
|
266
266
|
lang: typeof track.lang === 'string' && track.lang.length > 0 ?
|
|
267
267
|
track.lang
|
|
268
268
|
:
|
|
269
269
|
typeof track.name === 'string' && track.name.length > 0 ?
|
|
270
270
|
track.name
|
|
271
271
|
:
|
|
272
|
-
String(
|
|
272
|
+
String(index),
|
|
273
273
|
label: typeof track.name === 'string' && track.name.length > 0 ?
|
|
274
274
|
track.name
|
|
275
275
|
:
|
|
276
276
|
typeof track.lang === 'string' && track.lang.length > 0 ?
|
|
277
277
|
track.lang
|
|
278
278
|
:
|
|
279
|
-
String(
|
|
279
|
+
String(index),
|
|
280
280
|
origin: 'EMBEDDED',
|
|
281
281
|
embedded: true
|
|
282
282
|
});
|
|
283
283
|
});
|
|
284
284
|
}
|
|
285
285
|
case 'selectedAudioTrackId': {
|
|
286
|
-
if (hls === null || hls.audioTrack ===
|
|
286
|
+
if (hls === null || hls.audioTrack === -1) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
var currentGroupTrack = hls.audioTracks[hls.audioTrack];
|
|
291
|
+
if (!currentGroupTrack) {
|
|
287
292
|
return null;
|
|
288
293
|
}
|
|
289
294
|
|
|
290
|
-
|
|
295
|
+
var allTracksIndex = hls.allAudioTracks.indexOf(currentGroupTrack);
|
|
296
|
+
if (allTracksIndex === -1) {
|
|
297
|
+
return null;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return 'EMBEDDED_' + String(allTracksIndex);
|
|
291
301
|
}
|
|
292
302
|
case 'volume': {
|
|
293
303
|
if (destroyed || videoElement.volume === null || !isFinite(videoElement.volume)) {
|
|
@@ -491,14 +501,18 @@ function HTMLVideo(options) {
|
|
|
491
501
|
}
|
|
492
502
|
case 'selectedAudioTrackId': {
|
|
493
503
|
if (hls !== null) {
|
|
494
|
-
var
|
|
504
|
+
var selectedAudioTrack = getProp('audioTracks')
|
|
495
505
|
.find(function(track) {
|
|
496
506
|
return track.id === propValue;
|
|
497
507
|
});
|
|
498
|
-
|
|
499
|
-
|
|
508
|
+
if (selectedAudioTrack) {
|
|
509
|
+
var trackIndex = parseInt(selectedAudioTrack.id.split('_').pop(), 10);
|
|
510
|
+
var allTracks = hls.allAudioTracks;
|
|
511
|
+
if (trackIndex >= 0 && trackIndex < allTracks.length) {
|
|
512
|
+
hls.setAudioOption(allTracks[trackIndex]);
|
|
513
|
+
}
|
|
500
514
|
onPropChanged('selectedAudioTrackId');
|
|
501
|
-
events.emit('audioTrackLoaded',
|
|
515
|
+
events.emit('audioTrackLoaded', selectedAudioTrack);
|
|
502
516
|
}
|
|
503
517
|
}
|
|
504
518
|
|
|
@@ -573,6 +587,9 @@ function HTMLVideo(options) {
|
|
|
573
587
|
onPropChanged('audioTracks');
|
|
574
588
|
onPropChanged('selectedAudioTrackId');
|
|
575
589
|
});
|
|
590
|
+
hls.on(Hls.Events.MANIFEST_LOADING, function() {
|
|
591
|
+
hls.subtitleTrack = -1;
|
|
592
|
+
});
|
|
576
593
|
hls.loadSource(stream.url);
|
|
577
594
|
hls.attachMedia(videoElement);
|
|
578
595
|
} else {
|
|
@@ -413,14 +413,9 @@ function ShellVideo(options) {
|
|
|
413
413
|
var hwdecValue = commandArgs.hardwareDecoding ? 'auto-copy' : 'no';
|
|
414
414
|
ipc.send('mpv-set-prop', ['hwdec', hwdecValue]);
|
|
415
415
|
|
|
416
|
-
//
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
var isMac = platformLower.indexOf('mac') !== -1;
|
|
420
|
-
if (!isMac) {
|
|
421
|
-
var videoOutput = platformLower === 'windows' ? (commandArgs.videoMode === null ? 'gpu-next' : 'gpu') : 'libmpv';
|
|
422
|
-
ipc.send('mpv-set-prop', ['vo', videoOutput]);
|
|
423
|
-
}
|
|
416
|
+
// Video output
|
|
417
|
+
var videoOutput = commandArgs.platform === 'windows' ? (commandArgs.videoMode === null ? 'gpu-next' : 'gpu') : 'libmpv';
|
|
418
|
+
ipc.send('mpv-set-prop', ['vo', videoOutput]);
|
|
424
419
|
|
|
425
420
|
var separateWindow = options.mpvSeparateWindow ? 'yes' : 'no';
|
|
426
421
|
ipc.send('mpv-set-prop', ['osc', separateWindow]);
|
|
@@ -352,7 +352,9 @@ function WebOsVideo(options) {
|
|
|
352
352
|
mode: audioTrackId === currentAudioTrack ? 'showing' : 'disabled',
|
|
353
353
|
});
|
|
354
354
|
});
|
|
355
|
-
currentAudioTrack
|
|
355
|
+
if (!currentAudioTrack) {
|
|
356
|
+
currentAudioTrack = 'EMBEDDED_0';
|
|
357
|
+
}
|
|
356
358
|
onPropChanged('audioTracks');
|
|
357
359
|
onPropChanged('selectedAudioTrackId');
|
|
358
360
|
}
|
|
@@ -189,6 +189,10 @@ function withHTMLSubtitles(Video) {
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
events.emit(eventName, propName, getProp(propName, propValue));
|
|
192
|
+
|
|
193
|
+
if (propName === 'selectedSubtitlesTrackId' && propValue !== null && selectedTrackId !== null) {
|
|
194
|
+
setProp('selectedExtraSubtitlesTrackId', null);
|
|
195
|
+
}
|
|
192
196
|
}
|
|
193
197
|
function onOtherVideoEvent(eventName) {
|
|
194
198
|
return function() {
|
|
@@ -300,6 +304,13 @@ function withHTMLSubtitles(Video) {
|
|
|
300
304
|
function setProp(propName, propValue) {
|
|
301
305
|
switch (propName) {
|
|
302
306
|
case 'selectedExtraSubtitlesTrackId': {
|
|
307
|
+
if (propValue !== null) {
|
|
308
|
+
video.dispatch({
|
|
309
|
+
type: 'setProp',
|
|
310
|
+
propName: 'selectedSubtitlesTrackId',
|
|
311
|
+
propValue: null,
|
|
312
|
+
});
|
|
313
|
+
}
|
|
303
314
|
if (propValue !== null && selectedTrackId === propValue) {
|
|
304
315
|
return true;
|
|
305
316
|
}
|
|
@@ -375,7 +375,10 @@ function withStreamingServer(Video) {
|
|
|
375
375
|
|
|
376
376
|
return true;
|
|
377
377
|
});
|
|
378
|
-
|
|
378
|
+
var hasEmbeddedSubtitles = probe.streams.some(function(stream) {
|
|
379
|
+
return stream.track === 'subtitle';
|
|
380
|
+
});
|
|
381
|
+
return isFormatSupported && areStreamsSupported && !hasEmbeddedSubtitles;
|
|
379
382
|
})
|
|
380
383
|
.catch(function() {
|
|
381
384
|
// this uses content-type header in HTMLVideo which
|