Skip to content

Commit 81c87e5

Browse files
authored
Merge pull request #94 from Stremio/fix-tizen-5
Fix tizen 5
2 parents 75f2a02 + c123054 commit 81c87e5

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

src/StremioVideo/StremioVideo.js

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var EventEmitter = require('eventemitter3');
22
var cloneDeep = require('lodash.clonedeep');
33
var deepFreeze = require('deep-freeze');
44
var selectVideoImplementation = require('./selectVideoImplementation');
5+
var platform = require('../platform');
56
var ERROR = require('../error');
67

78
function StremioVideo() {
@@ -25,6 +26,9 @@ function StremioVideo() {
2526
action = deepFreeze(cloneDeep(action));
2627
options = options || {};
2728
if (action.type === 'command' && action.commandName === 'load' && action.commandArgs) {
29+
if (action.commandArgs.platform) {
30+
platform.set(action.commandArgs.platform);
31+
}
2832
var Video = selectVideoImplementation(action.commandArgs, options);
2933
if (video !== null && video.constructor !== Video) {
3034
video.dispatch({ type: 'command', commandName: 'destroy' });

src/TizenVideo/TizenVideo.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,11 @@ function TizenVideo(options) {
633633

634634
var tizenVersion = false;
635635

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+
}
639641

640642
if (!tizenVersion || tizenVersion >= 6) {
641643
retrieveExtendedTracks();

src/platform.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var platform = null;
2+
3+
module.exports = {
4+
set: function(val) { platform = val; },
5+
get: function() { return platform; }
6+
};

src/supportsTranscoding.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
var platform = require('./platform');
2+
13
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') {
35
return Promise.resolve(false);
46
}
57
return Promise.resolve(true);

0 commit comments

Comments
 (0)