Skip to content

Commit

Permalink
Merge pull request #26 from Stremio/destroy-video
Browse files Browse the repository at this point in the history
destroy only the video impl when destroy action is dispatched
  • Loading branch information
nklhtv committed Jun 10, 2022
2 parents 81f977a + e977ef4 commit 20e90c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/StremioVideo/StremioVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,23 @@ function StremioVideo() {
}

if (action.type === 'command' && action.commandName === 'destroy') {
destroyed = true;
events.removeAllListeners();
video = null;
}

return;
}

throw new Error('Invalid action dispatched: ' + JSON.stringify(action));
};
this.destroy = function() {
destroyed = true;
if (video !== null) {
video.dispatch({ type: 'command', commandName: 'destroy' });
video = null;
}

events.removeAllListeners();
};
}

module.exports = StremioVideo;

0 comments on commit 20e90c7

Please sign in to comment.