Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing setVideoScalingMode #62

Open
stmkjp opened this issue Apr 13, 2017 · 3 comments
Open

missing setVideoScalingMode #62

stmkjp opened this issue Apr 13, 2017 · 3 comments

Comments

@stmkjp
Copy link

stmkjp commented Apr 13, 2017

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,
screenshot_1492074880

but when I load portrait video, aspect ratio not maintained
screenshot_1492074888

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

@protyposis
Copy link
Owner

protyposis commented Apr 22, 2017

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.

@devingDev
Copy link

devingDev commented May 4, 2018

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.

@protyposis
Copy link
Owner

Thank you for this very productive and enlightening comment, and good luck with your future endeavors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants