I'm making a webpage that needs to run completely offline on Android 4.1 tablet. I'm trying to embed video stored locally on SD card using HTML5 <video> tag. Source attribute is pointing to a subdirectory containing that video using relative path.
The problem is, that after hitting play button, video stays black and plays only sound. After enabling video fullscreen, it plays normally. Same behavior in both native browser and Chrome. When I set source to same video stored online, or enable web server on the tablet and load the video from localhost, everything works fine and embedded video plays well.
Is there any way to force local video to play in embedded mode on Android? Or is this behavior for some security reasons?
Related
I'm trying to embed an MP4 video in an Android Phonegap 2.9.0 application using the HTML5 video tag.
The application will be used at an exhibition and the video has to be played back offline on the device. The video also can't be played back in the native player as the back button will be locked, which I think rules out the VideoPlayer plugin (http://simonmacdonald.blogspot.ca/2011/11/video-player-plugin-for-phonegap.html).
I have set the hardwareAccelerated attribute to true, which should work on Android 4.x devices (see http://simonmacdonald.blogspot.co.uk/2012/10/partial-support-for-video-tag-in.html). I successfully got a video embedded and played back as desired from a folder on the SD card on a Motorola Xoom tablet (Android 4.0.4).
I then wanted to recreate the same on an Archos 97 Titanium HD tablet (Android 4.1.1), which will be the device used in the exhibition. Using the same code as on the Xoom (just with the folder path adjusted according to the device) the Archos tablet plays only the sound and the video itself stays black, apart from a line of changing pixels in the top left corner. If I switch to fullscreen mode the video plays fine.
Also if I stream the same video from a web server it plays back fine embedded in webview - again using the same code.
So it seems like it can cope with the video format and encoding in webview, but for some reason it does not work from the internal (or external) SD card.
Has anyone come across a similar problem and is there any solution?
Is there a problem version 4.1.1 of Android or is this likely to be an issue with the device itself?
I'm developing an app with html, css and javascript which i port trough Phonegap to play on an Android tablet. (android 2.3.1 Gingerbread)
Everything is working fine, except the Youtube embed.
If i place the iframe embed on my page there is no play-button above my youtubescreen, so the user does not know he has to press it. But if you press it, the movie loads into the external android video playing app.
But here's the second problem; when the movie ends, the external android player closes and returns to my app, but then my youtube video screen is black en has these ugly android videocontrols of the external player.
But i can't do anything with it... so the user can't press the movie to watch it again.
Does anybody know how to implement a youtube video correctly into an HTML based android application?
It's HTML, so webviews, videoview, intents and things won't work...
Things i tried:
iframe embed
object embed
html5 video embed
online embed on external page
but in every attempt, those ugly videocontrols keep popping up after the video ended.
I also tried another player, but with the same result... Anyone ideas? :-)
First some details to help explain:
If you load a Vimeo link such as the following:
http://player.vimeo.com/video/40234826, or use their iframe embed code,
into a WebView, one of two things will happen.
If the device has the Adobe Flash Player app/plugin installed, it will display Vimeo's embedded player. Tapping play, plays the video inline as an embed.
If the device does not have the flash plugin, it will display an image with a play button. Tapping play, opens the Video in a system VideoView. (Because the button links to an mp4 file.)
Since Vimeo's embedded play can be a bit buggy on the vast variety of devices available, I have found that option 2, playing the Vimeo video in an Android media player is a much better experience.
Now the question is, how can I convince the WebView not to use Flash?
I have tried webview.getSettings().setPluginsEnabled(false); but it still loads the flash embed version. How can I trick Vimeo's player into thinking the device does not have flash installed?
Thanks
Update
After further investigating, it seems that setPluginState(PluginState.OFF) works pre honeycomb, but this doesn't work on Honeycomb and ICS.
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.
I want to find out wether Videos on Mobile Websites play inline or in a video application. If they play in an video application: are these applications device specific or is it always the same? Does someone have a link to the look of the controls so that I can build a photoshop preview on how my web video will look on Android?
EDIT
By inline, I mean that it does not play in an external app like it does on the iphone (opens quicktime player whenever you click a video on m.youtube.com) but that it just plays inside the browser.
HTML5 video tag supported on some androids see HTML5 <video> element on Android