MediaPlayer-Extended
MediaPlayer-Extended copied to clipboard
missing setVideoScalingMode
Hi, thanks for the great library!
I'm trying to implement your mediaplayer library and it's good but i have one problem.
( put video on textureview using mediaplayer )
I'm currently building app using portrait only mode, and it's ok when I load landscape video (scaled and no distortion) - same as default mediaplayer,
but when I load portrait video, aspect ratio not maintained
android default mediaplayer has setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING) method
but I can't find corresponding method in MediaPlayer-Extended library.
Is there any way to resolve this? Any help would be really appreciated!
Best, JP
Yes, MPX does not implement the setVideoScalingMode
API method.
To maintain the aspect ratio, you can extend the TextureView
and override onMeasure
like I am doing in the VideoView
here, which always resizes the View to fit it's aspect ratio to the video frame. You can then position this view within a layout.
If you want cropping, then there is currently no other way than to also override onMeasure
to maintain the aspect ratio and programmatically set the size of an enclosing layout to crop the video as desired.
Btw. it is recommended to use SurfaceView
over TextureView
because the latter draws much more power.
this is stupid your view should handle it. what i now got from your lib is basically the same as the one from android. stretched video and nothing else. And no I do not plan to dig deeper into this thing just to find out its not possible.
Thank you for this very productive and enlightening comment, and good luck with your future endeavors.