@sumaris-net/ngx-components 2.2.2 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/doc/changelog.md +3 -0
  2. package/esm2020/public_api.mjs +3 -1
  3. package/esm2020/src/app/core/form/form.utils.mjs +1 -2
  4. package/esm2020/src/app/core/services/platform.service.mjs +6 -4
  5. package/esm2020/src/app/core/table/table.class.mjs +3 -3
  6. package/esm2020/src/app/shared/dates.mjs +2 -2
  7. package/esm2020/src/app/shared/file/json.utils.mjs +33 -0
  8. package/esm2020/src/app/shared/geolocation/geolocation.utils.mjs +41 -0
  9. package/esm2020/src/app/shared/material/latlong/testing/latlong.test.mjs +44 -16
  10. package/fesm2015/sumaris-net.ngx-components.mjs +113 -18
  11. package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
  12. package/fesm2020/sumaris-net.ngx-components.mjs +114 -15
  13. package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/public_api.d.ts +2 -0
  16. package/resources/README.md +5 -6
  17. package/src/app/core/form/form.utils.d.ts +0 -1
  18. package/src/app/core/table/table.class.d.ts +3 -1
  19. package/src/app/shared/file/json.utils.d.ts +11 -0
  20. package/src/app/shared/geolocation/geolocation.utils.d.ts +11 -0
  21. package/src/app/shared/material/latlong/testing/latlong.test.d.ts +5 -2
  22. package/plugins/clovelced-plugin-audiomanagement/README.md +0 -66
  23. package/plugins/cordova-plugin-camera/README.md +0 -703
  24. package/plugins/cordova-plugin-device/README.md +0 -309
  25. package/plugins/cordova-plugin-file/README.md +0 -848
  26. package/plugins/cordova-plugin-file-transfer/README.md +0 -598
  27. package/plugins/cordova-plugin-file-transfer/doc/de/README.md +0 -311
  28. package/plugins/cordova-plugin-file-transfer/doc/es/README.md +0 -311
  29. package/plugins/cordova-plugin-file-transfer/doc/fr/README.md +0 -270
  30. package/plugins/cordova-plugin-file-transfer/doc/it/README.md +0 -311
  31. package/plugins/cordova-plugin-file-transfer/doc/ja/README.md +0 -311
  32. package/plugins/cordova-plugin-file-transfer/doc/ko/README.md +0 -311
  33. package/plugins/cordova-plugin-file-transfer/doc/pl/README.md +0 -311
  34. package/plugins/cordova-plugin-file-transfer/doc/zh/README.md +0 -311
  35. package/plugins/cordova-plugin-ionic-keyboard/README.md +0 -220
  36. package/plugins/cordova-plugin-ionic-webview/README.md +0 -181
  37. package/plugins/cordova-plugin-media-capture/README.md +0 -626
  38. package/plugins/cordova-plugin-splashscreen/README.md +0 -387
  39. package/plugins/cordova-plugin-statusbar/README.md +0 -341
  40. package/plugins/cordova-plugin-telerik-imagepicker/README.md +0 -155
  41. package/plugins/cordova-plugin-whitelist/README.md +0 -185
  42. package/plugins/cordova-sqlite-storage/README.md +0 -1848
  43. package/plugins/integrator-cordova-plugin-downloader/README.md +0 -49
@@ -1,626 +0,0 @@
1
- ---
2
- title: Media Capture
3
- description: Capture audio, video, and images.
4
- ---
5
- <!--
6
- # license: Licensed to the Apache Software Foundation (ASF) under one
7
- # or more contributor license agreements. See the NOTICE file
8
- # distributed with this work for additional information
9
- # regarding copyright ownership. The ASF licenses this file
10
- # to you under the Apache License, Version 2.0 (the
11
- # "License"); you may not use this file except in compliance
12
- # with the License. You may obtain a copy of the License at
13
- #
14
- # http://www.apache.org/licenses/LICENSE-2.0
15
- #
16
- # Unless required by applicable law or agreed to in writing,
17
- # software distributed under the License is distributed on an
18
- # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19
- # KIND, either express or implied. See the License for the
20
- # specific language governing permissions and limitations
21
- # under the License.
22
- -->
23
-
24
- # cordova-plugin-media-capture
25
-
26
- [![Android Testsuite](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/android.yml/badge.svg)](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/android.yml) [![Chrome Testsuite](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/chrome.yml/badge.svg)](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/chrome.yml) [![iOS Testsuite](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/ios.yml/badge.svg)](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/ios.yml) [![Lint Test](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/lint.yml/badge.svg)](https://github.com/apache/cordova-plugin-media-capture/actions/workflows/lint.yml)
27
-
28
- This plugin provides access to the device's audio, image, and video capture capabilities.
29
-
30
- __WARNING__: Collection and use of images, video, or
31
- audio from the device's camera or microphone raises important privacy
32
- issues. Your app's privacy policy should discuss how the app uses
33
- such sensors and whether the data recorded is shared with any other
34
- parties. In addition, if the app's use of the camera or microphone is
35
- not apparent in the user interface, you should provide a just-in-time
36
- notice before the app accesses the camera or microphone (if the
37
- device operating system doesn't do so already). That notice should
38
- provide the same information noted above, as well as obtaining the
39
- user's permission (e.g., by presenting choices for __OK__ and __No
40
- Thanks__). Note that some app marketplaces may require your app to
41
- provide just-in-time notice and obtain permission from the user prior
42
- to accessing the camera or microphone. For more information, please
43
- see the Privacy Guide.
44
-
45
- This plugin defines global `navigator.device.capture` object.
46
-
47
- Although in the global scope, it is not available until after the `deviceready` event.
48
-
49
- document.addEventListener("deviceready", onDeviceReady, false);
50
- function onDeviceReady() {
51
- console.log(navigator.device.capture);
52
- }
53
-
54
- ## Installation
55
-
56
- cordova plugin add cordova-plugin-media-capture
57
-
58
- ## Supported Platforms
59
-
60
- - Android
61
- - Browser
62
- - iOS
63
- - Windows
64
-
65
- ## Objects
66
-
67
- - Capture
68
- - CaptureAudioOptions
69
- - CaptureImageOptions
70
- - CaptureVideoOptions
71
- - CaptureCallback
72
- - CaptureErrorCB
73
- - ConfigurationData
74
- - MediaFile
75
- - MediaFileData
76
-
77
- ## Methods
78
-
79
- - capture.captureAudio
80
- - capture.captureImage
81
- - capture.captureVideo
82
- - MediaFile.getFormatData
83
-
84
- ## Properties
85
-
86
- - __supportedAudioModes__: The audio recording formats supported by the device. (ConfigurationData[])
87
-
88
- - __supportedImageModes__: The recording image sizes and formats supported by the device. (ConfigurationData[])
89
-
90
- - __supportedVideoModes__: The recording video resolutions and formats supported by the device. (ConfigurationData[])
91
-
92
- ## capture.captureAudio
93
-
94
- > Start the audio recorder application and return information about captured audio clip files.
95
-
96
- navigator.device.capture.captureAudio(
97
- CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureAudioOptions options]
98
- );
99
-
100
- ### Description
101
-
102
- Starts an asynchronous operation to capture audio recordings using the
103
- device's default audio recording application. The operation allows
104
- the device user to capture multiple recordings in a single session.
105
-
106
- The capture operation ends when either the user exits the audio
107
- recording application, or the maximum number of recordings specified
108
- by `CaptureAudioOptions.limit` is reached. If no `limit` parameter
109
- value is specified, it defaults to one (1), and the capture operation
110
- terminates after the user records a single audio clip.
111
-
112
- When the capture operation finishes, the `CaptureCallback` executes
113
- with an array of `MediaFile` objects describing each captured audio
114
- clip file. If the user terminates the operation before an audio clip
115
- is captured, the `CaptureErrorCallback` executes with a `CaptureError`
116
- object, featuring the `CaptureError.CAPTURE_NO_MEDIA_FILES` error
117
- code.
118
-
119
- ### Supported Platforms
120
-
121
- - Android
122
- - iOS
123
- - Windows
124
-
125
- ### Example
126
-
127
- // capture callback
128
- var captureSuccess = function(mediaFiles) {
129
- var i, path, len;
130
- for (i = 0, len = mediaFiles.length; i < len; i += 1) {
131
- path = mediaFiles[i].fullPath;
132
- // do something interesting with the file
133
- }
134
- };
135
-
136
- // capture error callback
137
- var captureError = function(error) {
138
- navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
139
- };
140
-
141
- // start audio capture
142
- navigator.device.capture.captureAudio(captureSuccess, captureError, {limit:2});
143
-
144
- ### iOS Quirks
145
-
146
- - iOS does not have a default audio recording application, so a simple user interface is provided.
147
-
148
- ### Windows Phone 7 and 8 Quirks
149
-
150
- - Windows Phone 7 does not have a default audio recording application, so a simple user interface is provided.
151
-
152
- ## capture.captureImage
153
-
154
- > Start the camera application and return information about captured image files.
155
-
156
- navigator.device.capture.captureImage(
157
- CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureImageOptions options]
158
- );
159
-
160
- ### Description
161
-
162
- Starts an asynchronous operation to capture images using the device's
163
- camera application. The operation allows users to capture more than
164
- one image in a single session.
165
-
166
- The capture operation ends either when the user closes the camera
167
- application, or the maximum number of recordings specified by
168
- `CaptureImageOptions.limit` is reached. If no `limit` value is
169
- specified, it defaults to one (1), and the capture operation
170
- terminates after the user captures a single image.
171
-
172
- When the capture operation finishes, it invokes the `CaptureCB`
173
- callback with an array of `MediaFile` objects describing each captured
174
- image file. If the user terminates the operation before capturing an
175
- image, the `CaptureErrorCB` callback executes with a `CaptureError`
176
- object featuring a `CaptureError.CAPTURE_NO_MEDIA_FILES` error code.
177
-
178
- ### Supported Platforms
179
-
180
- - Android
181
- - Browser
182
- - iOS
183
- - Windows
184
-
185
- ### iOS Quirks
186
-
187
- Since iOS 10 it's mandatory to provide an usage description in the `info.plist` if trying to access privacy-sensitive data. When the system prompts the user to allow access, this usage description string will displayed as part of the permission dialog box, but if you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.
188
-
189
- This plugins requires the following usage descriptions:
190
-
191
- * `NSCameraUsageDescription` describes the reason the app accesses the user's camera.
192
- * `NSMicrophoneUsageDescription` describes the reason the app accesses the user's microphone.
193
- * `NSPhotoLibraryUsageDescriptionentry` describes the reason the app accesses the user's photo library.
194
-
195
-
196
- To add these entries into the `info.plist`, you can use the `edit-config` tag in the `config.xml` like this:
197
-
198
- ```
199
- <edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
200
- <string>need camera access to take pictures</string>
201
- </edit-config>
202
- ```
203
-
204
- ```
205
- <edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
206
- <string>need microphone access to record sounds</string>
207
- </edit-config>
208
- ```
209
-
210
- ```
211
- <edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
212
- <string>need to photo library access to get pictures from there</string>
213
- </edit-config>
214
- ```
215
-
216
- ### Browser Quirks
217
-
218
- Works in Chrome, Firefox and Opera only (since IE and Safari doesn't supports
219
- navigator.getUserMedia API)
220
-
221
- Displaying images using captured file's URL available in Chrome/Opera only.
222
- Firefox stores captured images in IndexedDB storage (see File plugin documentation),
223
- and due to this the only way to show captured image is to read it and show using its DataURL.
224
-
225
- ### Example
226
-
227
- // capture callback
228
- var captureSuccess = function(mediaFiles) {
229
- var i, path, len;
230
- for (i = 0, len = mediaFiles.length; i < len; i += 1) {
231
- path = mediaFiles[i].fullPath;
232
- // do something interesting with the file
233
- }
234
- };
235
-
236
- // capture error callback
237
- var captureError = function(error) {
238
- navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
239
- };
240
-
241
- // start image capture
242
- navigator.device.capture.captureImage(captureSuccess, captureError, {limit:2});
243
-
244
- ## capture.captureVideo
245
-
246
- > Start the video recorder application and return information about captured video clip files.
247
-
248
- navigator.device.capture.captureVideo(
249
- CaptureCB captureSuccess, CaptureErrorCB captureError, [CaptureVideoOptions options]
250
- );
251
-
252
- ### Description
253
-
254
- Starts an asynchronous operation to capture video recordings using the
255
- device's video recording application. The operation allows the user
256
- to capture more than one recordings in a single session.
257
-
258
- The capture operation ends when either the user exits the video
259
- recording application, or the maximum number of recordings specified
260
- by `CaptureVideoOptions.limit` is reached. If no `limit` parameter
261
- value is specified, it defaults to one (1), and the capture operation
262
- terminates after the user records a single video clip.
263
-
264
- When the capture operation finishes, it the `CaptureCB` callback
265
- executes with an array of `MediaFile` objects describing each captured
266
- video clip file. If the user terminates the operation before
267
- capturing a video clip, the `CaptureErrorCB` callback executes with a
268
- `CaptureError` object featuring a
269
- `CaptureError.CAPTURE_NO_MEDIA_FILES` error code.
270
-
271
- ### Supported Platforms
272
-
273
- - Android
274
- - iOS
275
- - Windows
276
-
277
- ### Example
278
-
279
- // capture callback
280
- var captureSuccess = function(mediaFiles) {
281
- var i, path, len;
282
- for (i = 0, len = mediaFiles.length; i < len; i += 1) {
283
- path = mediaFiles[i].fullPath;
284
- // do something interesting with the file
285
- }
286
- };
287
-
288
- // capture error callback
289
- var captureError = function(error) {
290
- navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
291
- };
292
-
293
- // start video capture
294
- navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:2});
295
-
296
-
297
-
298
- ## CaptureAudioOptions
299
-
300
- > Encapsulates audio capture configuration options.
301
-
302
- ### Properties
303
-
304
- - __limit__: The maximum number of audio clips the device user can record in a single capture operation. The value must be greater than or equal to 1 (defaults to 1).
305
-
306
- - __duration__: The maximum duration of an audio sound clip, in seconds.
307
-
308
- ### Example
309
-
310
- // limit capture operation to 3 media files, no longer than 10 seconds each
311
- var options = { limit: 3, duration: 10 };
312
-
313
- navigator.device.capture.captureAudio(captureSuccess, captureError, options);
314
-
315
- ### Android Quirks
316
-
317
- - The `duration` parameter is not supported. Recording lengths can't be limited programmatically.
318
-
319
-
320
- ### iOS Quirks
321
-
322
- - The `limit` parameter is not supported, so only one recording can be created for each invocation.
323
-
324
-
325
- ## CaptureImageOptions
326
-
327
- > Encapsulates image capture configuration options.
328
-
329
- ### Properties
330
-
331
- - __limit__: The maximum number of images the user can capture in a single capture operation. The value must be greater than or equal to 1 (defaults to 1).
332
-
333
- ### Example
334
-
335
- // limit capture operation to 3 images
336
- var options = { limit: 3 };
337
-
338
- navigator.device.capture.captureImage(captureSuccess, captureError, options);
339
-
340
- ### iOS Quirks
341
-
342
- - The __limit__ parameter is not supported, and only one image is taken per invocation.
343
-
344
-
345
- ## CaptureVideoOptions
346
-
347
- > Encapsulates video capture configuration options.
348
-
349
- ### Properties
350
-
351
- - __limit__: The maximum number of video clips the device's user can capture in a single capture operation. The value must be greater than or equal to 1 (defaults to 1).
352
-
353
- - __duration__: The maximum duration of a video clip, in seconds.
354
-
355
- ### Example
356
-
357
- // limit capture operation to 3 video clips
358
- var options = { limit: 3 };
359
-
360
- navigator.device.capture.captureVideo(captureSuccess, captureError, options);
361
-
362
- ### iOS Quirks
363
-
364
- - The __limit__ property is ignored. Only one video is recorded per invocation.
365
-
366
- ### Android Quirks
367
-
368
- - Android supports an additional __quality__ property, to allow capturing video at different qualities. A value of `1` ( the default ) means high quality and value of `0` means low quality, suitable for MMS messages.
369
- See [here](http://developer.android.com/reference/android/provider/MediaStore.html#EXTRA_VIDEO_QUALITY) for more details.
370
-
371
- ### Example ( Android w/ quality )
372
-
373
- // limit capture operation to 1 video clip of low quality
374
- var options = { limit: 1, quality: 0 };
375
- navigator.device.capture.captureVideo(captureSuccess, captureError, options);
376
-
377
-
378
- ## CaptureCB
379
-
380
- > Invoked upon a successful media capture operation.
381
-
382
- function captureSuccess( MediaFile[] mediaFiles ) { ... };
383
-
384
- ### Description
385
-
386
- This function executes after a successful capture operation completes.
387
- At this point a media file has been captured, and either the user has
388
- exited the media capture application, or the capture limit has been
389
- reached.
390
-
391
- Each `MediaFile` object describes a captured media file.
392
-
393
- ### Example
394
-
395
- // capture callback
396
- function captureSuccess(mediaFiles) {
397
- var i, path, len;
398
- for (i = 0, len = mediaFiles.length; i < len; i += 1) {
399
- path = mediaFiles[i].fullPath;
400
- // do something interesting with the file
401
- }
402
- };
403
-
404
- ## CaptureError
405
-
406
- > Encapsulates the error code resulting from a failed media capture operation.
407
-
408
- ### Properties
409
-
410
- - __code__: One of the pre-defined error codes listed below.
411
-
412
- ### Constants
413
-
414
- - `CaptureError.CAPTURE_INTERNAL_ERR`: The camera or microphone failed to capture image or sound.
415
-
416
- - `CaptureError.CAPTURE_APPLICATION_BUSY`: The camera or audio capture application is currently serving another capture request.
417
-
418
- - `CaptureError.CAPTURE_INVALID_ARGUMENT`: Invalid use of the API (e.g., the value of `limit` is less than one).
419
-
420
- - `CaptureError.CAPTURE_NO_MEDIA_FILES`: The user exits the camera or audio capture application before capturing anything.
421
-
422
- - `CaptureError.CAPTURE_PERMISSION_DENIED`: The user denied a permission required to perform the given capture request.
423
-
424
- - `CaptureError.CAPTURE_NOT_SUPPORTED`: The requested capture operation is not supported.
425
-
426
- ## CaptureErrorCB
427
-
428
- > Invoked if an error occurs during a media capture operation.
429
-
430
- function captureError( CaptureError error ) { ... };
431
-
432
- ### Description
433
-
434
- This function executes if an error occurs when trying to launch a
435
- media capture operation. Failure scenarios include when the capture
436
- application is busy, a capture operation is already taking place, or
437
- the user cancels the operation before any media files are captured.
438
-
439
- This function executes with a `CaptureError` object containing an
440
- appropriate error `code`.
441
-
442
- ### Example
443
-
444
- // capture error callback
445
- var captureError = function(error) {
446
- navigator.notification.alert('Error code: ' + error.code, null, 'Capture Error');
447
- };
448
-
449
- ## ConfigurationData
450
-
451
- > Encapsulates a set of media capture parameters that a device supports.
452
-
453
- ### Description
454
-
455
- Describes media capture modes supported by the device. The
456
- configuration data includes the MIME type, and capture dimensions for
457
- video or image capture.
458
-
459
- The MIME types should adhere to [RFC2046](http://www.ietf.org/rfc/rfc2046.txt). Examples:
460
-
461
- - `video/3gpp`
462
- - `video/quicktime`
463
- - `image/jpeg`
464
- - `audio/amr`
465
- - `audio/wav`
466
-
467
- ### Properties
468
-
469
- - __type__: The ASCII-encoded lowercase string representing the media type. (DOMString)
470
-
471
- - __height__: The height of the image or video in pixels. The value is zero for sound clips. (Number)
472
-
473
- - __width__: The width of the image or video in pixels. The value is zero for sound clips. (Number)
474
-
475
- ### Example
476
-
477
- // retrieve supported image modes
478
- var imageModes = navigator.device.capture.supportedImageModes;
479
-
480
- // Select mode that has the highest horizontal resolution
481
- var width = 0;
482
- var selectedmode;
483
- for each (var mode in imageModes) {
484
- if (mode.width > width) {
485
- width = mode.width;
486
- selectedmode = mode;
487
- }
488
- }
489
-
490
- Not supported by any platform. All configuration data arrays are empty.
491
-
492
- ## MediaFile.getFormatData
493
-
494
- > Retrieves format information about the media capture file.
495
-
496
- mediaFile.getFormatData(
497
- MediaFileDataSuccessCB successCallback,
498
- [MediaFileDataErrorCB errorCallback]
499
- );
500
-
501
- ### Description
502
-
503
- This function asynchronously attempts to retrieve the format
504
- information for the media file. If successful, it invokes the
505
- `MediaFileDataSuccessCB` callback with a `MediaFileData` object. If
506
- the attempt fails, this function invokes the `MediaFileDataErrorCB`
507
- callback.
508
-
509
- ### Supported Platforms
510
-
511
- - Android
512
- - iOS
513
- - Windows
514
-
515
-
516
- ### Android Quirks
517
-
518
- The API to access media file format information is limited, so not all
519
- `MediaFileData` properties are supported.
520
-
521
- ### iOS Quirks
522
-
523
- The API to access media file format information is limited, so not all
524
- `MediaFileData` properties are supported.
525
-
526
- ## MediaFile
527
-
528
- > Encapsulates properties of a media capture file.
529
-
530
- ### Properties
531
-
532
- - __name__: The name of the file, without path information. (DOMString)
533
-
534
- - __fullPath__: The full path of the file, including the name. (DOMString)
535
-
536
- - __type__: The file's mime type (DOMString)
537
-
538
- - __lastModifiedDate__: The date and time when the file was last modified. (Date)
539
-
540
- - __size__: The size of the file, in bytes. (Number)
541
-
542
- ### Methods
543
-
544
- - __MediaFile.getFormatData__: Retrieves the format information of the media file.
545
-
546
- ## MediaFileData
547
-
548
- > Encapsulates format information about a media file.
549
-
550
- ### Properties
551
-
552
- - __codecs__: The actual format of the audio and video content. (DOMString)
553
-
554
- - __bitrate__: The average bitrate of the content. The value is zero for images. (Number)
555
-
556
- - __height__: The height of the image or video in pixels. The value is zero for audio clips. (Number)
557
-
558
- - __width__: The width of the image or video in pixels. The value is zero for audio clips. (Number)
559
-
560
- - __duration__: The length of the video or sound clip in seconds. The value is zero for images. (Number)
561
-
562
- ### Android Quirks
563
-
564
- Supports the following `MediaFileData` properties:
565
-
566
- - __codecs__: Not supported, and returns `null`.
567
-
568
- - __bitrate__: Not supported, and returns zero.
569
-
570
- - __height__: Supported: image and video files only.
571
-
572
- - __width__: Supported: image and video files only.
573
-
574
- - __duration__: Supported: audio and video files only.
575
-
576
- ### iOS Quirks
577
-
578
- Supports the following `MediaFileData` properties:
579
-
580
- - __codecs__: Not supported, and returns `null`.
581
-
582
- - __bitrate__: Supported on iOS4 devices for audio only. Returns zero for images and videos.
583
-
584
- - __height__: Supported: image and video files only.
585
-
586
- - __width__: Supported: image and video files only.
587
-
588
- - __duration__: Supported: audio and video files only.
589
-
590
- ## Android Lifecycle Quirks
591
-
592
- When capturing audio, video, or images on the Android platform, there is a chance that the
593
- application will get destroyed after the Cordova Webview is pushed to the background by
594
- the native capture application. See the [Android Lifecycle Guide][android-lifecycle] for
595
- a full description of the issue. In this case, the success and failure callbacks passed
596
- to the capture method will not be fired and instead the results of the call will be
597
- delivered via a document event that fires after the Cordova [resume event][resume-event].
598
-
599
- In your app, you should subscribe to the two possible events like so:
600
-
601
- ```javascript
602
- function onDeviceReady() {
603
- // pendingcaptureresult is fired if the capture call is successful
604
- document.addEventListener('pendingcaptureresult', function(mediaFiles) {
605
- // Do something with result
606
- });
607
-
608
- // pendingcaptureerror is fired if the capture call is unsuccessful
609
- document.addEventListener('pendingcaptureerror', function(error) {
610
- // Handle error case
611
- });
612
- }
613
-
614
- // Only subscribe to events after deviceready fires
615
- document.addEventListener('deviceready', onDeviceReady);
616
- ```
617
-
618
- It is up you to track what part of your code these results are coming from. Be sure to
619
- save and restore your app's state as part of the [pause][pause-event] and
620
- [resume][resume-event] events as appropriate. Please note that these events will only
621
- fire on the Android platform and only when the Webview was destroyed during a capture
622
- operation.
623
-
624
- [android-lifecycle]: http://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#lifecycle-guide
625
- [pause-event]: http://cordova.apache.org/docs/en/latest/cordova/events/events.html#pause
626
- [resume-event]: http://cordova.apache.org/docs/en/latest/cordova/events/events.html#resume