Android Question Full screen Exoplayer can't use simpleexoplayer

Scantech

Well-Known Member
Licensed User
Longtime User
The full screen exoplayer by erel will not allow me to use the simpleexoplayer. There is no simpleexoplayer global declaration. How do i make use of the simpleexoplayer. It contains a switchtargetview.

Full Screen Demo

B4X:
Private Sub SwitchTargetPlayerView(FullScreenIsDestination As Boolean)
    Dim mp As B4XPage3 = B4XPages.GetPage("Media Player")
 
    Dim jo As JavaObject
    Dim Player As Object = mp.Player.As(JavaObject).GetField("player")
    jo.InitializeStatic("androidx.media3.ui.PlayerView")
    jo.RunMethod("switchTargetView", Array(Player, IIf(FullScreenIsDestination, mp.SimpleExoPlayerView1, SimpleExoPlayerView1), IIf(FullScreenIsDestination, SimpleExoPlayerView1, mp.SimpleExoPlayerView1)))
End Sub
 

TILogistic

Expert
Licensed User
Longtime User
You clicked on the screen to see the controls.?

1713657370776.png
1713657412266.png
 
Upvote 0

Scantech

Well-Known Member
Licensed User
Longtime User
I found a solution as per below
B4X:
Sub Globals
    Private SimpleExoPlayerView1 As SimpleExoPlayerView
    Private Player2 As SimpleExoPlayer
    Dim mp As B4XPage3
End Sub

B4X:
 Sub Activity_Create(FirstTime As Boolean) 
    Player2.Initialize("player")
    SwitchTargetPlayerView(True)
    Player2 = mp.Player

End Sub

Private Sub SwitchTargetPlayerView(FullScreenIsDestination As Boolean)
    mp = B4XPages.GetPage("Media Player")
 
    Dim jo As JavaObject
    Dim Player As Object = mp.Player.As(JavaObject).GetField("player")
    jo.InitializeStatic("androidx.media3.ui.PlayerView")
    jo.RunMethod("switchTargetView", Array(Player, IIf(FullScreenIsDestination, mp.SimpleExoPlayerView1, SimpleExoPlayerView1), IIf(FullScreenIsDestination, SimpleExoPlayerView1, mp.SimpleExoPlayerView1)))
End Sub
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Encontré una solución como se muestra a continuación.
B4X:
Subglobales
    Privado SimpleExoPlayerView1 como SimpleExoPlayerView
    Private Player2 como SimpleExoPlayer
    Dim mp como B4XPage3
Fin Sub

[CÓDIGO = b4x] SwitchTargetPlayerView (Verdadero)
Jugador2 = mp.Jugador

Subtítulo final

Sub Switch privado TargetPlayerView (FullScreenIsDestination como booleano)
mp = B4XPages.GetPage("Reproductor multimedia")

Dim jo como objeto Java
Atenuar jugador como objeto = mp.Player.As(JavaObject).GetField("jugador")
jo.InitializeStatic("androidx.media3.ui.PlayerView")
jo.RunMethod("switchTargetView", Array(Player, IIf(FullScreenIsDestination, mp.SimpleExoPlayerView1, SimpleExoPlayerView1), IIf(FullScreenIsDestination, SimpleExoPlayerView1, mp.SimpleExoPlayerView1)))
Fin Sub[/CODE]
That solution is in the demo!
 
Upvote 0
Top