triniwiz / nativescript-videorecorder

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

Android NPE issue when recording #63

Closed cfjedimaster closed 4 years ago

cfjedimaster commented 5 years ago

Trying a very simple example using NS/Vue and I get this issue when I try to record.

JS: 'application.currentContext is deprecated; use startActivity, foregroundActivity, or context instead'
JS: [Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference
JS:     android.support.v4.content.FileProvider.parsePathStrategy(FileProvider.java:605)
JS:     android.support.v4.content.FileProvider.getPathStrategy(FileProvider.java:579)
JS:     android.support.v4.content.FileProvider.getUriForFile(FileProvider.java:417)
JS:     com.tns.Runtime.callJSMethodNative(Native Method)
JS:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
JS:     com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:1070)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:1050)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:1042)
JS:     com.tns.gen.java.lang.Object_vendor_30546_26_ClickListenerImpl.onClick(Object_vendor_30546_26_ClickListenerImpl.java:18)
JS:     android.view.View.performClick(View.java:6597)
JS:     android.view.View.perf...

And here is the code I used:

        recordVideo() {
            console.log('click');
            let options = {
                saveToGallery: false,
                duration: 30,
                format: 'mp4',
                size: 10,
                hd: true,
                explanation: 'For testing purposes'
            }

            let videorecorder = new vr.VideoRecorder(options);

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

        }

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.

When I click my button to run recordVideo, the first time I got a permissions prompt and the error, and now I just get the error.