I wanted to play video in webview using html page. i created html page and kept in asset folder and video are stored in sdcard.
Thanks in advance.
see https://gist.github.com/3718414 for a sample which plays video in a webview. It shows how to either reference the HTML as a URL or assemble it inline.
you will need to make sure that you also take note of the permissions mentioned in the comments
Related
I'm new to this site and new to android programming and I need help. I have a webview where the webpage loaded has particular links and those links are mp3 playable files. What code(s) should I use to make it play(stream) and/or download within my android app instead of opening up browsers to play it? Thanks!
EDIT:
I have tried this:
myWebView.setWebViewClient(new WebViewClient());
myWebView.setWebChromeClient(new WebChromeClient());
which now plays the mp3 links but it only allows me to play and pause the audio file, and I'm stuck right now, is there a way for me to add something like a download button also a seek bar. Still, any help would be appreciated.
You want to play audio? If it is complex page with HTML5 content, you can use crosswalk library and XWalkView instead of WebView. But this library will strongly increase your apk size.
To download file go through this tutorial:
http://androidtrainningcenter.blogspot.in/2013/11/download-file-videoaudiotext-through.html
I would like to play a audio file from assets file from the background when a url is been loaded to webview in front.Any example or snippets would be helpful.Thanks.
Check this answer to know when the page is fully loaded into the WebView.
Then add the implementation to play the audio.
I am launching the MediaPlayer to play a .mov file that is being passed into the MediaPlayer as a Uri (which is standard). However, it is telling me that it cannot play the file. However, if I put this same link on the web, and the click the link to launch the movie (while in my Android browser) the video plays no problem. However, I can't get the WebView to play it with the Video tag despite all my efforts.
So here is my question, what magic is taking place that allows an android browser app to take a .html url which contains a link to play a video and play it? If I load the same url in a WebView, or try to pass the video url into the mediaplayer, it is a no go. The format of the video is .mov.
Thanks in advance to everyone.
The Android browser and WebView are very different, WebView is very barebones as it was designed expecting people to use it for very basic showing html webpages. WebView by default has no plugins enabled, no javascript enabled and so on and so on. Never expect that because something works in the browser that it will work in a WebView.
Now in regards to how the media is handled. The Browser has extra features set up to strip the video source from the page and launch it in the native player most of the time. This functionality is not built into WebView. And the native player is very picky about what needs to passed into it as a URI to be able to play it.
Hope that helps,
Stevy888
i have try to load swf in android.i use this :
but,i think that this is recommend to store SDCARD first and trying to display?
my question is, my point of view is correct or wrong?
i have try by android_asset but not get success.
First of all, I think you should use webview control to load SWF file. (if you have not done above).
Using webview, You can load swf file in any of following way,
Android Asset.
From SD Card.
URL from web.
I want to display my FLV video in emulator. Anybody who have already work on this?
Basically I need to play video from particular URL and assets folder. So just help on this topic.
You can play a FLV video using the flash plugin inside a WebView. See here.
Hope this will help you.
Edit:
These are done using Action Scripts.
Call the Action Script
Play flv using Action Script
flv programming
Also this
There is a workaround which will also allow you to play from a local asset resource, please read my answer to this similar question for a full solution:
Problem to load flv video in webview
I used flv.js in the webpage to make the html support flv video file without flash. Then use XWalkView something like webview in android studio to load the webpage. Use WWalkView..