1 | import { Observable } from 'rxjs/Observable';
|
2 | export interface MediaFile {
|
3 | /**
|
4 | * The name of the file, without path information.
|
5 | */
|
6 | name: string;
|
7 | /**
|
8 | * The full path of the file, including the name.
|
9 | */
|
10 | fullPath: string;
|
11 | /**
|
12 | * The file's mime type
|
13 | */
|
14 | type: string;
|
15 | /**
|
16 | * The date and time when the file was last modified.
|
17 | */
|
18 | lastModifiedDate: Date;
|
19 | /**
|
20 | * The size of the file, in bytes.
|
21 | */
|
22 | size: number;
|
23 | /**
|
24 | * Retrieves the format information of the media file.
|
25 | * @param {Function} successCallback
|
26 | * @param {Function} errorCallback
|
27 | */
|
28 | getFormatData(successCallback: (data: MediaFileData) => any, errorCallback?: (err: any) => any): any;
|
29 | }
|
30 | export interface MediaFileData {
|
31 | /**
|
32 | * The actual format of the audio and video content.
|
33 | */
|
34 | codecs: string;
|
35 | /**
|
36 | * The average bitrate of the content. The value is zero for images.
|
37 | */
|
38 | bitrate: number;
|
39 | /**
|
40 | * The height of the image or video in pixels. The value is zero for audio clips.
|
41 | */
|
42 | height: number;
|
43 | /**
|
44 | * The width of the image or video in pixels. The value is zero for audio clips.
|
45 | */
|
46 | width: number;
|
47 | /**
|
48 | * The length of the video or sound clip in seconds. The value is zero for images.
|
49 | */
|
50 | duration: number;
|
51 | }
|
52 | export interface CaptureError {
|
53 | code: string;
|
54 | }
|
55 | export interface CaptureAudioOptions {
|
56 | /**
|
57 | * Maximum number of audio clips. Defaults to 1.
|
58 | * On iOS you can only record one file.
|
59 | */
|
60 | limit?: number;
|
61 | /**
|
62 | * Maximum duration of an audio sound clip, in seconds. This does not work on Android devices.
|
63 | */
|
64 | duration?: number;
|
65 | }
|
66 | export interface CaptureImageOptions {
|
67 | /**
|
68 | * Maximum number of images to capture. This limit is not supported on iOS, only one image will be taken per invocation.
|
69 | */
|
70 | limit?: number;
|
71 | }
|
72 | export interface CaptureVideoOptions {
|
73 | /**
|
74 | * Maximum number of video clips to record. This value is ignored on iOS, only one video clip can be taken per invocation.
|
75 | */
|
76 | limit?: number;
|
77 | /**
|
78 | * Maximum duration per video clip. This will be ignored on BlackBerry.
|
79 | */
|
80 | duration?: number;
|
81 | /**
|
82 | * Quality of the video. This parameter can only be used with Android.
|
83 | */
|
84 | quality?: number;
|
85 | }
|
86 | export interface ConfigurationData {
|
87 | /**
|
88 | * The ASCII-encoded lowercase string representing the media type.
|
89 | */
|
90 | type: string;
|
91 | /**
|
92 | * The height of the image or video in pixels. The value is zero for sound clips.
|
93 | */
|
94 | height: number;
|
95 | /**
|
96 | * The width of the image or video in pixels. The value is zero for sound clips.
|
97 | */
|
98 | width: number;
|
99 | }
|
100 | /**
|
101 | * @name Media Capture
|
102 | * @description
|
103 | * @usage
|
104 | * ```typescript
|
105 | * import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions } from 'ionic-native';
|
106 | *
|
107 | *
|
108 | * let options: CaptureImageOptions = { limit: 3 };
|
109 | * MediaCapture.captureImage(options)
|
110 | * .then(
|
111 | * (data: MediaFile[]) => console.log(data),
|
112 | * (err: CaptureError) => console.error(err)
|
113 | * );
|
114 | *
|
115 | * ```
|
116 | * @interfaces
|
117 | * MediaFile
|
118 | * MediaFileData
|
119 | * CaptureError
|
120 | * CaptureAudioOptions
|
121 | * CaptureImageOptions
|
122 | * CaptureVideoOptions
|
123 | * ConfigurationData
|
124 | */
|
125 | export declare class MediaCapture {
|
126 | /**
|
127 | * The recording image sizes and formats supported by the device.
|
128 | * @returns {ConfigurationData[]}
|
129 | */
|
130 | static supportedImageModes: ConfigurationData[];
|
131 | /**
|
132 | * The audio recording formats supported by the device.
|
133 | * @returns {ConfigurationData[]}
|
134 | */
|
135 | static supportedAudioModes: ConfigurationData[];
|
136 | /**
|
137 | * The recording video resolutions and formats supported by the device.
|
138 | * @returns {ConfigurationData[]}
|
139 | */
|
140 | static supportedVideoModes: ConfigurationData[];
|
141 | /**
|
142 | * Start the audio recorder application and return information about captured audio clip files.
|
143 | * @param options
|
144 | * @returns {Promise<MediaFile[]>}
|
145 | */
|
146 | static captureAudio(options?: CaptureAudioOptions): Promise<MediaFile[] | CaptureError>;
|
147 | /**
|
148 | * Start the camera application and return information about captured image files.
|
149 | * @param options
|
150 | * @returns {Promise<MediaFile[]>}
|
151 | */
|
152 | static captureImage(options?: CaptureImageOptions): Promise<MediaFile[] | CaptureError>;
|
153 | /**
|
154 | * Start the video recorder application and return information about captured video clip files.
|
155 | * @param options
|
156 | * @returns {Promise<MediaFile[]>}
|
157 | */
|
158 | static captureVideo(options?: CaptureVideoOptions): Promise<MediaFile[] | CaptureError>;
|
159 | /**
|
160 | * is fired if the capture call is successful
|
161 | * @returns {Observable<MediaFile[]>}
|
162 | */
|
163 | static onPendingCaptureResult(): Observable<MediaFile[]>;
|
164 | /**
|
165 | * is fired if the capture call is unsuccessful
|
166 | * @returns {Observable<CaptureError>}
|
167 | */
|
168 | static onPendingCaptureError(): Observable<CaptureError>;
|
169 | }
|