triniwiz / nativescript-videorecorder

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

Getting "TypeError: co.fitcom.fancycamera.FancyCamera is not a constructor" #53

Closed adenhertog closed 5 years ago

adenhertog commented 5 years ago

Platform: Android emulator

Versions: CLI: 5.1.0 Cross-platform modules: 5.1.1 Runtimes: 5.1.0 Plugin: nativescript-videorecorder@3.0.0-beta.2 Angular: 7.1.0

Reproduce: Create a new angular component, and try to embed a nativescript-videorecorder view as such: example.component.ts:

import { AdvancedVideoView } from 'nativescript-videorecorder/advanced'
registerElement('AdvancedVideoView', () => AdvancedVideoView)

@Component({
  selector: 'ns-example',
  template: '<AdvancedVideoView></AdvancedVideoView>'
})
export class RecordingComponent {
}

Expected: Video viewer should render

Actual:

System.err: com.tns.NativeScriptException:
System.err: Calling js method onCreateView failed
System.err:
System.err: TypeError: co.fitcom.fancycamera.FancyCamera is not a constructor
System.err: File: "file:///data/data/org.nativescript.example/files/app/tns_modules/nativescript-videorecorder/advanced/advanced-video-view.js, line: 40, column: 15

The line referenced in the error is advanced-video-view.android.js:40, ie:

return new co.fitcom.fancycamera.FancyCamera(this._context);

co.fitcom.fancycamera is an empty object ({})

adenhertog commented 5 years ago

This wasn't an issue with nativescript-videorecorder in the end but something due in the build chain.

Resolved by:

rm -rf platforms
tns platform add android
tns run android