[TIMOB-26599] iOS: Add "allowTranscoding" option to Ti.Media.openPhotoGallery()
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-05-09T17:31:02.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 8.1.0 |
Components | iOS |
Labels | compression, iOS, performance, video |
Reporter | Richard Lustemberg |
Assignee | Vijay Singh |
Created | 2018-11-26T14:31:32.000+0000 |
Updated | 2019-05-09T17:31:02.000+0000 |
Description
*Summary:*
When selecting a video from the gallery, iOS will transcode/convert the selected video by default and return the newly formatted video instead. This can cause a very long delay if the video is large.
*Solution:*
Add an iOS-only "allowTranscoding" option for our
Ti.Media.openPhotoGallery()
method, when set false
, will return the selected video as-is without transcoding it. This will solve the long delay issue.
Ti.Media.openPhotoGallery({
allowTranscoding: false,
mediaTypes: [Ti.Media.MEDIA_TYPE_VIDEO],
success: function(e) {
// Got it.
},
});
*Note:*
There is no equivalent to this on Android, which always returns a reference to the video as-is. So, this is an iOS only feature.
*Native Implementation Details:*
Add this code at line 1746. I can provide a PR
if ([TiUtils isIOS11OrGreater]) {
BOOL disableVideoCompression = [TiUtils boolValue:@"disableVideoCompression" properties:args def:NO];
if (disableVideoCompression) {
picker.videoExportPreset = AVAssetExportPresetPassthrough;
}
}
[self displayModalPicker:picker settings:args];
[~rlustemberg] Thanks for reporting. PR is appreciated :)
Just made the PR. Cheers!
PR - https://github.com/appcelerator/titanium_mobile/pull/10492
FR Passed, waiting on Jenkins build.
Verified the Fix on sdk 8.1.0.v20190509024838.Works as expected.