@stremio/stremio-video 0.0.63 → 0.0.65

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.63",
3
+ "version": "0.0.65",
4
4
  "description": "Abstraction layer on top of different media players",
5
5
  "author": "Smart Code OOD",
6
6
  "main": "src/index.js",
@@ -356,19 +356,18 @@ function ShellVideo(options) {
356
356
  stream = commandArgs.stream;
357
357
  onPropChanged('stream');
358
358
 
359
- ipc.send('mpv-set-prop', ['sub-ass-override', 'strip']);
359
+ var subAssOverride = commandArgs.assSubtitlesStyling ? 'strip' : 'no';
360
+ ipc.send('mpv-set-prop', ['sub-ass-override', subAssOverride]);
360
361
 
361
362
  // Hardware decoding
362
363
  var hwdecValue = commandArgs.hardwareDecoding ? 'auto-copy' : 'no';
363
364
  ipc.send('mpv-set-prop', ['hwdec', hwdecValue]);
364
365
 
365
- // opengl-cb is an alias for the new name "libmpv", as shown in mpv's video/out/vo.c aliases
366
- // opengl is an alias for the new name "gpu"
367
- // When on Windows we use d3d for the rendering in separate window
368
- var windowRenderer = navigator.platform === 'Win32' ? 'direct3d' : 'opengl';
369
- var videoOutput = options.mpvSeparateWindow ? windowRenderer : 'opengl-cb';
370
- var separateWindow = options.mpvSeparateWindow ? 'yes' : 'no';
366
+ // Video mode
367
+ var videoOutput = commandArgs.platform === 'windows' ? (commandArgs.videoMode === null ? 'gpu-next' : 'gpu') : 'libmpv';
371
368
  ipc.send('mpv-set-prop', ['vo', videoOutput]);
369
+
370
+ var separateWindow = options.mpvSeparateWindow ? 'yes' : 'no';
372
371
  ipc.send('mpv-set-prop', ['osc', separateWindow]);
373
372
  ipc.send('mpv-set-prop', ['input-default-bindings', separateWindow]);
374
373
  ipc.send('mpv-set-prop', ['input-vo-keyboard', separateWindow]);
@@ -38,7 +38,7 @@ function TizenVideo(options) {
38
38
  objElement.style.backgroundColor = 'black';
39
39
 
40
40
  var lastSub;
41
- var disabledSubs = false;
41
+ var disabledSubs = true;
42
42
 
43
43
  function refreshSubtitle() {
44
44
  if (lastSub) {
@@ -235,9 +235,6 @@ function TizenVideo(options) {
235
235
  if (totalTrackInfo[i].type === 'TEXT') {
236
236
  var textTrack = totalTrackInfo[i];
237
237
  var textTrackId = 'EMBEDDED_' + String(textTrack.index);
238
- if (!currentSubTrack && !textTracks.length) {
239
- currentSubTrack = textTrackId;
240
- }
241
238
  var extra = {};
242
239
  try {
243
240
  extra = JSON.parse(textTrack.extra_info);
@@ -329,9 +329,17 @@ function VidaaVideo(options) {
329
329
  }
330
330
  case 'selectedSubtitlesTrackId': {
331
331
  if (stream !== null) {
332
+ // important: disable all first
333
+ Array.from(videoElement.textTracks)
334
+ .forEach(function(track) {
335
+ track.mode = 'disabled';
336
+ });
337
+ // then enable selected
332
338
  Array.from(videoElement.textTracks)
333
339
  .forEach(function(track, index) {
334
- track.mode = 'EMBEDDED_' + String(index) === propValue ? 'showing' : 'disabled';
340
+ if ('EMBEDDED_' + String(index) === propValue) {
341
+ track.mode = 'showing';
342
+ }
335
343
  });
336
344
  var selecterdSubtitlesTrack = getProp('subtitlesTracks')
337
345
  .find(function(track) {
@@ -405,8 +413,12 @@ function VidaaVideo(options) {
405
413
  onPropChanged('buffering');
406
414
  if (videoElement.textTracks) {
407
415
  videoElement.textTracks.onaddtrack = function() {
408
- videoElement.textTracks.onaddtrack = null;
409
416
  setTimeout(function() {
417
+ // disable all embedded tracks on start
418
+ Array.from(videoElement.textTracks)
419
+ .forEach(function(track) {
420
+ track.mode = 'disabled';
421
+ });
410
422
  onPropChanged('subtitlesTracks');
411
423
  onPropChanged('selectedSubtitlesTrackId');
412
424
  });
@@ -414,7 +426,6 @@ function VidaaVideo(options) {
414
426
  }
415
427
  if (videoElement.audioTracks) {
416
428
  videoElement.audioTracks.onaddtrack = function() {
417
- videoElement.audioTracks.onaddtrack = null;
418
429
  setTimeout(function() {
419
430
  onPropChanged('audioTracks');
420
431
  onPropChanged('selectedAudioTrackId');
@@ -431,6 +442,8 @@ function VidaaVideo(options) {
431
442
  break;
432
443
  }
433
444
  case 'unload': {
445
+ videoElement.textTracks.onaddtrack = null;
446
+ videoElement.audioTracks.onaddtrack = null;
434
447
  stream = null;
435
448
  Array.from(videoElement.textTracks).forEach(function(track) {
436
449
  track.oncuechange = null;
@@ -20,52 +20,6 @@ function luna(params, call, fail, method) {
20
20
  window.webOS.service.request(method || 'luna://com.webos.media', params);
21
21
  }
22
22
 
23
- function launchVideoApp(params, success, failure) {
24
- window.webOS.service.request('luna://com.webos.applicationManager', {
25
- method: 'launch',
26
- parameters: {
27
- 'id': params.id,
28
- 'params': {
29
- 'payload':[
30
- {
31
- 'fullPath': params.url,
32
- 'artist':'',
33
- 'subtitle':'',
34
- 'dlnaInfo':{
35
- 'flagVal':4096,
36
- 'cleartextSize':'-1',
37
- 'contentLength':'-1',
38
- 'opVal':1,
39
- 'protocolInfo':'http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000',
40
- 'duration':0
41
- },
42
- 'mediaType':'VIDEO',
43
- 'thumbnail':'',
44
- 'deviceType':'DMR',
45
- 'album':'',
46
- 'fileName': params.name,
47
- 'lastPlayPosition': params.position
48
- }
49
- ]
50
- }
51
- },
52
- onSuccess: function () {
53
- success && success();
54
- },
55
- onFailure: function () {
56
- failure && failure(new Error('Failed to launch' + params.id));
57
-
58
- if (params.id === 'com.webos.app.photovideo') {
59
- params.id = 'com.webos.app.smartshare';
60
- launchVideoApp(params, success, failure);
61
- } else if(params.id === 'com.webos.app.smartshare') {
62
- params.id = 'com.webos.app.mediadiscovery';
63
- launchVideoApp(params, success, failure);
64
- }
65
- }
66
- });
67
- }
68
-
69
23
  var webOsColors = ['none', 'black', 'white', 'yellow', 'red', 'green', 'blue'];
70
24
  var stremioColors = {
71
25
  // rgba
@@ -562,28 +516,10 @@ function WebOsVideo(options) {
562
516
  }
563
517
  case 3: {
564
518
  error = ERROR.HTML_VIDEO.MEDIA_ERR_DECODE;
565
- launchVideoApp({
566
- id: 'com.webos.app.photovideo',
567
- url: stream.url,
568
- name: 'Stremio',
569
- position: -1,
570
- }, null, function(e) {
571
- // eslint-disable-next-line no-console
572
- console.error(e);
573
- });
574
519
  break;
575
520
  }
576
521
  case 4: {
577
522
  error = ERROR.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;
578
- launchVideoApp({
579
- id: 'com.webos.app.photovideo',
580
- url: stream.url,
581
- name: 'Stremio',
582
- position: -1,
583
- }, null, function(e) {
584
- // eslint-disable-next-line no-console
585
- console.error(e);
586
- });
587
523
  break;
588
524
  }
589
525
  default: {