motion/core/device/ios/camera.rb in bubble-wrap-1.7.1 vs motion/core/device/ios/camera.rb in bubble-wrap-1.8.0
- old
+ new
@@ -13,10 +13,17 @@
end
Constants.register UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera,
UIImagePickerControllerSourceTypeSavedPhotosAlbum
+ Constants.register UIImagePickerControllerQualityTypeHigh,
+ UIImagePickerControllerQualityTypeMedium,
+ UIImagePickerControllerQualityTypeLow,
+ UIImagePickerControllerQualityType640x480,
+ UIImagePickerControllerQualityTypeIFrame1280x720,
+ UIImagePickerControllerQualityTypeIFrame960x540
+
MEDIA_TYPE_HASH = {movie: KUTTypeMovie, image: KUTTypeImage}
CAMERA_LOCATIONS = [:front, :rear, :none]
# The camera location; if :none, then we can't use source_type: :camera
@@ -96,11 +103,13 @@
@options = {
allows_editing: false,
animated: true,
on_dismiss: false,
media_types: [:image],
- dismiss_completed: nil
+ dismiss_completed: nil,
+ video_quality: :medium,
+ video_maximum_duration: 600
}.merge(options)
# If we're using Camera.any, by default use photo library
if !@options.has_key?(:source_type) and self.location == :none
@options[:source_type] = :photo_library
@@ -128,9 +137,11 @@
self.picker.delegate = self
self.picker.sourceType = source_type
self.picker.mediaTypes = media_types
self.picker.allowsEditing = @options[:allows_editing]
+ self.picker.videoQuality = Constants.get("UIImagePickerControllerQualityType", @options[:video_quality])
+ self.picker.videoMaximumDuration = @options[:video_maximum_duration]
if source_type_readable == :camera && ![:front, :rear].member?(self.location)
raise Error::INVALID_CAMERA_LOCATION, "Can't use camera location #{self.location} with source type :camera"
end