Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap 2.3 and Android with HTML5 video tag in 2013

I know this has been asked many times and most have the same answer: "Use the videplayer plugin". But this is not the way some of us would like to play a video, we want to play in inline. And according to me there is not answer.

http://simonmacdonald.blogspot.ca/2012/10/partial-support-for-video-tag-in.html

Can any one give an answer that plays the video inline in the phonegap webview?

I know poeple are playing html5 video tags in the Android webview (inline), building their own webviews, so what is the problem with phonegap?

I mean can android devices seriously not play html5 video in the phonegap webview in 2013??

Even trying this: (apparently you cant play videos out off the assets folder)

<video id="1" autobuffer width="100%" tabindex="0">
         <source src="file:///videos/video3.mp4" type="video/mp4" />
        </video>

Does not work

enter image description here

<script type="text/javascript">

    $(function(){
        $("video")[0].play()
    });
</script>

Manifest.xml:

<application android:icon="@drawable/icon" android:label="@string/app_name"
        android:hardwareAccelerated="true"
        android:debuggable="true">
like image 303
Harry Avatar asked Feb 11 '13 10:02

Harry


2 Answers

I recently ran into this problem and created a plugin that accomplishes what you are trying to do.

Here is the repository: https://github.com/jaeger25/Html5Video

like image 52
jaeger Avatar answered Nov 13 '22 02:11

jaeger


Here's an example app that, on the loadRemoteFileFromHTTP branch, successfully loads a video file in a webview from a remote location. On the loadLocalFileUsingFileReader branch, the test.m4v file exists on the SD Card of he the device by being referenced as file:///mnt/sdcard/external_sd/test.m4v. The gotcha is when you trying to include the video file in your App. There's no way to use the file:/// protocol to reference something in your App and you cannot use relative URLs for referencing videos in a WebView. In other words, if you have your video file in your assets/www directory and you set src to "nameOfVideo.mp4", it plain won't work :(. See the loadLocalFileUsingRelativeURL branch for an example.

Here's a bug report on the Relative URL issue.

like image 20
3 revs Avatar answered Nov 13 '22 01:11

3 revs