mirror of
https://github.com/androidx/media.git
synced 2025-05-13 02:29:52 +08:00
Add protected method to override the AspectRatioFrameLayout aspect ratio
This commit is contained in:
parent
6a6b211233
commit
c819856530
@ -1031,6 +1031,19 @@ public class PlayerView extends FrameLayout {
|
|||||||
return subtitleView;
|
return subtitleView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to notify the {@link AspectRatioFrameLayout} of the new video aspect ratio.
|
||||||
|
* The default implementation will simply forward the aspect ratio to
|
||||||
|
* {@link AspectRatioFrameLayout#setAspectRatio(float)}. Subclasses can override this
|
||||||
|
* method, for example, to apply aspect ratio constraints.
|
||||||
|
*
|
||||||
|
* @param aspectRatioFrameLayout the video surface view container
|
||||||
|
* @param widthHeightRatio the computed aspect ratio
|
||||||
|
*/
|
||||||
|
protected void onDispatchVideoAspectRatio(@NonNull AspectRatioFrameLayout aspectRatioFrameLayout, float widthHeightRatio) {
|
||||||
|
aspectRatioFrameLayout.setAspectRatio(widthHeightRatio);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent ev) {
|
public boolean onTouchEvent(MotionEvent ev) {
|
||||||
if (ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
|
if (ev.getActionMasked() != MotionEvent.ACTION_DOWN) {
|
||||||
@ -1355,7 +1368,7 @@ public class PlayerView extends FrameLayout {
|
|||||||
videoAspectRatio = 0;
|
videoAspectRatio = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
contentFrame.setAspectRatio(videoAspectRatio);
|
onDispatchVideoAspectRatio(contentFrame, videoAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user