@stremio/stremio-video 0.0.34 → 0.0.38

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.34",
3
+ "version": "0.0.38",
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.5.4-patch1/hls.js-1.5.4-patch1.tgz",
21
+ "hls.js": "https://github.com/Stremio/hls.js/releases/download/v1.5.4-patch2/hls.js-1.5.4-patch2.tgz",
22
22
  "lodash.clonedeep": "4.5.0",
23
23
  "magnet-uri": "6.2.0",
24
24
  "url": "0.11.0",
@@ -11,5 +11,21 @@ module.exports = {
11
11
  nudgeMaxRetry: 20,
12
12
  manifestLoadingTimeOut: 30000,
13
13
  manifestLoadingMaxRetry: 10,
14
+ fragLoadPolicy: {
15
+ default: {
16
+ maxTimeToFirstByteMs: 10000,
17
+ maxLoadTimeMs: 120000,
18
+ timeoutRetry: {
19
+ maxNumRetry: 20,
20
+ retryDelayMs: 0,
21
+ maxRetryDelayMs: 15
22
+ },
23
+ errorRetry: {
24
+ maxNumRetry: 6,
25
+ retryDelayMs: 1000,
26
+ maxRetryDelayMs: 15
27
+ }
28
+ }
29
+ }
14
30
  // liveDurationInfinity: false
15
31
  };
@@ -671,6 +671,7 @@ function WebOsVideo(options) {
671
671
  if (stream !== null && videoElement.readyState >= videoElement.HAVE_METADATA && propValue !== null && isFinite(propValue)) {
672
672
  try {
673
673
  videoElement.currentTime = parseInt(propValue, 10) / 1000;
674
+ onPropChanged('time');
674
675
  } catch(e) {
675
676
  // console.log('webos video change time error');
676
677
  // console.error(e);
@@ -0,0 +1,8 @@
1
+ function supportsTranscoding() {
2
+ if (typeof global.tizen !== 'undefined' || typeof global.webOS !== 'undefined') {
3
+ return Promise.resolve(false);
4
+ }
5
+ return Promise.resolve(true);
6
+ }
7
+
8
+ module.exports = supportsTranscoding;
@@ -6,6 +6,7 @@ var deepFreeze = require('deep-freeze');
6
6
  var mediaCapabilities = require('../mediaCapabilities');
7
7
  var convertStream = require('./convertStream');
8
8
  var fetchVideoParams = require('./fetchVideoParams');
9
+ var supportsTranscoding = require('../supportsTranscoding');
9
10
  var ERROR = require('../error');
10
11
 
11
12
  function withStreamingServer(Video) {
@@ -341,15 +342,13 @@ function withStreamingServer(Video) {
341
342
  }
342
343
 
343
344
  VideoWithStreamingServer.canPlayStream = function(stream, options) {
344
- return Video.canPlayStream(stream)
345
- .then(function(canPlay) {
346
- if (!canPlay) {
347
- throw new Error('Fallback using /hlsv2/probe');
345
+ return supportsTranscoding()
346
+ .then(function(supported) {
347
+ if (!supported) {
348
+ // we cannot probe the video in this case
349
+ return Video.canPlayStream(stream);
348
350
  }
349
-
350
- return canPlay;
351
- })
352
- .catch(function() {
351
+ // probing normally gives more accurate results
353
352
  var queryParams = new URLSearchParams([['mediaURL', stream.url]]);
354
353
  return fetch(url.resolve(options.streamingServerURL, '/hlsv2/probe?' + queryParams.toString()))
355
354
  .then(function(resp) {
@@ -370,6 +369,11 @@ function withStreamingServer(Video) {
370
369
  return true;
371
370
  });
372
371
  return isFormatSupported && areStreamsSupported;
372
+ })
373
+ .catch(function() {
374
+ // this uses content-type header in HTMLVideo which
375
+ // is unreliable, check can also fail due to CORS
376
+ return Video.canPlayStream(stream);
373
377
  });
374
378
  });
375
379
  };