Skip to content Skip to sidebar Skip to footer

"undefined" Result Using Fileopener Phonegap Android And Failed To Open Video File?

i have downloaded plugin FileOpener and added in m,y project like this:

Solution 1:

<!DOCTYPE html><htmllang="en"dir="ltr"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width,  user-scalable=no"><title>sample</title><scriptsrc="js/cordova.js"></script><scriptsrc="js/video.js"></script><scriptsrc="js/fileopener.js"></script><scriptsrc="js/ADD_ANY_JQUERY.MIN.JS"></script><script>functionopenFile(filePath)
  {
     window.plugins.fileOpener.open(filePath);
  }
</script
</head>
<body><divdata-role="page"data-theme="a"class="my-page"id="video"><imgsrc="img/b_img1.png"onclick="openFile('file:///android_asset/www/videos/1974.mp4')"/></div></body>

Edited Fileopener.js will be like this:

cordova.define("cordova/plugin/fileopener",
  function(require, exports, module) {
    var exec = require("cordova/exec");
    varFileOpener = function () {};

FileOpener.prototype.open = function(url) {
    exec(null, null, "FileOpener", "openFile", [url]);
};

FileOpener.prototype.setTAG = function(tag) {
    exec(null, null, "FileOpener", "setTAG", [tag]);
};
var fileOpener = newFileOpener();
    module.exports = fileOpener;

});
/**
 * Load Plugin
 */if (!window.plugins) {
    window.plugins = {};
}
if (!window.plugins.fileOpener) {
    window.plugins.fileOpener = cordova.require("cordova/plugin/fileopener");
}

"js/ADD_ANY_JQUERY.MIN.JS" in this line add a any jquery.min.js

Lastly check that Cordova.js folder is in your js folder of your application.. And let me know if it is not working what's your logcat saying...

Solution 2:

i was using cordova 2.9.0 , jquery 1.9.1 ,jqm-1.3.2 and android-sdk-version:14 after adding code i was getting error:logcat is:

01-0619:36:53.132: D/PluginManager(9420): exec() call to unknown plugin: FileOpener 
 01-0619:36:53.202: D/CordovaLog(9420): file:///android_asset/www/js/fileopener.js: Line 20 : Class not found     
01-0619:36:53.202: I/Web Console(9420): Class not found at file:///android_asset/www/js/fileopener.js:20

the solution of this problem is i have done mistake in config.xml and in plugin.xml: config.xml replace this:

<featurename="videoplayer"><paramname="android-package"value= "com.adidas.football.app.videoPlayer.VideoPlayer"/></feature>

with:

<featurename="VideoPlayer"><paramname="android-package"value= "com.adidas.football.app.videoPlayer.VideoPlayer"/></feature>

plugin.xml replace this:

<pluginname="videoplayer"value= "com.adidas.football.app.videoPlayer.VideoPlayer"/>

with:

<pluginname="VideoPlayer"value= "com.adidas.football.app.videoPlayer.VideoPlayer"/>

a minor mistake of CAPITAL LETTER but it removes all error and finally i have no error except last one alert which i added in my edited question "cannot play video"

Post a Comment for ""undefined" Result Using Fileopener Phonegap Android And Failed To Open Video File?"