devmaxime opened a new issue, #266:
URL: https://github.com/apache/cordova-plugin-media-capture/issues/266
Hello,
On a Ionic V6 app, I cannot use the plugin.
The app is the blank app, with MediaCapture installed and added to providers.
Here is the home.page.ts
```
import { Component } from '@angular/core';
import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from
'@awesome-cordova-plugins/media-capture/ngx';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
constructor(private mediaCapture: MediaCapture) {}
openCamera(){
let options: CaptureImageOptions = { limit: 3 }
this.mediaCapture.captureImage(options)
.then(
(data: MediaFile[]) => console.log(data),
(err: CaptureError) => console.error(err)
);
}
}
```
Here is the error.
```
[ng] Error: src/app/home/home.page.ts:15:50 - error TS2345: Argument of type
'(data: MediaFile[]) => void' is not assignable to parameter of type '(value:
MediaFile[] | CaptureError) => void |
PromiseLike<void>'.
[ng] Types of parameters 'data' and 'value' are incompatible.
[ng] Type 'MediaFile[] | CaptureError' is not assignable to type
'MediaFile[]'.
[ng] Type 'CaptureError' is missing the following properties from type
'MediaFile[]': length, pop, push, concat, and 26 more.
[ng]
[ng] 15 this.mediaCapture.captureImage(options).then((data: MediaFile[])
=> {
[ng]
~~~~~~~~~~~~~~~~~~~~~~~~
[ng]
[ng]
[ng]
[ng] × Failed to compile.
```
I have tried many other ways, cannot make it works. Is it related to ionic
v6 ? How to make it works please ?
Many thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]