Android::VideoView inside a ScrollView
Asked Answered
F

4

13

I have a VideoView that is inside a scrollView. When I scroll the scrollView, the VideoView does not scroll with it. It is like its position is fixed. How can I scroll the VideoView correctly with the scrolling of all other elements in the scrollView?

For answered 30/11, 2010 at 10:21 Comment(3)
I also facing the same prob. Anyone have the solution?Southward
This seems to be a common problem. I'm looking for a solution too. Here is another question just in case one of these gets answered: #5897421Savagery
VideoView inherits from SurfaceView, which changes the rules of scrolling behavior. A SurfaceView is basically a layover on top of whatever else is going on, and it seems like you're on your own as far as updates are concerned. See also this question, if it helps at all: #1097118Alfreda
B
12

The display is usually divided into two pipelines

  • Frame buffer pipeline - This is is where all your graphics is displayed. All the UI display elements go into this pipline
  • Video buffer pipeline - This is where your video data is diverted to.

Now when you declare a surface view you take up some screen space in the UI saying this is where the video will be displayed. So all other UI elements will not be able to occupy that space.

When scrolling happens your surface view will indeed be moved up or down depending on the scroll event but the problem is the video buffer pipeline does not care what happens in the frame buffer pipeline it goes on filling up the video data into the space in which it was initialised with.

So as of now you cannot scroll the video in android..

Brandiebrandise answered 26/8, 2011 at 6:22 Comment(1)
You can scroll surfaceview yes, but problems may appear on older devices.Bang
G
7

Romain Guy said in this Android issue:

This is a known limitation of VideoView. You should instead use TextureView in Android 4.0 and up.

Groundsheet answered 10/9, 2012 at 17:34 Comment(0)
C
1

just put android:descendantFocusability="blocksDescendants" ViewGroup that VideoView is in.

Cowitch answered 20/9, 2023 at 15:28 Comment(0)
O
0

You can put the videoview inside of a layout with an empty View over it.

    <RelativeLayout
        android:id="@+id/lay_live_video"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:visibility="visible" >

        <VideoView
            android:id="@+id/videoview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true" />

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/transparent" />
    </RelativeLayout>

This code can be inside of your scrollview.

Sorry for my English, I'm learning ;)

Olshausen answered 31/5, 2013 at 19:20 Comment(1)
Doesn't works at all, in any case! for a video inside a scrollviewAlisonalissa

© 2022 - 2024 — McMap. All rights reserved.