Youtube URL and webview

marcel

Active Member
Licensed User
Longtime User
hi,

Probably I am asking something that is asked already many times but searching the forum I could not get my webview and youtube working.

B4X:
// some init etc add to activity and then... 
rr.Target = WebView1
rr.Target = rr.RunMethod("getSettings")    
rr.RunMethod2("setPluginsEnabled", True, "java.lang.boolean") 
rr.RunMethod2("setJavaScriptCanOpenWindowsAutomatically",False,"java.lang.boolean")
 
WebView1.JavaScriptEnabled = True    
WebView1.ZoomEnabled = False    
WebView1.Visible = True
WebView1.LoadUrl("http://www.youtube.com/watch?v=wNTumjIfrCc")

In my manifest file I have the following:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(main, android:hardwareAccelerated, "true")

The video is working in the default browser on my android device (4.03 Samsung gal. S2) but not using the ewbview above.

I am lost here... any tips are welcome...
 

marcel

Active Member
Licensed User
Longtime User
FIxed it.

I have included the following code and it worked:

B4X:
     MyWebViewExtras.addWebChromeClient(WebView1, "MyEventName")
 
Upvote 0
Top