diff --git a/ios/Classes/BetterPlayerPlugin.m b/ios/Classes/BetterPlayerPlugin.m index ed50403fa..63d93499d 100644 --- a/ios/Classes/BetterPlayerPlugin.m +++ b/ios/Classes/BetterPlayerPlugin.m @@ -404,6 +404,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { double width = [argsMap[@"width"] doubleValue]; double height = [argsMap[@"height"] doubleValue]; [player enablePictureInPicture:CGRectMake(left, top, width, height)]; + result(nil); } else if ([@"isPictureInPictureSupported" isEqualToString:call.method]){ if (@available(iOS 9.0, *)){ if ([AVPictureInPictureController isPictureInPictureSupported]){ diff --git a/lib/src/core/better_player_controller.dart b/lib/src/core/better_player_controller.dart index d1a53bc31..8bd613758 100644 --- a/lib/src/core/better_player_controller.dart +++ b/lib/src/core/better_player_controller.dart @@ -1085,12 +1085,14 @@ class BetterPlayerController { return; } final Offset position = renderBox.localToGlobal(Offset.zero); - return videoPlayerController?.enablePictureInPicture( + await videoPlayerController?.enablePictureInPicture( left: position.dx, top: position.dy, width: renderBox.size.width, height: renderBox.size.height, ); + _postEvent(BetterPlayerEvent(BetterPlayerEventType.pipStart)); + return; } else { BetterPlayerUtils.log("Unsupported PiP in current platform."); }