|
@@ -7,7 +7,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
class mpvVideoPlayer {
|
|
class mpvVideoPlayer {
|
|
- constructor({ events, loading, appRouter, globalize, appHost, appSettings }) {
|
|
+ constructor({ events, loading, appRouter, globalize, appHost, appSettings, toast }) {
|
|
this.events = events;
|
|
this.events = events;
|
|
this.loading = loading;
|
|
this.loading = loading;
|
|
this.appRouter = appRouter;
|
|
this.appRouter = appRouter;
|
|
@@ -190,11 +190,20 @@
|
|
* @param e {Event} The event received from the `<video>` element
|
|
* @param e {Event} The event received from the `<video>` element
|
|
*/
|
|
*/
|
|
this.onError = (error) => {
|
|
this.onError = (error) => {
|
|
- console.error(`media element error: ${error}`);
|
|
+ this.removeMediaDialog();
|
|
|
|
+ toast(`media error: ${error}`);
|
|
|
|
+ console.error(`media error: ${error}`);
|
|
|
|
|
|
this.events.trigger(this, 'error', [
|
|
this.events.trigger(this, 'error', [
|
|
{
|
|
{
|
|
- type: 'mediadecodeerror'
|
|
+ type: 'mediadecodeerror',
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ streamInfo: {
|
|
|
|
+ mediaSource: {
|
|
|
|
+ SupportsTranscoding: false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
]);
|
|
]);
|
|
};
|
|
};
|
|
@@ -375,23 +384,14 @@
|
|
return Promise.resolve();
|
|
return Promise.resolve();
|
|
}
|
|
}
|
|
|
|
|
|
- destroy() {
|
|
+ removeMediaDialog() {
|
|
|
|
+ this.loading.hide();
|
|
window.api.player.stop();
|
|
window.api.player.stop();
|
|
window.api.power.setScreensaverEnabled(true);
|
|
window.api.power.setScreensaverEnabled(true);
|
|
|
|
|
|
this.appRouter.setTransparency('none');
|
|
this.appRouter.setTransparency('none');
|
|
document.body.classList.remove('hide-scroll');
|
|
document.body.classList.remove('hide-scroll');
|
|
|
|
|
|
- const player = window.api.player;
|
|
|
|
- this._hasConnection = false;
|
|
|
|
- player.playing.disconnect(this.onPlaying);
|
|
|
|
- player.positionUpdate.disconnect(this.onTimeUpdate);
|
|
|
|
- player.finished.disconnect(this.onEnded);
|
|
|
|
- this._duration = undefined;
|
|
|
|
- player.updateDuration.disconnect(this.onDuration);
|
|
|
|
- player.error.disconnect(this.onError);
|
|
|
|
- player.paused.disconnect(this.onPause);
|
|
|
|
-
|
|
|
|
const dlg = this._videoDialog;
|
|
const dlg = this._videoDialog;
|
|
if (dlg) {
|
|
if (dlg) {
|
|
this._videoDialog = null;
|
|
this._videoDialog = null;
|
|
@@ -404,6 +404,20 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ destroy() {
|
|
|
|
+ this.removeMediaDialog();
|
|
|
|
+
|
|
|
|
+ const player = window.api.player;
|
|
|
|
+ this._hasConnection = false;
|
|
|
|
+ player.playing.disconnect(this.onPlaying);
|
|
|
|
+ player.positionUpdate.disconnect(this.onTimeUpdate);
|
|
|
|
+ player.finished.disconnect(this.onEnded);
|
|
|
|
+ this._duration = undefined;
|
|
|
|
+ player.updateDuration.disconnect(this.onDuration);
|
|
|
|
+ player.error.disconnect(this.onError);
|
|
|
|
+ player.paused.disconnect(this.onPause);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
* @private
|
|
* @private
|
|
*/
|
|
*/
|