Android: webview to run SWF that plays FLVs. - android

Working on getting a flash project to play from a local app/folder on a Samsung Galaxy 10.1 pad.
the project is basically a flash-file that references a xml for a playlist, which contains references to other swf files or flv videos which are stored in an asset subfolder.
Using video, netConnection and netStream to play the flv's, tried FLVPlayback for a moment but no insta-fix.
The project was embedded with html and works fine for the machines it is being used on, both local and from a server. It "works" from website to the app, but it gets chunky and internet will not be available when these pads are in use.
(But I think it's important to note that flv playback DOES work from the web onto the pad, so I guess the answer to my problems might be in some permission-limitation that I don't know of. )
I've had luck with an app just having a webview load the main swf:
WebView wv = new WebView(this);
WebSettings webSettings = wv.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setPluginsEnabled(true);
wv.loadUrl("file:///android_asset/DemoV6/main.swf");
setContentView(wv);
It successfully loads SWF files from the playlist and plays them, but once it gets to the flvs the
netStream pops out an NetStream.Play.StreamNotFound:[object NetStream], and with a bit of jury-rigging the netConnection pops out a NetConnection.Connect.Closed:[object NetConnection]
[ tl/dr: (Android3.1/galaxy 10.1) --> swf --> flv ==problem ]
So the question is, what do I have to change/add to make this SWF that plays FLVs, that plays fine from the internet, but does not open FLVs from an local app? (Also, I suspect I need to store the FLV's externally later on to reduce app-size, but thats a different riddle)

Found a way around it. Attempting to embed the FLVs into the assets folder for compilation was apparently not the best way to start with. loading the files externally gave me the result I wanted.
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
Log.d(TAG, "No SDCARD");
} else {
webView.loadUrl("file://"+Environment.getExternalStorageDirectory()+"/Folder/main.swf");
}

Related

Playing external MP3 file (without fully loading it) on iOS using Phonegap Media

I'm currently building an MP3 app for iOS and Android that plays external MP3 files. The problem is that my MP3 files are very big (usually over 100MB) each. I am using Phonegap's (3.0) Media plugin and everything works perfectly fine, except that it takes very long to initially play the file. I came to the conclusion that this is happening because Phonegap downloads the entire file before playing it. How do I tell it to start playing before the file is fully downloaded?
When the file is accessed through a regular desktop browser like Chrome, the file plays almost instantly, so I know the internet connection is not the issue here. Smaller files (around 5MB) plays almost instantly on the APP as well.

Cannot Play Audio Consistently in Some Android Browsers

I am unable to consistently play audio files from web pages on my Nexus S (Android 2.3.6). I have six audio files. They're in both mp3 and ogg formats. I have three browsers on the phone that I've experimented with: Browser 2.3.6, Dolphin HD 7.3.0, and Firefox 10.0.2.
All files play every time in Firefox. In Browser and Dolphin, some of the files play and some don't. Each time I test in Browser and Dolphin, the number of files that won't play increase, until finally none or only one plays.
Once, I used Android's Manage Applications tool to delete Browser's data and cache. This also caused the Browser process to stop. This one time, when I restarted Browser and tried to play to audio files, they all played. A subsequent attempt using this method did not restore the ability to play audio.
I also tried to play these audio files from the same web page on desktop computer browsers, Chrome and Firefox. In both cases, all audio files played every time.
Any ideas on what's causing this inconsistent audio playing behavior? Another useful answer would be, is there a way to trap the error (if there is one) Browser gets when it cannot play an audio file.
I'm more of a Java/Server-side programmer, so I'm not very knowledgable about a debug approach for this kind of problem in a mobile browser.

Android video playing issues

I have a HTML5 webapp with videos, stored in internal memory.
If I open the webapp in a WebView from the internal memory, the video doesn't play with a message: "Sorry, this video is not playable".
However if I copy the webapp to a server and open it via http, video plays fine.
I also tried to play the video in a VideoView, but the same happens like above:
From internal memory it doesn't play, however if opened via http from a website it works just fine.
Any workarounds? How to solve this problem?
Have you enabled javascript and other plugins to your webview?
mWebView.getSettings().setPluginsEnabled(true);
mWebView.getSettings().setJavaScriptEnabled(true);

you tube video not playing

I am new to android. I am trying play a youtube video whose path is present in an html file.. But when I do that I get black screen and upon tapping that a link will be displayed.. But I want the video to be displayed in my webview and on touching that video should be played..
I am using the following code..
webView = (WebView)findViewById(R.id.webView1);
WebSettings websets = webView.getSettings();
websets.setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/youtubes.html");
any help on this ?
Thanks,
Keerthi
YouTube usually requires flash. Are your links pointing to desktop version of YouTube? Do this links play in your browser in Android (not opening the YouTube app)?
Also take a look at m.youtube.com - this links are created to run on mobile devices by opening external player.
If you are running it on an emulator, then videos will not play from the youtube as you require flash. But if you are running it on a phone, then check if you added the methods properly or not. Also try using the VideoView class which takes the video source from your SD card. If it works, then it might be some problem with your code or if it doesnt works try installing any external player

HTML5 audio on Android 2.1 / Opera Mobile 11

I'm trying to create a HTML5 page with embedded audio. The page has to work on a ZTE BASE Lutea smartphone (Android 2.1) with Opera Mobile 11. Audio format is MP3 but OGG would be fine, too. All files have to be stored local on the smartphones sdcard.
My problem:
While audio plays fine when loaded from a webserver, it fails when files are local. This is definitely not a source path error. The audio file is preloaded and I can alert the correct audio duration. Then, when the audio play() method is called, it throws me a MEDIA_ERR_DECODE.
This is always the same no matter if I use MP3, OGG or the original WAV file. Any idea why there is a decoding problem of local audio files?
EDIT: When I'm opening a local HTML page "file://localhost/sdcard/index.html" in Opera and the page embeds an audio "http://localhost/audio.mp3", it works. Of course I had to install a local webserver and this would be a very bad solution.
Why is the HTTP protocol needed to play an audio file, does something like a local sandbox exist on android?
EDIT: I found that the Video object is able to play local sounds without problems. Unfortunately it's useless to me because I need an invisible audio and in Opera Mobile there is no way to prevent the video from going fullscreen.
With PhoneGap, you should be able to play local audio.
Opera 12 has the same issue. If the audio is played from cache is not working.
I am using appcache.
This worked on Firefox mobile, so we used that.

Categories

Resources