fix: toggle PiP button closes PiP when already active

This commit is contained in:
edde746
2026-03-06 03:08:28 +01:00
parent f7ca80de77
commit 985ba5d2c7
3 changed files with 15 additions and 0 deletions
@@ -117,6 +117,9 @@ class MpvPlayerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, MpvPlayerD
result(MpvPipController.isSupported)
case "enter":
enterPip(manual: true, result: result)
case "exit":
pipController?.stopPip()
result(nil)
case "setAutoPipReady":
if let args = call.arguments as? [String: Any], let ready = args["ready"] as? Bool {
autoPipEnabled = ready
@@ -171,6 +174,7 @@ class MpvPlayerPlugin: NSObject, FlutterPlugin, FlutterStreamHandler, MpvPlayerD
enteredPipViaAuto = !manual
playerCore.isPipActive = true
pip.startPip(metalLayer: metalLayer, window: window, aspectRatio: aspectRatio)
pipChannel?.invokeMethod("onPipChanged", arguments: true)
result?(["success": true])