Android Question Getview from BBCodeView

Solution
B4X:
Private Sub Media(Width As Int, Height As Int, URL As String) As String
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated(0, 0, 0, Width, Height)
    SMM.SetMediaWithExtra(pnl, URL, "", CreateMap(SMM.REQUEST_CALLBACK: Me))
    Dim name As String = "view" & BBCodeView1.Views.Size
    BBCodeView1.Views.Put(name, pnl)
    HandleMediaReadyEvent(pnl)
    Return $"[View=${name}/]"$
End Sub

Private Sub HandleMediaReadyEvent(pnl As B4XView)
    Wait For (pnl) SMM_MediaReady (Success As Boolean, Media1 As SMMedia)
    'do whatever you need with the player view here.
End Sub

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Private Sub Media(Width As Int, Height As Int, URL As String) As String
    Dim pnl As B4XView = xui.CreatePanel("")
    pnl.SetLayoutAnimated(0, 0, 0, Width, Height)
    SMM.SetMediaWithExtra(pnl, URL, "", CreateMap(SMM.REQUEST_CALLBACK: Me))
    Dim name As String = "view" & BBCodeView1.Views.Size
    BBCodeView1.Views.Put(name, pnl)
    HandleMediaReadyEvent(pnl)
    Return $"[View=${name}/]"$
End Sub

Private Sub HandleMediaReadyEvent(pnl As B4XView)
    Wait For (pnl) SMM_MediaReady (Success As Boolean, Media1 As SMMedia)
    'do whatever you need with the player view here.
End Sub
 
Upvote 0
Solution

PumaCyan

Member
Licensed User
For both video players:
Private Sub HandleMediaReadyEvent(pnl As B4XView)
    Wait For (pnl) SMM_MediaReady (Success As Boolean, Media1 As SMMedia)
    'do whatever you need with the player view here.
    #if B4A
        dim Player As SimpleExoPlayer
        dim PlayerView As SimpleExoPlayerView
    #Else If B4i
        dim Player As VideoPlayer
    #End If
    '
End Sub

thanks erel for your help...
then if I want to add code for iOS, is it really like this?
 
Upvote 0
Top