diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java b/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java index e1c38c4f..59298605 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/api/VideoViewApi.java @@ -143,7 +143,7 @@ interface OnSurfaceSizeChanged { void setListenerMux(ListenerMux listenerMux); - void onVideoSizeChanged(int width, int height); + void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio); void setRepeatMode(@Player.RepeatMode int repeatMode); } \ No newline at end of file diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java index 308bb11a..454fa0da 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoSurfaceVideoView.java @@ -172,8 +172,8 @@ public void setListenerMux(ListenerMux listenerMux) { } @Override - public void onVideoSizeChanged(int width, int height) { - if (updateVideoSize(width, height)) { + public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) { + if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) { requestLayout(); } } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java index 79d65e08..e2eb75c1 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/exo/ExoTextureVideoView.java @@ -173,8 +173,8 @@ public void setListenerMux(ListenerMux listenerMux) { } @Override - public void onVideoSizeChanged(int width, int height) { - if (updateVideoSize(width, height)) { + public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) { + if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) { requestLayout(); } } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java index 89ec2ea8..5516c89e 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeSurfaceVideoView.java @@ -205,8 +205,8 @@ public void setListenerMux(ListenerMux listenerMux) { } @Override - public void onVideoSizeChanged(int width, int height) { - if (updateVideoSize(width, height)) { + public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) { + if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) { requestLayout(); } } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java index 0a1c2e1c..2f32bcb1 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/core/video/mp/NativeTextureVideoView.java @@ -210,8 +210,8 @@ public void setListenerMux(ListenerMux listenerMux) { } @Override - public void onVideoSizeChanged(int width, int height) { - if (updateVideoSize(width, height)) { + public void onVideoSizeChanged(int width, int height, float pixelWidthHeightRatio) { + if (updateVideoSize((int) (width * pixelWidthHeightRatio), height)) { requestLayout(); } } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/listener/OnVideoSizeChangedListener.java b/library/src/main/java/com/devbrackets/android/exomedia/listener/OnVideoSizeChangedListener.java index 65f48ddb..fc642dbc 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/listener/OnVideoSizeChangedListener.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/listener/OnVideoSizeChangedListener.java @@ -15,5 +15,5 @@ public interface OnVideoSizeChangedListener { * @param intrinsicWidth The intrinsic (unscaled) width of the video currently in playback * @param intrinsicHeight The intrinsic (unscaled) height of the video currently in playback */ - void onVideoSizeChanged(int intrinsicWidth, int intrinsicHeight); + void onVideoSizeChanged(int intrinsicWidth, int intrinsicHeight, float pixelWidthHeightRatio); } diff --git a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java index d20878a1..be124fa5 100644 --- a/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java +++ b/library/src/main/java/com/devbrackets/android/exomedia/ui/widget/VideoView.java @@ -965,10 +965,10 @@ public void onSeekComplete() { public void onVideoSizeChanged(int width, int height, int unAppliedRotationDegrees, float pixelWidthHeightRatio) { //NOTE: Android 5.0+ will always have an unAppliedRotationDegrees of 0 (ExoPlayer already handles it) videoViewImpl.setVideoRotation(unAppliedRotationDegrees, false); - videoViewImpl.onVideoSizeChanged(width, height); + videoViewImpl.onVideoSizeChanged(width, height, pixelWidthHeightRatio); if (videoSizeChangedListener != null) { - videoSizeChangedListener.onVideoSizeChanged(width, height); + videoSizeChangedListener.onVideoSizeChanged(width, height, pixelWidthHeightRatio); } }