AndroGeek
AndroGeek

Reputation: 1300

Error playing Html5 video using Phonegap

I am trying to play video locally using html5 video. I am not able to play the video and the error that i am getting is

    +12-15 12:53:30.620: INFO/SqliteDatabaseCpp(388): sqlite returned: error code = 14, msg = cannot open file at line 27701 of [8609a15dfa], db=/data/data/com.canvasm.video/databases/webview.db
    +12-15 12:53:30.620: INFO/SqliteDatabaseCpp(388): sqlite returned: error code = 14, msg = os_unix.c: open() at line 27701 - "" errno=2 path=/CachedGeoposition.db, db=/data/data/com.canvasm.video/databases/webview.db

Here is the code that i have written:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Video</title>

</head>
<body>
<video id="video" autobuffer height="480" width="500"  controls onclick="this.play()">
<source src="http://cdn.kaltura.org/apis/html5lib/kplayer-examples/media/bbb_trailer_360p.webm?b"></source>
</video>

</body>
</html>

And the android activity:

public class VideoCatalogActivity extends DroidGap {
   /** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    super.loadUrl("file:///android_asset/www/index.html");
    appView.setDownloadListener(new DownloadListener() 
    { 
        public void onDownloadStart(String url,String userAgent,String contentDisposition, String mimeType, long size)

         { 
                Intent viewIntent = new Intent(Intent.ACTION_VIEW); 
                viewIntent.setDataAndType(Uri.parse(url), mimeType); 
               try 
               { 
                startActivity(viewIntent); 
            } 
               catch (ActivityNotFoundException ex) 
            { 
                    Log.w("YourLogTag", "Couldn't find activity to view mimetype: " + mimeType); 
            } 
        } 
    }); 



}

}

Any help would be appreciated.

Upvotes: 0

Views: 1358

Answers (1)

Simon MacDonald
Simon MacDonald

Reputation: 23273

The video tag is broken in the Android WebView. In order to work around the issue I wrote a VideoPlayer plugin. It doesn't play videos in-line but it is better than nothing:

http://simonmacdonald.blogspot.com/2011/11/video-player-plugin-for-phonegap.html

Upvotes: 2

Related Questions