使用Phonegap播放Html5视频时出错

时间:2011-12-15 07:51:31

标签: android html5 cordova

我正在尝试使用html5视频在本地播放视频。我无法播放视频,而且我得到的错误是

    +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

这是我写的代码:

<!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>

和android活动:

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); 
            } 
        } 
    }); 



}

}

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:2)

Android WebView中的视频标记已损坏。为了解决这个问题,我写了一个VideoPlayer插件。它不会在线播放视频,但它总比没有好:

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