Thank you for the example. It works correctly in the sample project, but I couldn't make it work in my project.
The difference is that my app uses
B4XPages. The SimpleExoPlayer and SimpleExoPlayerView are declared in
Page2, not in B4XMainPage.
B4XMainPage simply creates and shows Page2, and I use a separate
FullScreen Activity with the same code from your example.
I changed the fullscreen code to reference the player in Page2:
Dim player As Object = mp.wplayer.player1.As(JavaObject).GetField("player")
where wplayer is my Page2 instance.
I verified that:
- GetField("player") returns an androidx.media3.exoplayer.ExoPlayerImpl.
- Both SimpleExoPlayerView controls are androidx.media3.ui.PlayerView.
However, PlayerView.switchTargetView() still fails with:
java.lang.RuntimeException: Method: switchTargetView not matched.
Is there anything special that needs to be done when the player is hosted in another B4XPage instead of B4XMainPage?