mklimek / frame-video-view

Less issues with VideoView
Other
63 stars 19 forks source link

Using wrap_content on FrameVideoView #14

Closed mauricegavin closed 7 years ago

mauricegavin commented 8 years ago

I've used FrameVideoView in my application but I'm having difficulty getting it to scale on different screen sizes. With the stock VideoView class I set layout_height = wrap_content, however, if I do this with FrameVideoView it fills the entire screen.

Do you have any idea advice as to how I could get FrameVideoView to resize to the content so as to preserve the aspect ratio on different screen sizes?

Below is my implementation of the respective views. They sit inside a RelativeLayout, hence the layout_gravity.

        <FrameVideoView
            android:id="@+id/photo_instruction_video_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|top"
        </FrameVideoView>
        <VideoView
            android:id="@+id/photo_instruction_video_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|top"/>

Love the library, slick solution to the flickering problem.

mklimek commented 8 years ago

Library does nothing with layout dimensions. So it's not a problem with library itself.

One thing I noticed you compared the behaviour between frame-video-view (which highly likely uses TextureView) and VideoView. I'm guessing you will get the same output for your test if you do:

 <TextureView
            android:id="@+id/photo_instruction_video_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|top"/>

or

by setting: frameVideoView.setImpl(ImplType.VIDEO_VIEW)

to force frame-video-view to use VideoView .