使用phonegap VideoPlayer插件在phonegap android中播放视频时出错

时间:2013-09-23 11:55:11

标签: java javascript jquery cordova video-player

VideoPlayer PLUGIN  这是我如何添加video.js:

<script src="js/cordova.js"></script>
  <script src="js/video.js"></script>

现在我创建包src / com / phonegap / plugins / video / VideoPlayer.java 我不确定它是c * 是或错了? *然后在配置中.XML:

  <feature name="VideoPlayer">
      <param name="android-package" value="com.phonegap.plugins.video.VideoPlayer.java"/>
    </feature>

然后在home.html

 <script>
$(document).ready(function()
{
window.plugins.videoPlayer.play("videos/1970.mp4");
});

</script>

运行应用程序获取错误:

 01-03 23:42:04.784: W/System.err(14212): Caused by: java.lang.NoClassDefFoundError: com.phonegap.plugins.video.VideoPlayer.java
01-03 23:42:04.792: I/System.out(14212): Error adding plugin com.phonegap.plugins.video.VideoPlayer.java.

并且无法运行应用程序并收到错误“应用程序ha意外停止”请告诉我我做错了什么?我想播放已保存在WWW / video / 1970.mp4

中的本地文件

1 个答案:

答案 0 :(得分:0)

nsawaya已经回答了它(不需要.java扩展名),我添加这些行以进一步说明plugin.xml文件。

<platform name="android">

    <config-file target="res/xml/config.xml" parent="/*">
        <feature name="VideoPlayer">
            <param name="android-package" value="com.moust.cordova.videoplayer.VideoPlayer"/>
        </feature>
    </config-file>

    <source-file src="src/android/VideoPlayer.java" target-dir="src/com/moust/cordova/videoplayer" />
    <source-file src="src/android/VideoPlayerView.java" target-dir="src/com/moust/cordova/videoplayer" />


    <source-file src="res/android/layout/video_player.xml" target-dir="res/layout" />
</platform>