I’m having trouble calling some methods of an Android java library for ffmpeg. I think I successfuly loaded the library because I can console.log the library object:
JS: BuildConfig -> function () { [native code] }
JS: ExecuteBinaryResponseHandler -> function () { [native code] }
JS: FFmpeg -> function () { [native code] }
JS: FFmpegExecuteResponseHandler -> function () { [native code] }
JS: FFmpegLoadBinaryResponseHandler -> function () { [native code] }
JS: LoadBinaryResponseHandler -> function () { [native code] }
This is the code I want to “translate” (under Usage)
This is how far I got (using this nativescript guide) :
// [...]
var MyCustomLoadBinaryResponseHandler =
com.github.hiteshsondhi88.libffmpeg
.LoadBinaryResponseHandler.extend({
onStart: function() {
console.log('Started loading ffmpeg');
},
onFailure: function() {
console.log('Failed loading ffmpeg');
},
onSuccess: function() {
console.log('Successfully loaded ffmpeg');
},
onFinish: function() {
console.log('Finished loading ffmpeg');
}
});
console.dir(MyCustomLoadBinaryResponseHandler);
//^ this logs the following
//~ JS: === dump(): dumping members ===
//~ JS: "()function () { [native code] }"
//~ JS: === dump(): dumping function and properties names ===
//~ JS: extend()
//~ JS: null()
//~ JS: === dump(): finished ===
var context = app.android.context;
var ffmpeg =
com.github.hiteshsondhi88.libffmpeg.FFmpeg.getInstance(context);
console.dir(ffmpeg);
//^ this logs the following
//~ JS: === dump(): dumping members ===
//~ JS: {
//~ JS: "constructor": "constructor()function () { [native code]
//}"
//~ JS: }
//~ JS: === dump(): dumping function and properties names ===
//~ JS: constructor()
//~ JS: concatenate()
//~ JS: execute()
//~ JS: getDeviceFFmpegVersion()
//~ JS: getLibraryFFmpegVersion()
//~ JS: isFFmpegCommandRunning()
//~ JS: killRunningProcesses()
//~ JS: loadBinary()
//~ JS: setTimeout()
//~ JS: <init>()
//~ JS: clone()
//~ JS: equals()
//~ JS: finalize()
//~ JS: getClass()
//~ JS: hashCode()
//~ JS: notify()
//~ JS: notifyAll()
//~ JS: toString()
//~ JS: wait()
//~ JS: === dump(): finished ===
ffmpeg.loadBinary(
new MyCustomLoadBinaryResponseHandler()
);
var MyCustomExecuteBinaryResponseHandler =
com.github.hiteshsondhi88.libffmpeg
.ExecuteBinaryResponseHandler.extend({
onStart: function() {
console.log('Started running ffmpeg');
},
onProgress: function(thisMessage) {
console.log(' ffmpeg running');
console.log(thisMessage);
},
onFailure: function(thisMessage) {
console.log('Failed running ffmpeg');
console.log(thisMessage);
},
onSuccess: function(thisMessage) {
console.log('Successfully run ffmpeg');
console.log(thisMessage);
},
onFinish: function() {
console.log('Finished running ffmpeg');
}
});
//this is where it crashes
ffmpeg.execute('-version', new
MyCustomExecuteBinaryResponseHandler());
Unfortunately, the whole app crashes with no error message the app and I can’t continue unless I have more information on what is going on. Am I implementing the methods in a wrong way?How do you suggest I continue?
These are the last logs on the console:
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] from java.lang.Object com.tns.Runtime.callJSMethodNative(int, int, java.lang.String, int, boolean, java.lang.Object[])
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] at com.tns.Runtime.callJSMethodNative(Native method)
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] at com.tns.Runtime.callJSMethod(Runtime.java:912)
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] at com.tns.Runtime.callJSMethod(Runtime.java:896)
09-06 11:22:58.884 31522 31522 F art : art/runtime/java_vm_ext.cc:470] at com.tns.Runtime.callJSMethod(Runtime.java:888)
09-06 11:22:59.021 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethodNative(Native method)
09-06 11:22:59.021 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
09-06 11:22:59.021 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
09-06 11:22:59.021 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethod(Runtime.java:912)
09-06 11:22:59.021 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethod(Runtime.java:896)
09-06 11:22:59.021 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethod(Runtime.java:888)
09-06 11:22:59.022 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethodNative(Native method)
09-06 11:22:59.022 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1043)
09-06 11:22:59.022 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethodImpl(Runtime.java:925)
09-06 11:22:59.022 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethod(Runtime.java:912)
09-06 11:22:59.022 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethod(Runtime.java:896)
09-06 11:22:59.022 31522 31522 F art : art/runtime/runtime.cc:403] at com.tns.Runtime.callJSMethod(Runtime.java:888)