Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-26599 Optionally disable video compression when importing video #10492

Merged
merged 21 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8608767
Making video compression optional
rlustemberg Nov 27, 2018
a7ff877
Merge branch 'master' into TIMOB-26599
rlustemberg Dec 25, 2018
f7cc5d0
Merge branch 'master' into TIMOB-26599
vijaysingh-axway Jan 4, 2019
0ffa31e
Merge branch 'master' into TIMOB-26599
sgtcoolguy Jan 14, 2019
bcafe0b
Fixed formatting issues
rlustemberg Jan 15, 2019
f092b34
Changed property name to 'allowTranscoding' and updated docs
rlustemberg Jan 15, 2019
51feed3
Merge branch 'master' into TIMOB-26599
rlustemberg Jan 15, 2019
8e1d77d
Merge branch 'master' into TIMOB-26599
vijaysingh-axway Jan 25, 2019
1cbcf24
Updated docs and replaced deprecated methods
rlustemberg Jan 31, 2019
7d9d530
Merge branch 'master' into TIMOB-26599
rlustemberg Jan 31, 2019
a26ac70
Merge branch 'master' into TIMOB-26599
vijaysingh-axway Feb 8, 2019
98eb3c8
Merge branch 'master' into TIMOB-26599
ssjsamir Feb 27, 2019
51b8157
Merge branch 'master' into TIMOB-26599
ssjsamir Feb 28, 2019
0f4360f
Merge branch 'master' into TIMOB-26599
ssjsamir Mar 4, 2019
e815543
Merge branch 'master' into TIMOB-26599
ssjsamir Mar 6, 2019
3bb2fcd
Merge branch 'master' into TIMOB-26599
ssjsamir Apr 5, 2019
00f1107
Merge branch 'master' into TIMOB-26599
ssjsamir Apr 17, 2019
e183344
Merge branch 'master' into TIMOB-26599
vijaysingh-axway Apr 18, 2019
97e657a
Merge branch 'master' into TIMOB-26599
ssjsamir Apr 30, 2019
1551e11
Merge branch 'master' into TIMOB-26599
lokeshchdhry May 2, 2019
97e365e
Merge branch 'master' into TIMOB-26599
ssjsamir May 9, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions apidoc/Titanium/Media/Media.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,13 @@ properties:
type: Boolean
platforms: [android]
since: "6.0.0"
- name: allowTranscoding
summary: Specifies if the video should be transcoded (using highest quality preset) . If set to false no video transcoding will be performed.
type: Boolean
default: true
platforms: [iphone, ipad]
since: "8.1.0"
osver: {ios: {min: "11.0"}}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add minimum iOS version in document as well. Because this property is only available in iOS 11.0+.
e.g.
osver: {ios: {min: "11.0"}}

Copy link
Contributor Author

@rlustemberg rlustemberg Jan 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

---
name: CameraMediaItemType
Expand Down
6 changes: 6 additions & 0 deletions iphone/Classes/MediaModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,12 @@ - (void)showPicker:(NSDictionary *)args isCamera:(BOOL)isCamera
[self displayCamera:picker];
}
} else {
if ([TiUtils isIOSVersionOrGreater:@"11.0"]) {
BOOL allowTranscoding = [TiUtils boolValue:@"allowTranscoding" properties:args def:YES];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it better if we expose it as a string/constant property and expose other constants as well which is available ? e.g Constants -
AVAssetExportPresetAppleM4A, AVAssetExportPresetHEVC3840x2160, AVAssetExportPresetHEVC1920x1080 etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed. I've made a quick and dirty solution based on my use case, but I think it's better to provide full control. It's up to you guys, if you want that and the choice using strings or exporting the enum constants

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those other constants tell iOS what to transcode the video formats to.
We can do this 1 of 2 ways.

(1) Keep the "allowTranscoding" property and add a "transcodeFormat" type later which tells the system which format to transcode to if "allowTranscoding" is true.

(2) Get rid of the "allowTranscoding" property and provide a "transcodeFormat" type instead which when set null (or to a NONE type?), will handle it from there.

I think the only things that worries me here is that format types available will vary between iOS versions... or perhaps worse, by device?

Hypothetically, if we were to support this on any other platform (Android and Windows), then you would need to query the system for what formats are available. You can't hard-code it to a format and expect it to magically work. For example, Android device manufacturers may not support some of Google's documented formats in order to lower the cost of the device since there is licensing/royalties involved (I've seen this with low-cost tablets in the past). And Windows N-edition and K-edition don't include any licensed formats by default.

Because of the above, I prefer to keep it simple for now.
Besides, wouldn't most devs want the original video format anyways?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with solution 1. Let's have it simple for now as it is. We can add "transcodeFormat" later.
@rlustemberg If you can resolve other two minor issues-

  1. add minimum iOS version in document
  2. Use [TiUtils isIOSVersionOrGreater:@"11.0"] instead of [TiUtils isIOS11OrGreater].
    we will be good to go. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

if (!allowTranscoding) {
picker.videoExportPreset = AVAssetExportPresetPassthrough;
}
}
[self displayModalPicker:picker settings:args];
}
}
Expand Down