Thursday, March 3, 2011

[android-developers] Re: VideoView Problems

You lost me at "unref". What do you mean by that?

Are you sure you're saving memory this way, and is it necessary? I
don't think the VideoView itself is terribly heavy, but the
MediaPlayer behind it might be more of a concern, when it's active.

Doug

On Mar 2, 8:28 pm, Anm <andrew.n.marsh...@gmail.com> wrote:
> I have a video view embedded in a somewhat complex UI.  As part of the
> look, the container of the videoview tends to animate in and out from
> the sides (but the video isn't visible during the animation).  To save
> some memory when the video container isn't visible, I'm trying to
> unref that subtree of the view hierarchy.
>
> Attempt #1:
> Unref the entire subtree and inflate later when I need it.
> VideoView works fine the first time, but after I unref and re-inflate
> it fails to ever call the onPrepare() listener to trigger well timed
> playback.
>
> Attempt #2:
> Preserve the VideoView between unrefs, manually adding adding it after
> each inflate and remove it from its parent before unrefing the subtree
> of view surrounding it.
> Works the first time, but will only render a black screen after I add
> the view back on the second pass.
>
> Suggestions on how to fix either problem, or alternatives?
>
> (Let me preempt comments on using Activities.  The basic Activity
> structure didn't fit the design, and I've heard horror stories about
> ActivityGroups, so we didn't do that at first.  By and large it what
> we have works. Even if ActivityGroups are the right solution, I need a
> quicker fix in the short term.)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment