Skip to content

Commit

Permalink
fix: video playback in shell
Browse files Browse the repository at this point in the history
  • Loading branch information
core1024 committed Oct 24, 2024
1 parent f48ada9 commit a0e96da
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/ShellVideo/ShellVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ function ShellVideo(options) {
options = options || {};

var ipc = options.shellTransport;

var observedProps = {loaded: false};
var props = {};
var stremioProps = {};
Object.keys(stremioToMPVProps).forEach(function(key) {
if(stremioToMPVProps[key]) {
stremioProps[stremioToMPVProps[key]] = key;
}
});
command('unload');

ipc.send('mpv-command', ['stop']);
ipc.send('mpv-observe-prop', 'path');
Expand Down Expand Up @@ -66,13 +68,10 @@ function ShellVideo(options) {
var events = new EventEmitter();
var destroyed = false;
var stream = null;
// var selectedSubtitlesTrackId = null;
var observedProps = {};
var continueFrom = 0;

var avgDuration = 0;
var minClipDuration = 30;
var props = { };

function setBackground(visible) {
// This is a bit of a hack but there is no better way so far
Expand Down Expand Up @@ -111,6 +110,7 @@ function ShellVideo(options) {
// for bitwise maths so the maximum supported video duration is 1073741823 (2 ^ 30 - 1)
// which is around 34 years of playback time.
avgDuration = avgDuration ? (avgDuration + intDuration) >> 1 : intDuration;
events.emit('propChanged', 'loaded', 'true');
break;
}
case 'time-pos': {
Expand Down Expand Up @@ -350,10 +350,12 @@ function ShellVideo(options) {
}
case 'unload': {
props = {
pause: false,
mute: false,
speed: 1,
subtitlesTracks: [],
buffering: true,
audioTracks: [],
buffering: false,
aid: null,
sid: null,
};
Expand Down
2 changes: 1 addition & 1 deletion src/supportsTranscoding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function supportsTranscoding() {
if (typeof global.tizen !== 'undefined' || typeof global.webOS !== 'undefined') {
if (typeof global.tizen !== 'undefined' || typeof global.webOS !== 'undefined' || typeof window.qt !== 'undefined') {
return Promise.resolve(false);
}
return Promise.resolve(true);
Expand Down

0 comments on commit a0e96da

Please sign in to comment.