Open this-sunil opened 2 days ago
why native code added in flutter project side directly call programatically , because controls can't hide when pip mode and when initialize time theoplayer issue and pip mode aspect ration inside code issue class _PlayerPlatformActivityServiceListener implements PlatformActivityServiceListener {
THEOplayer player;
_PlayerPlatformActivityServiceListener({required this.player});
@override void onExitPictureInPicture() { debugLog("THEOplayer_$playerID: PlayerPlatformActivityServiceListener onExitPictureInPicture");
if (!player.allowAutomaticPictureInPicture) {
debugLog("THEOplayer_$playerID: PlayerPlatformActivityServiceListener onExitPictureInPicture not for me");
return;
}
player._setPresentationMode(player._presentationModeBeforePip);
}
@override void onUserLeaveHint() { debugLog("THEOplayer_$playerID:: PlayerPlatformActivityServiceListener onUserLeaveHint");
if (!player.allowAutomaticPictureInPicture) {
debugLog("THEOplayer_$playerID: PlayerPlatformActivityServiceListener onUserLeaveHint not for me");
return;
}
player._setPresentationMode(PresentationMode.PIP, userTriggered: false);
if (Platform.isIOS) {
//do nothing, AVplayer will do the transition
} else {
var pipModeFullscreenWidget = _FakePiPFullscreenWindow(player: player);
MaterialPageRoute pipRoute = MaterialPageRoute(
builder: (context) {
return pipModeFullscreenWidget;
},
settings: null);
Navigator.of(player._currentContext, rootNavigator: true).push(pipRoute);
}
}
@override void onPlayActionReceived() { debugLog("THEOplayer_$playerID:: PlayerPlatformActivityServiceListener onPlayActionReceived");
if (!player.allowAutomaticPictureInPicture) {
debugLog("THEOplayer_$playerID: PlayerPlatformActivityServiceListener onPlayActionReceived not for me");
return;
}
player.play();
}
@override void onPauseActionReceived() { debugLog("THEOplayer_$playerID:: PlayerPlatformActivityServiceListener onPauseActionReceived");
if (!player.allowAutomaticPictureInPicture) {
debugLog("THEOplayer_$playerID: PlayerPlatformActivityServiceListener onPauseActionReceived not for me");
return;
}
player.pause();
}
@override int get playerID => player.id;
} /// We use this widget to present the player in "fullscreen" to make it fully visible in PiP without any UI elements class _FakePiPFullscreenWindow extends StatelessWidget { const _FakePiPFullscreenWindow({ super.key, required this.player, });
final THEOplayer player;
@override Widget build(BuildContext context) { return Container( color: Colors.black, child: Align( alignment: Alignment.center, child: AspectRatio( aspectRatio: player.getVideoWidth() / player.getVideoHeight(), child: PresentationModeAwareWidget(player: player, presentationModeToCheck: const [PresentationMode.PIP])))); } }
theoplayer so much consume space in flutter optimize proguard rules
android api level 34 but not work picture in picture theoplayer,audio and video tracks emty and subtitle not work