Skip to content

Commit

Permalink
Allow retry with transcode instead of usng a hard failure. (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
iwalton3 committed Jan 16, 2022
1 parent dff5a0f commit bfd1b92
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions native/mpvVideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

class mpvVideoPlayer {
constructor({ events, loading, appRouter, globalize, appHost, appSettings, toast }) {
constructor({ events, loading, appRouter, globalize, appHost, appSettings, confirm }) {
this.events = events;
this.loading = loading;
this.appRouter = appRouter;
Expand Down Expand Up @@ -189,23 +189,33 @@
* @private
* @param e {Event} The event received from the `<video>` element
*/
this.onError = (error) => {
this.onError = async (error) => {
this.removeMediaDialog();
toast(`media error: ${error}`);
console.error(`media error: ${error}`);

this.events.trigger(this, 'error', [
{
type: 'mediadecodeerror',
const errorData = {
type: 'mediadecodeerror'
};

try {
await confirm({
title: "Playback Failed",
text: `Playback failed with error "${error}". Retry with transcode? (Note this may hang the player.)`,
cancelText: "Cancel",
confirmText: "Retry"
});
} catch (ex) {
// User declined retry
errorData.streamInfo = {
// Prevent jellyfin-web retrying with transcode
// which crashes the player
streamInfo: {
mediaSource: {
SupportsTranscoding: false
}
mediaSource: {
SupportsTranscoding: false
}
}
]);
};
}

this.events.trigger(this, 'error', [errorData]);
};

this.onDuration = (duration) => {
Expand Down

0 comments on commit bfd1b92

Please sign in to comment.