• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android app embed flash video doesn't work

rushhh

Lurker
Apr 17, 2011
2
0
Hi. I am trying to get embed flash video on webview from IMDb Video: Hannibal.
I tryed with:
Code:
String html = "<object width=\"425\" height=\"344\"><param value=\"youTUBElink"><embed src=\"youtTUBElink\"  type=\"application/x-shockwave-flash\"  allowfullscreen=\"true\"  allowscriptaccess=\"always\"  width=\"425\" height=\"344\"></embed></param></object>";
		String mimeType = "text/html";
		String encoding = "utf-8";

                WebView webview = (WebView) findViewById(R.id.web);
		
		webview.getSettings().setPluginsEnabled(true);
		
		webview.getSettings().setJavaScriptEnabled(true);
		
		webview.loadData(html ,"text/html", "UTF-8");

That doesn't work for me.. Just blank screen.

Code:
String html = "<html> <body><embed src=\"http://www.imdb.com/video/imdb/vi1011875865\" type=\"application/x-shockwave-flash\" width=\"200\" height=\"200\"></embed>TEST</body> </html>";

Same...
Tryed with webview.loadDatBaseURL(null, html, "text/html", "UTF-8", "");

Nothing..

Only thing that works is
Code:
String html2="<iframe class=\"youtube-player\" autohide=\"1\" type=\"text/html\" allowfullscreen=\"true\" width=\"300\" height=\"300\" src=\"http://www.youtube.com/embed/NRHTdNWhAc8?fs=1 frameborder=\"0\">";

But only youtube videos.

Can you help me please!

PS: I am testin on 2.2 Froyo device.
 
Hi russh,
can you send me code to embed youtube video. i tried the third option you provided, it shows me video player, with initial pic, but when i start it manually, it does not plays video.
My email id is rajeev16mca2k5@gmail.com.
I am new in android and dont know much about it, so, its better, if you will send me some sample code itself.
Thanks,
Rajeev Singh
Sr. Sw Engg

Try to start off with more of a basic way of loading a video. What I would do is download one that does NOT work (using a swf downloader via browser). Then drop this into your assets folder and use something simular to this:

Code:
 webview.loadUrl("file:///android_asset/test.swf");

If that does indeed work, then I would host that same file on my own server and do a test with how it streams to figure out what is causing the issue your seeing. Since YouTube works... it must be something on how the WebView is seeing the swf file.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones