Android Question [ Video Player ] play video without controls with autoplay

Waldemar Lima

Well-Known Member
Licensed User
Longtime User
hello guys I'm trying to play youtube videos without controls and with autoplay, but youtube doesn't support this functionality on mobile, does anyone know an effective alternative?

B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private WebView1 As WebView
    Private WebViewExtras1 As WebViewExtras
    
End Sub

Public Sub Initialize
    
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    
    WebView1.JavaScriptEnabled=True
    WebViewExtras1.addJavascriptInterface(WebView1, "B4A") ' NOT ESSENTIAL
    WebViewExtras1.addWebChromeClient(WebView1,"WebView1")
    ' Youtube autoplay=1 dont works on mobile
    WebView1.LoadUrl("https://www.youtube.com/embed/y881t8ilMyc?autoplay=1&mute=1&enablejsapi=1&controls=0")
    
End Sub
 
Top