我将我的应用程序的cordova版本升级到cordova@5.0.0,该应用程序中的FileOpener在cordova 3.0中已弃用。 然后我尝试使用VideoPlayer插件,如下所示:
我在Video.html页面中使用了这个
<body onload="onLoad()">
<a href="#" onClick="playVideo('file:///android_asset/www/videos/introduction/stroke.mp4');" rel="external">What is Stroke?</a>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" charset="utf-8" src="js/video.js"></script>
<script type="text/javascript">
function onLoad() {
document.addEventListener("deviceready", onDeviceReady, false);
}
function playVideo(vidUrl)
{
console.log("here");
window.plugins.videoPlayer.play(vidUrl);
}
</script>
</body>
但是我的res / xml文件夹中没有plugins.xml,而是我有config.xml文件,所以我把下面放在config.xml中(这是在这个路径中 - platforms / android / res / XML)
<plugins>
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
</plugins>
然后我创建了一个目录&#34; phonegap / plugins / video&#34;在这个文件夹&#34; src / com /&#34;并将VideoPlayer.java移入其中。
当我在本地计算机上运行它时,它会显示错误 - TypeError:undefined不是一个对象(评估&#39; window.plugins.videoPlayer&#39;),视频也不起作用。
注意:我关注installation steps on this page。
请告诉我在这方面做错了什么以及如何解决这个问题。