@stremio/stremio-video 0.0.48 → 0.0.49

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.48",
3
+ "version": "0.0.49",
4
4
  "description": "Abstraction layer on top of different media players",
5
5
  "author": "Smart Code OOD",
6
6
  "main": "src/index.js",
@@ -2,6 +2,7 @@ var EventEmitter = require('eventemitter3');
2
2
  var cloneDeep = require('lodash.clonedeep');
3
3
  var deepFreeze = require('deep-freeze');
4
4
  var selectVideoImplementation = require('./selectVideoImplementation');
5
+ var platform = require('../platform');
5
6
  var ERROR = require('../error');
6
7
 
7
8
  function StremioVideo() {
@@ -25,6 +26,9 @@ function StremioVideo() {
25
26
  action = deepFreeze(cloneDeep(action));
26
27
  options = options || {};
27
28
  if (action.type === 'command' && action.commandName === 'load' && action.commandArgs) {
29
+ if (action.commandArgs.platform) {
30
+ platform.set(action.commandArgs.platform);
31
+ }
28
32
  var Video = selectVideoImplementation(action.commandArgs, options);
29
33
  if (video !== null && video.constructor !== Video) {
30
34
  video.dispatch({ type: 'command', commandName: 'destroy' });
@@ -633,9 +633,11 @@ function TizenVideo(options) {
633
633
 
634
634
  var tizenVersion = false;
635
635
 
636
- try {
637
- tizenVersion = parseFloat(global.tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version'));
638
- } catch(e) {}
636
+ var TIZEN_MATCHES = navigator.userAgent.match(/Tizen (\d+\.\d+)/i);
637
+
638
+ if (TIZEN_MATCHES && TIZEN_MATCHES[1]) {
639
+ tizenVersion = parseFloat(TIZEN_MATCHES[1]);
640
+ }
639
641
 
640
642
  if (!tizenVersion || tizenVersion >= 6) {
641
643
  retrieveExtendedTracks();
@@ -0,0 +1,6 @@
1
+ var platform = null;
2
+
3
+ module.exports = {
4
+ set: function(val) { platform = val; },
5
+ get: function() { return platform; }
6
+ };
@@ -1,5 +1,7 @@
1
+ var platform = require('./platform');
2
+
1
3
  function supportsTranscoding() {
2
- if (typeof global.tizen !== 'undefined' || typeof global.webOS !== 'undefined' || typeof window.qt !== 'undefined') {
4
+ if (['Tizen', 'webOS'].includes(platform.get()) || typeof window.qt !== 'undefined') {
3
5
  return Promise.resolve(false);
4
6
  }
5
7
  return Promise.resolve(true);