Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26599] iOS: Add "allowTranscoding" option to Ti.Media.openPhotoGallery()

GitHub Issuen/a
TypeNew Feature
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2019-05-09T17:31:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 8.1.0
ComponentsiOS
Labelscompression, iOS, performance, video
ReporterRichard Lustemberg
AssigneeVijay Singh
Created2018-11-26T14:31:32.000+0000
Updated2019-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];

Comments

  1. Vijay Singh 2018-11-27

    [~rlustemberg] Thanks for reporting. PR is appreciated :)
  2. Richard Lustemberg 2018-11-27

    Just made the PR. Cheers!
  3. Vijay Singh 2019-02-08

    PR - https://github.com/appcelerator/titanium_mobile/pull/10492
  4. Samir Mohammed 2019-02-27

    FR Passed, waiting on Jenkins build.
  5. Keerthi Mahalingam 2019-05-09

    Verified the Fix on sdk 8.1.0.v20190509024838.Works as expected.
       Operating System
         Name                        = Mac OS X
         Version                     = 10.13.6
         Architecture                = 64bit
       Node.js
         Node.js Version             = 8.9.1
         npm Version                 = 5.5.1
       Titanium CLI
         CLI Version                 = 5.1.1
       Titanium SDK
         SDK Version                 = 8.1.0.v20190509024838
       Device =iPhone X iOS 11
       Simulator =iPhone 6s iOS 12
       

JSON Source