Android Question Black incoming video ussing webview in WebRTC

scsjc

Well-Known Member
Licensed User
Longtime User
some time ago I used this code to make a videocall using the WebRTC, and it worked perfectly.
attached code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    WebView1.Initialize("WebView1")
    WebView1.Visible=True
    WebView1.BringToFront
    Activity.AddView(WebView1,0,0,100%x,100%y)
    
    Dim nameroom As String = "room1234"
    Activity.Title="https://appr.tc/r/" & nameroom 'addess to conect room from weburl
    
    rp.CheckAndRequest(rp.PERMISSION_CAMERA)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Result Then
        rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
        Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
        If Result Then
            Dim client As JavaObject
            client.InitializeNewInstance(Application.PackageName & ".main$MyChromeClient", Null)
            Dim jo As JavaObject = WebView1
            jo.RunMethod("setWebChromeClient", Array(client))
            
            WebView1.LoadUrl("https://appr.tc/r/" & nameroom)
        End If
    End If
End Sub

#if Java
import android.webkit.*;
public static class MyChromeClient extends WebChromeClient {
@Override
     public void onPermissionRequest(PermissionRequest request) {
        request.grant(request.getResources());
    }
}
#End If


I do not know if due to some update by WebRTC or the webview, but when users connect in the same VideoChat the Android terminal through webview only displays a black screen.

Does anyone know why it may be due?
thank you
 

Attachments

  • apprt-videochat.zip
    8.3 KB · Views: 366
Top