Skip to content

Commit

Permalink
Fix Detecting Platform
Browse files Browse the repository at this point in the history
  • Loading branch information
jaruba committed Jan 14, 2025
1 parent c045e43 commit c123054
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
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
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 window.tizen !== 'undefined' || typeof window.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 c123054

Please sign in to comment.