triniwiz / nativescript-videorecorder

:video_camera: NativeScript plugin for Video Recording . :video_camera:
Apache License 2.0
43 stars 29 forks source link

App crashes after recording the video and tapping on the checkmark #45

Closed joey0xx closed 5 years ago

joey0xx commented 6 years ago

If the demo apps cannot help and there is no issue for your problem, tell us about it

After recording a video and tapping on the checkmark to get the file the app crashes

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Is there any code involved?

Here's the code im using

private get recordVideoOptions(){
      let options: VideoRecorderOptions = {
        hd: true,
        saveToGallery: true,
        format: 'mp4'
      }

      return options;
    }

    public recordVideo(){
      requestPermissions();
      let videorecorder = new VideoRecorder(this.recordVideoOptions)

      videorecorder.record().then((data) => {
        console.log(data.file)
      }).catch((err) => {
        console.log(err)
      })
    }

This is the error i get

System.err: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=999, result=-1, data=Intent { dat=content://org.nativescript.ProjectName.provider/external_files/DCIM/Camera/VID_1524262203847.mp4 flg=0x1 }} to activity {org.nativescript.ProjectName/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
System.err: Calling js method onActivityResult failed
System.err:
System.err: Error: java.lang.IllegalArgumentException: column '_data' does not exist
System.err:     android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
System.err:     android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
System.err:     com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err:     com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err:     com.tns.NativeScriptActivity.onActivityResult(NativeScriptActivity.java:75)
System.err:     android.app.Activity.dispatchActivityResult(Activity.java:7267)
System.err:     android.app.ActivityThread.deliverResults(ActivityThread.java:4524)
System.err:     android.app.ActivityThread.handleSendResult(ActivityThread.java:4571)
System.err:     android.app.ActivityThread.-wrap19(Unknown Source:0)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
System.err:     android.os.Handler.dispatchMessage(Handler.java:105)
System.err:     android.os.Looper.loop(Looper.java:164)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6809)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
System.err: File: "file:///data/data/org.nativescript.ProjectName/files/app/tns_modules/nativescript-videorecorder/videorecorder.js, line: 109, column: 33
System.err:
System.err: StackTrace:
System.err:     Frame: function:'getRealPathFromURI', file:'file:///data/data/org.nativescript.ProjectName/files/app/tns_modules/nativescript-videorecorder/videorecorder.js', line: 109, column: 34
System.err:     Frame: function:'app.android.currentContext.onActivityResult', file:'file:///data/data/org.nativescript.ProjectName/files/app/tns_modules/nativescript-videorecorder/videorecorder.js', line: 78, column: 45
System.err:
System.err:     at android.app.ActivityThread.deliverResults(ActivityThread.java:4528)
System.err:     at android.app.ActivityThread.handleSendResult(ActivityThread.java:4571)
System.err:     at android.app.ActivityThread.-wrap19(Unknown Source:0)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:105)
System.err:     at android.os.Looper.loop(Looper.java:164)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:6809)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
System.err: Caused by: com.tns.NativeScriptException:
System.err: Calling js method onActivityResult failed
System.err:
System.err: Error: java.lang.IllegalArgumentException: column '_data' does not exist
System.err:     android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
System.err:     android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
System.err:     com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err:     com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err:     com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err:     com.tns.NativeScriptActivity.onActivityResult(NativeScriptActivity.java:75)
System.err:     android.app.Activity.dispatchActivityResult(Activity.java:7267)
System.err:     android.app.ActivityThread.deliverResults(ActivityThread.java:4524)
System.err:     android.app.ActivityThread.handleSendResult(ActivityThread.java:4571)
System.err:     android.app.ActivityThread.-wrap19(Unknown Source:0)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1744)
System.err:     android.os.Handler.dispatchMessage(Handler.java:105)
System.err:     android.os.Looper.loop(Looper.java:164)
System.err:     android.app.ActivityThread.main(ActivityThread.java:6809)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
System.err: File: "file:///data/data/org.nativescript.ProjectName/files/app/tns_modules/nativescript-videorecorder/videorecorder.js, line: 109, column: 33
System.err:
System.err: StackTrace:
System.err:     Frame: function:'getRealPathFromURI', file:'file:///data/data/org.nativescript.ProjectName/files/app/tns_modules/nativescript-videorecorder/videorecorder.js', line: 109, column: 34
System.err:     Frame: function:'app.android.currentContext.onActivityResult', file:'file:///data/data/org.nativescript.ProjectName/files/app/tns_modules/nativescript-videorecorder/videorecorder.js', line: 78, column: 45
System.err:
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err:     at com.tns.NativeScriptActivity.onActivityResult(NativeScriptActivity.java:75)
System.err:     at android.app.Activity.dispatchActivityResult(Activity.java:7267)
System.err:     at android.app.ActivityThread.deliverResults(ActivityThread.java:4524)
System.err:     ... 9 more
System.err: Caused by: java.lang.IllegalArgumentException: column '_data' does not exist
System.err:     at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
System.err:     at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
System.err:     ... 18 more
klever34 commented 6 years ago

I am getting the same error as @joey0xx .. any solution to this yet?

darxmac commented 5 years ago

Hi, I still have this problem with the latest version directly from master

An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=999, result=-1, data=Intent { dat=content://com.my.app.provider/external_storage_root/DCIM/Camera/VID_1543571005475.mp4 flg=0x1 }} to activity {com.my.app/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
Calling js method onActivityResult failed

Error: java.lang.IllegalArgumentException: column '_data' does not exist
    android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:333)
    android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:87)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:996)
    com.tns.Runtime.callJSMethod(Runtime.java:983)
    com.tns.Runtime.callJSMethod(Runtime.java:967)
    com.tns.Runtime.callJSMethod(Runtime.java:959)
    com.tns.NativeScriptActivity.onActivityResult(NativeScriptActivity.java:80)
    android.app.Activity.dispatchActivityResult(Activity.java:7235)
    android.app.ActivityThread.deliverResults(ActivityThread.java:4320)
    android.app.ActivityThread.handleSendResult(ActivityThread.java:4367)
    android.app.ActivityThread.-wrap19(Unknown Source:0)
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
    android.os.Handler.dispatchMessage(Handler.java:105)
    android.os.Looper.loop(Looper.java:164)
    android.app.ActivityThread.main(ActivityThread.java:6541)
    java.lang.reflect.Method.invoke(Native Method)
    com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
File: "file:///data/data/com.my.app/files/app/tns_modules/nativescript-videorecorder/videorecorder.js, line: 117, column: 33

StackTrace: 
    Frame: function:'getRealPathFromURI', file:'file:///data/data/com.my.app/files/app/tns_modules/nativescript-videorecorder/videorecorder.js', line: 117, column: 34
    Frame: function:'', file:'file:///data/data/com.my.app/files/app/tns_modules/nativescript-videorecorder/videorecorder.js', line: 85, column: 45
    Frame: function:'Observable.notify', file:'file:///data/data/com.my.app/files/app/tns_modules/tns-core-modules/data/observable/observable.js', line: 110, column: 23
    Frame: function:'ActivityCallbacksImplementation.onActivityResult', file:'file:///data/data/com.my.app/files/app/tns_modules/tns-core-modules/ui/frame/frame.js', line: 788, column: 29
    Frame: function:'NativeScriptActivity.onActivityResult', file:'file:///data/data/com.my.app/files/app/tns_modules/tns-core-modules/ui/frame/activity.js', line: 45, column: 25

    at android.app.ActivityThread.deliverResults(ActivityThread.java:4324)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4367)
    at android.app.ActivityThread.-wrap19(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1649)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6541)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: com.tns.NativeScriptException: 
Calling js method onActivityResult failed
darxmac commented 5 years ago

update: this only happens when saveToGallery is set to true