Editing a plugin.

What am I trying to do?

I am building a camera app with ionic and need to record video. I have the preview setup in the app correctly with a simple record button on top. I want to add video recording function to the plugin and being able to call CameraPreview.startRecording and CameraPreview.stopRecording .

What I have done?

Added video recording functionality to the plugin for the android platform. I added the exec functions in CameraPreview.js and the function signatures in CameraPreview.d.ts .

What is going wrong?

In my home.page.ts from my project, I am trying to call this.cameraPreview.startRecording() and this.cameraPreview.stopRecording() but when I run ionic cordova run android I get the following error:

ERROR in src/app/home/home.page.ts:90:32 - error TS2339: Property 'startRecording' does not exist on type 'CameraPreview'.

90             this.cameraPreview.startRecording();
src/app/home/home.page.ts:92:32 - errorgn TS2339: Property 'stopRecording' does not exist on type 'CameraPreview'.

92             this.cameraPreview.stopRecording();

[ERROR] An error occurred while running subprocess ng.
        ng run app:ionic-cordova-build --platform=android exited with exit code 1.

What have I tried so far?

  • removing and adding the android platform to recompile plugin. The plugin is getting re-compiled (checked this by adding a Log.d() function call and running adb logcat to find it). So the code is being added.
  • running npm install after editing plugin
  • making the changes to the plugin in the node_modules folder within my ionic project
  • adding the plugin directly by copying the plugin folder to a different directory and then adding the plugin via the copied plugin
  • a variety of other things I can’t remember

Help please?

Let me know if you want to see any of the files I mentioned.

in file @ionic-native/camera-preview/index.d.ts

add the new functions of record you call.
By the way you can look on my editing plugin which are not done yet, You welcome to help fix it: