Flash player in WebView

rickrack

Member
Licensed User
Longtime User
Hi all :)
I was trying to use a WebView to display a website.
This website has a .swf player with a live streaming that it could be seen with the default Android browser (you have to install Adobe Flash Player, of course)..

Unfortunately, this .swf player is not visible from the WebView and I have no idea for how to solve this problem.

Can you help me?
Thank you!
 

margret

Well-Known Member
Licensed User
Longtime User
WebView With Flash

Hello,

Here is the code. Be sure to include the Reflection library with your project. You can paste this code in a new project, include the Reflection library and install and you should be good to go.

B4X:
'Activity module
Sub Process_Globals
End Sub
Sub Globals
   Dim myw As WebView
   Dim rr As Reflector
   Dim HTMLStr As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
   HTMLStr = "http://www.canonusa.com"
   CreateWV
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub CreateWV
   myw.Initialize("myw")
   Activity.AddView(myw,0,0,1024,560)
   rr.Target = myw
    rr.Target = rr.RunMethod("getSettings")
    rr.RunMethod2("setPluginsEnabled", True, "java.lang.boolean")
   myw.JavaScriptEnabled = True
   myw.ZoomEnabled = True
   myw.Visible = True
   myw.LoadURL(HTMLStr)
End Sub
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
I'm trying this... it's a friend website to watch live football matches.

@margret - not working for me.. :(

It is working fine on all three devices I have. What are you testing on and what version of Android are you running. If you are on HoneyComb, you may need to mod the manifest. I had to on the ASUS.
 
Upvote 0

rickrack

Member
Licensed User
Longtime User
It is working fine on all three devices I have. What are you testing on and what version of Android are you running. If you are on HoneyComb, you may need to mod the manifest. I have to on the ASUS.


I've ICS.. (Galaxy Nexus)
So I need to edit the manifest file? what i should write there?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Ok thanks.

Yes, that code might work on "certain" sites, it doesn't work on yours, nor others using Flash Players.

Add this line to your manifest and see if it works:

B4X:
android:hardwareAccelerated="true"

It should be added to 'AddManifestText'
 
Last edited:
Upvote 0

rickrack

Member
Licensed User
Longtime User
@NJDude - Where I should add that line?
like this?

AddManifestText(
<application>
android:hardwareAccelerated="true"
</application>)
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
It should look something like this:
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" />
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:hardwareAccelerated="true"    <---Right here
    android:anyDensity="true"/>)
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Thanks NJDude,

I was just fixing to post. I had to go back and look.

WVFlash.jpg
 
Last edited:
Upvote 0

rickrack

Member
Licensed User
Longtime User
@NJDude - it didn't worked... i really can't belive it! android is a last-generation os and devs can't use flash on their browsers?

*edit*

:O margret so it works on yours... it's so strange
 
Upvote 0

rickrack

Member
Licensed User
Longtime User
I have a custom rom... could it depends by this?

*edit*

this evening (italian GMT) i will try with my "old" HTC Desire :)
 
Last edited:
Upvote 0
Top