Skip to content

Commit

Permalink
Merge pull request #94 from Stremio/fix-tizen-5
Browse files Browse the repository at this point in the history
Fix tizen 5
  • Loading branch information
jaruba authored Jan 14, 2025
2 parents 75f2a02 + c123054 commit 81c87e5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/StremioVideo/StremioVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var EventEmitter = require('eventemitter3');
var cloneDeep = require('lodash.clonedeep');
var deepFreeze = require('deep-freeze');
var selectVideoImplementation = require('./selectVideoImplementation');
var platform = require('../platform');
var ERROR = require('../error');

function StremioVideo() {
Expand All @@ -25,6 +26,9 @@ function StremioVideo() {
action = deepFreeze(cloneDeep(action));
options = options || {};
if (action.type === 'command' && action.commandName === 'load' && action.commandArgs) {
if (action.commandArgs.platform) {
platform.set(action.commandArgs.platform);
}
var Video = selectVideoImplementation(action.commandArgs, options);
if (video !== null && video.constructor !== Video) {
video.dispatch({ type: 'command', commandName: 'destroy' });
Expand Down
8 changes: 5 additions & 3 deletions src/TizenVideo/TizenVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,11 @@ function TizenVideo(options) {

var tizenVersion = false;

try {
tizenVersion = parseFloat(global.tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version'));
} catch(e) {}
var TIZEN_MATCHES = navigator.userAgent.match(/Tizen (\d+\.\d+)/i);

if (TIZEN_MATCHES && TIZEN_MATCHES[1]) {
tizenVersion = parseFloat(TIZEN_MATCHES[1]);
}

if (!tizenVersion || tizenVersion >= 6) {
retrieveExtendedTracks();
Expand Down
6 changes: 6 additions & 0 deletions src/platform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var platform = null;

module.exports = {
set: function(val) { platform = val; },
get: function() { return platform; }
};
4 changes: 3 additions & 1 deletion src/supportsTranscoding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var platform = require('./platform');

function supportsTranscoding() {
if (typeof global.tizen !== 'undefined' || typeof global.webOS !== 'undefined' || typeof window.qt !== 'undefined') {
if (['Tizen', 'webOS'].includes(platform.get()) || typeof window.qt !== 'undefined') {
return Promise.resolve(false);
}
return Promise.resolve(true);
Expand Down

0 comments on commit 81c87e5

Please sign in to comment.