Discussion:
VideoView inside a ListView
Sandy
2010-08-12 22:31:12 UTC
Permalink
I am trying to play a video via VideoView in my android application.
The VideoView is one of items inside a ListView. Video playing
functionality works good but when the list scroll happens, there are
rendering artifacts at the boundaries of the list. Also, the video
view surface changes location only after scroll/flick is complete.

Anyone tried this before in android? Does android allow this ? If so,
can you please suggest of how to fix the rendering artifacts?

Thanks,
Sandy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Dianne Hackborn
2010-08-12 23:17:14 UTC
Permalink
Er. Just don't do that. A list view contains views that are created and
destroyed dynamically as you scroll through the list so that it doesn't need
to have an object instantiated for every single row.

This is so very much not how you want a video view to work.
Post by Sandy
I am trying to play a video via VideoView in my android application.
The VideoView is one of items inside a ListView. Video playing
functionality works good but when the list scroll happens, there are
rendering artifacts at the boundaries of the list. Also, the video
view surface changes location only after scroll/flick is complete.
Anyone tried this before in android? Does android allow this ? If so,
can you please suggest of how to fix the rendering artifacts?
Thanks,
Sandy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Dianne Hackborn
Android framework engineer
***@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails. All such
questions should be posted on public forums, where I and others can see and
answer them.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Sandy
2010-08-13 17:49:11 UTC
Permalink
Thanks Dianne for quick response. My requirement is to show a video
as a list item (there is only 1 video item and rest of the items in
the list are simple views) and the video item should scroll with the
list. I was able to implement this using videoview inside listview and
noticed that video plays fine when within a list. However, there were
rendering artifacts during scrolling. I was wondering if there are any
other alternate ways to make the video scrolling possible ??

One option that I was thinking is to place the video view on top of
the list view and change its position as the list scrolls. But, I
don't know if it would be possible to move the video view at the same
speed as list during scroll/fling.

The built in android contacts application has implemented the section
headers or separators (A, B, C etc) and pinned header to get a similar
effect. Is the same thing possible with VideoView?

Regarding your comment on recycling view, my understanding was that
when you return the IGNORE_ITEM_VIEW_TYPE in the adapter method
"public int getItemViewType(int position)", ListView does not recycle
that view. I was thinking of implementing along these lines. Do you
recommend this way?

public int getItemViewType(int position) {
if (isVideoViewAt(position) != 0) {
// We don't want the video view to be recycled.
return IGNORE_ITEM_VIEW_TYPE;
}

return super.getItemViewType(position);
}

Thanks,
Sandy
Er.  Just don't do that.  A list view contains views that are created and
destroyed dynamically as you scroll through the list so that it doesn't need
to have an object instantiated for every single row.
This is so very much not how you want a video view to work.
Post by Sandy
I am trying to play a video via VideoView in my android application.
The VideoView is one of items inside a ListView. Video playing
functionality works good but when the list scroll happens, there are
rendering artifacts at the boundaries of the list. Also, the video
view surface changes location only after scroll/flick is complete.
Anyone tried this before in android? Does android allow this ? If so,
can you please suggest of how to fix the rendering artifacts?
Thanks,
Sandy
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To unsubscribe from this group, send email to
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Dianne Hackborn
Android framework engineer
Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Mark Murphy
2010-08-13 19:20:39 UTC
Permalink
Thanks Dianne for quick response.  My requirement is to show a video
as a list item  (there is only 1 video item and rest of the items in
the list are simple views) and the video item should scroll with the
list. I was able to implement this using videoview inside listview and
noticed that video plays fine when within a list. However, there were
rendering artifacts during scrolling. I was wondering if there are any
other alternate ways to make the video scrolling possible ??
I would be somewhat surprised if any sort of widget scrolling
(ScrollView, ListView) and a SurfaceView (e.g., the one used by
VideoView) will get along.

That being said, there may be a greater chance of a ScrollView
working. Put the VideoView and other stuff in some type of layout
(e.g., LinearLayout) and put the whole thing in the ScrollView.

Frankly, I fail to see how having a VideoView in a scrolling container
will give the user anything the user would want.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Sandy
2010-08-13 20:30:16 UTC
Permalink
Thanks Mark. I tried other containers like HorizontalScrollView which
seem to work fine when used in a ListView. I could not find anywhere
in the API documentation that the video view cannot be used inside
other scrolling containers hence want to confirm if this is limitation
in android or a defect that need to be opened.

The use case is mostly for having a gallery or list of videos (or
video calls) with one active video playing at a time and user has a
chance to switch between full screen and list view and navigate to the
rest of the videos.

Thanks,
Sandy
Post by Mark Murphy
Thanks Dianne for quick response.  My requirement is to show a video
as a list item  (there is only 1 video item and rest of the items in
the list are simple views) and the video item should scroll with the
list. I was able to implement this using videoview inside listview and
noticed that video plays fine when within a list. However, there were
rendering artifacts during scrolling. I was wondering if there are any
other alternate ways to make the video scrolling possible ??
I would be somewhat surprised if any sort of widget scrolling
(ScrollView, ListView) and a SurfaceView (e.g., the one used by
VideoView) will get along.
That being said, there may be a greater chance of a ScrollView
working. Put the VideoView and other stuff in some type of layout
(e.g., LinearLayout) and put the whole thing in the ScrollView.
Frankly, I fail to see how having a VideoView in a scrolling container
will give the user anything the user would want.
--
Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
_The Busy Coder's Guide to Android Development_ Version 3.1 Available!
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-***@googlegroups.com
To unsubscribe from this group, send email to
android-developers+***@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
Ankit Sevak
2016-05-20 12:56:42 UTC
Permalink
Hello Every One

In this time i am Suffering one problem in Android code.
I am working on a project which should include a list of videos from
allover the internet
(video sources are different - youtube, vimeo, facebook, videos hosted on
servers, ...).
I am trying to make a ListView, where item has a video player and some
description
When user clicks on play button the video starts playing. I made one
example,
where I use VideoView as player, but soon realised that the performance is
not very good - *scrolling is very laggy *
Post by Sandy
I am trying to play a video via VideoView in my android application.
The VideoView is one of items inside a ListView. Video playing
functionality works good but when the list scroll happens, there are
rendering artifacts at the boundaries of the list. Also, the video
view surface changes location only after scroll/flick is complete.
Anyone tried this before in android? Does android allow this ? If so,
can you please suggest of how to fix the rendering artifacts?
Thanks,
Sandy
--
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed. Any
views or opinions expressed are solely those of the sender and do not
necessarily represent those of Pardy Panda Studios. If you have received
this email in error please notify the sender.
--
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/f1eb7d6e-1669-451b-b0aa-e4d7ed835af6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
rayworks
2016-05-25 02:42:16 UTC
Permalink
Hi, there

Please note that VideoView is a kind of SurfaceView. As the doc mentions
SurfaceView:

*The surface is Z ordered so that it is behind the window holding its
SurfaceView; the SurfaceView punches a hole in its window to allow its
surface to be displayed. The view hierarchy will take care of correctly
compositing with the Surface any siblings of the SurfaceView that would
normally appear on top of it. This can be used to place overlays such as
buttons on top of the Surface, though note however that it can have an
impact on performance since a full alpha-blended composite will be
performed each time the Surface changes. *
One of the solutions for having Video content in a scrolling view container
could be using TextureView
<https://developer.android.com/reference/android/view/TextureView.html> to
wrapper MediaPlayer the same as VideoView does.
*Unlike SurfaceView
<https://developer.android.com/reference/android/view/SurfaceView.html>,
TextureView does not create a separate window but behaves as a regular
View.*
Hope it could help.


圚 2016幎5月20日星期五 UTC+8䞋午8:56:42Ankit Sevak写道
Hello Every One
In this time i am Suffering one problem in Android code.
I am working on a project which should include a list of videos from
allover the internet
(video sources are different - youtube, vimeo, facebook, videos hosted on
servers, ...).
I am trying to make a ListView, where item has a video player and some
description
When user clicks on play button the video starts playing. I made one
example,
where I use VideoView as player, but soon realised that the performance is
not very good - *scrolling is very laggy *
Post by Sandy
I am trying to play a video via VideoView in my android application.
The VideoView is one of items inside a ListView. Video playing
functionality works good but when the list scroll happens, there are
rendering artifacts at the boundaries of the list. Also, the video
view surface changes location only after scroll/flick is complete.
Anyone tried this before in android? Does android allow this ? If so,
can you please suggest of how to fix the rendering artifacts?
Thanks,
Sandy
--
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+***@googlegroups.com.
To post to this group, send email to android-***@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/ce141a53-07e9-48a7-ad6c-27b87109d606%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...