Skip to content

Commit 293d23b

Browse files
update: changing video resolution
1 parent 043cebe commit 293d23b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/src/main/java/com/gowtham/library/utils/TrimmerUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ public static Pair<Integer, Integer> getVideoRes(Activity context, Uri videoUri)
140140
String width = metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);
141141
int w = TrimmerUtils.clearNull(width).isEmpty() ? 0 : Integer.parseInt(width);
142142
int h = Integer.parseInt(height);
143+
int rotation = TrimmerUtils.getVideoRotation(context, videoUri);
144+
// Swap width and height if video is rotated 90 or 270 degrees
145+
if (rotation == 90 || rotation == 270) {
146+
return new Pair<>(h, w);
147+
}
143148
return new Pair<>(w, h);
144149
} catch (Exception e) {
145150
e.printStackTrace();

0 commit comments

Comments
 (0)