Skip to content

Commit

Permalink
destroy only the video impl when destroy action is dispatched
Browse files Browse the repository at this point in the history
  • Loading branch information
nklhtv committed Jun 10, 2022
1 parent 72a6959 commit e977ef4
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 e977ef4

Please sign in to comment.