Explorar o código

Handle migration of setTransparency method.

Ian Walton hai 1 ano
pai
achega
ac1e459356
Modificáronse 1 ficheiros con 9 adicións e 3 borrados
  1. 9 3
      native/mpvVideoPlayer.js

+ 9 - 3
native/mpvVideoPlayer.js

@@ -7,7 +7,7 @@
     }
 
     class mpvVideoPlayer {
-        constructor({ events, loading, appRouter, globalize, appHost, appSettings, confirm }) {
+        constructor({ events, loading, appRouter, globalize, appHost, appSettings, confirm, dashboard }) {
             this.events = events;
             this.loading = loading;
             this.appRouter = appRouter;
@@ -15,6 +15,11 @@
             this.appHost = appHost;
             this.appSettings = appSettings;
 
+            // this can be removed after 10.9
+            this.setTransparency = (dashboard && dashboard.setBackdropTransparency)
+                ? dashboard.setBackdropTransparency.bind(dashboard)
+                : appRouter.setTransparency.bind(appRouter);
+
             /**
              * @type {string}
              */
@@ -156,7 +161,7 @@
                     if (this._currentPlayOptions.fullscreen) {
                         this.appRouter.showVideoOsd().then(this.onNavigatedToOsd);
                     } else {
-                        this.appRouter.setTransparency('backdrop');
+                        this.setTransparency('backdrop');
                         this._videoDialog.dlg.style.zIndex = 'unset';
                     }
 
@@ -467,7 +472,8 @@
             window.api.player.stop();
             window.api.power.setScreensaverEnabled(true);
 
-            this.appRouter.setTransparency('none');
+            this.setTransparency('none');
+
             document.body.classList.remove('hide-scroll');
 
             const dlg = this._videoDialog;