An ATproto social media client -- with an independent Appview.

Patch in upstream fix for video rotation on Android (#8635)

* patch in upstream fix

* build expo-image-picker from source so that patch takes

authored by samuel.fm and committed by

GitHub 74f7a44d 760b184d

+45 -1
+2 -1
package.json
··· 12 12 "buildFromSource": [ 13 13 "expo-notifications", 14 14 "expo-haptics", 15 - "expo-media-library" 15 + "expo-media-library", 16 + "expo-image-picker" 16 17 ] 17 18 } 18 19 }
+38
patches/expo-image-picker+16.1.4.patch
··· 1 + diff --git a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/MediaHandler.kt b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/MediaHandler.kt 2 + index c863fb8..cde8859 100644 3 + --- a/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/MediaHandler.kt 4 + +++ b/node_modules/expo-image-picker/android/src/main/java/expo/modules/imagepicker/MediaHandler.kt 5 + @@ -101,16 +101,30 @@ internal class MediaHandler( 6 + val fileData = getAdditionalFileData(sourceUri) 7 + val mimeType = getType(context.contentResolver, sourceUri) 8 + 9 + + // Extract basic metadata 10 + + var width = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH) 11 + + var height = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT) 12 + + val rotation = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION) 13 + + 14 + + // Android returns the encoded width/height which do not take the display rotation into 15 + + // account. For videos recorded in portrait mode the encoded dimensions are often landscape 16 + + // (e.g. 1920x1080) paired with a 90°/270° rotation flag. iOS adjusts these values before 17 + + // reporting them, so to keep the behaviour consistent across platforms we swap the width 18 + + // and height when the rotation indicates the video should be displayed in portrait. 19 + + if (rotation % 180 != 0) { 20 + + width = height.also { height = width } 21 + + } 22 + + 23 + return ImagePickerAsset( 24 + type = MediaType.VIDEO, 25 + uri = outputUri.toString(), 26 + - width = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH), 27 + - height = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT), 28 + + width = width, 29 + + height = height, 30 + fileName = fileData?.fileName, 31 + fileSize = fileData?.fileSize, 32 + mimeType = mimeType, 33 + duration = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_DURATION), 34 + - rotation = metadataRetriever.extractInt(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION), 35 + + rotation = rotation, 36 + assetId = sourceUri.getMediaStoreAssetId() 37 + ) 38 + } catch (cause: FailedToExtractVideoMetadataException) {
+5
patches/expo-image-picker+16.1.4.patch.md
··· 1 + # Expo Image Picker patch 2 + 3 + Cherry-picked https://github.com/expo/expo/pull/37849 4 + 5 + Remove when we update to a version that includes this commit.