@mgithens wrote:
This question is also posted on StackOverflow
I can’t seem to get around these warning & errors when running on a Pixel 2:
Warnings and Errors:
[09:54:00] lint finished in 2.37 s [09:54:24] console.log: deviceready has not fired after 5 seconds. [09:54:24] console.log: Channel not fired: onDOMContentLoaded [09:54:24] console.log: Channel not fired: onFileSystemPathsReady [09:54:28] console.log: Angular is running in the development mode. Call enableProdMode() to enable the productionmode. [09:54:33] console.warn: Ionic Native: deviceready did not fire within 5000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them. [09:54:33] console.log: Start Recording [09:54:33] console.warn: Native: tried calling MediaCapture.captureImage, but the MediaCapture plugin is not installed. [09:54:33] console.warn: Install the MediaCapture plugin: 'ionic cordova plugin add cordova-plugin-media-capture' [09:54:33] console.error: plugin_not_installed
Steps to reproduce:
Install Ionic
npm install -g cordova ionic
Start App and run through the following:
$ ionic start
Project Name: mediacapture
Choose a ‘blank’ ionic-angular project
‘Y’ - integrate your new app with Cordova…
‘Y’ - Install the free Pro SDK…
cd ./mediacapture
Install the Cordova and Ionic Native plugins:
$ npm install @ionic-native/core --save
$ ionic cordova plugin add cordova-plugin-media-capture
$ npm install --save @ionic-native/media-capture
Edit the app.module.ts, home.html, & home.ts files as shown below
$ ionic serve -lcs
Add the following to the app.module.ts file
import { MediaCapture/*, MediaFile, CaptureError, CaptureImageOptions*/ } from '@ionic-native/media-capture'; providers: [ ... MediaCapture,
Add the following to the home.html file
<ion-content padding> <button ion-button (click)="startrecording()">Start</button> </ion-content> Add the following to the home.ts file import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from '@ionic-native/media-capture'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { constructor(public navCtrl: NavController,private mediaCapture: MediaCapture) { } startrecording(){ console.log('Start Recording'); let options: CaptureImageOptions = { limit: 3 }; this.mediaCapture.captureImage(options) .then( (data: MediaFile[]) => console.log(data), (err: CaptureError) => console.error(err) ); } }
Listing plugins show that the Media Capture plugin is installed:
$ ionic cordova plugin list > cordova plugin ls You have been opted out of telemetry. To change this, run: cordova telemetry on. cordova-plugin-media-capture 3.0.1 "Capture"
References:
Posts: 3
Participants: 2