[vlc-devel] [PATCH] qml: fix automatically switching to the maxi-player

Pierre Lamot pierre at videolabs.io
Mon Dec 14 11:05:38 CET 2020


---
 .../gui/qt/maininterface/qml/MainDisplay.qml    | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/maininterface/qml/MainDisplay.qml b/modules/gui/qt/maininterface/qml/MainDisplay.qml
index 273b6c78a1..f1f6d08698 100644
--- a/modules/gui/qt/maininterface/qml/MainDisplay.qml
+++ b/modules/gui/qt/maininterface/qml/MainDisplay.qml
@@ -37,6 +37,7 @@ Widgets.NavigableFocusScope {
 
     property alias g_mainDisplay: root
     property bool _inhibitMiniPlayer: false
+    property bool _showMiniPlayer: false
 
     onViewChanged: {
         viewProperties = ({})
@@ -73,6 +74,9 @@ Widgets.NavigableFocusScope {
             sourcesBanner.subSelectedIndex = stackView.currentItem.pageModel.findIndex(function (e) {
                 return e.name === stackView.currentItem.view
             })
+
+        if (player.hasVideoOutput && mainInterface.hasEmbededVideo)
+            _showMiniPlayer = true
     }
 
     navigationCancel: function() {
@@ -339,8 +343,8 @@ Widgets.NavigableFocusScope {
                 width: VLCStyle.dp(320, VLCStyle.scale)
                 height: VLCStyle.dp(180, VLCStyle.scale)
                 z: 2
-                visible: !root._inhibitMiniPlayer && mainInterface.hasEmbededVideo
-                enabled: !root._inhibitMiniPlayer && mainInterface.hasEmbededVideo
+                visible: !root._inhibitMiniPlayer && root._showMiniPlayer
+                enabled: !root._inhibitMiniPlayer && root._showMiniPlayer
 
                 dragXMin: 0
                 dragXMax: root.width - playerPip.width
@@ -384,11 +388,12 @@ Widgets.NavigableFocusScope {
             }
 
             Connections {
-                target: player.videoTracks.count
-                onCountChanged: {
-                    if (player.videoTracks.count > 0
-                            && player.playingState === PlayerController.PLAYING_STATE_PLAYING) {
+                target: player
+                onHasVideoOutputChanged: {
+                    if (player.hasVideoOutput && mainInterface.hasEmbededVideo) {
                         g_mainDisplay.showPlayer()
+                    } else {
+                        _showMiniPlayer = false;
                     }
                 }
             }
-- 
2.25.1



More information about the vlc-devel mailing list