Merge pull request #2879 from snematoda/plyr-err

Display error in player
This commit is contained in:
Kavin 2023-08-30 13:55:13 +00:00 committed by GitHub
commit 8906215c9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 76 additions and 63 deletions

View File

@ -25,6 +25,11 @@
<span v-t="'actions.skip_segment'" /> <span v-t="'actions.skip_segment'" />
<i class="material-icons-round">skip_next</i> <i class="material-icons-round">skip_next</i>
</button> </button>
<span
v-if="error > 0"
v-t="{ path: 'player.failed', args: [error] }"
class="absolute top-8 rounded bg-black/80 p-2 text-lg backdrop-blur-sm"
/>
</div> </div>
</template> </template>
@ -67,6 +72,7 @@ export default {
isHoveringTimebar: false, isHoveringTimebar: false,
currentTime: 0, currentTime: 0,
seekbarPadding: 2, seekbarPadding: 2,
error: 0,
}; };
}, },
computed: { computed: {
@ -517,7 +523,9 @@ export default {
quality > 0 && (this.video.audioStreams.length > 0 || this.video.livestream) && !disableVideo; quality > 0 && (this.video.audioStreams.length > 0 || this.video.livestream) && !disableVideo;
if (qualityConds) this.$player.configure("abr.enabled", false); if (qualityConds) this.$player.configure("abr.enabled", false);
player.load(uri, 0, mime).then(() => { player
.load(uri, 0, mime)
.then(() => {
const isSafari = window.navigator?.vendor?.includes("Apple"); const isSafari = window.navigator?.vendor?.includes("Apple");
if (!isSafari) { if (!isSafari) {
@ -583,6 +591,10 @@ export default {
const autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false); const autoDisplayCaptions = this.getPreferenceBoolean("autoDisplayCaptions", false);
this.$player.setTextTrackVisibility(autoDisplayCaptions); this.$player.setTextTrackVisibility(autoDisplayCaptions);
})
.catch(e => {
console.error(e);
this.error = e.code;
}); });
// expand the player to fullscreen when the fullscreen query equals true // expand the player to fullscreen when the fullscreen query equals true

View File

@ -18,7 +18,8 @@
"dearrow": "DeArrow" "dearrow": "DeArrow"
}, },
"player": { "player": {
"watch_on": "Watch on {0}" "watch_on": "Watch on {0}",
"failed": "Failed with error code {0}, refer logs for more info"
}, },
"actions": { "actions": {
"subscribe": "Subscribe - {count}", "subscribe": "Subscribe - {count}",