Dear Kirwan,

I'm developing a video player and, like you, I've had the need to
implement a fullscreen mode. I've also faced a similar problem and, as
a workaround, I've tried to reinitialize the player when the surface
turns black (no video, but sound countinues playing).

On every surfaceDestroyed I call mediaPlayer.release() and then, when
the surface is recreated, I reinstantiate the media player, prepare it
and call the start method again. When not playing online streamming,
you can also save the video position before the release() call and
seek to such position on the reinstantiation.

The only problem in this approach is that there's a small delay
between the the mediaPlayer.release() and the reinstantiation. That's
worse when playing streaming, because the client needs to reconnect
with the server.

Best regards.

Bolha

On 4 fev, 07:28, Kirwan Lyster <kirwan.lys...@wecomm.com> wrote:
> In order to offer embedded or fullscreenvideo, I attach the
> MediaPlayer to a SurfaceView which is inside a LinearLayout and then
> change the parent's padding values to reposition and resize thevideo.
>
> This works on all devices except theNexusOne.
>
> On theNexusOne, as soon as thesurfacesize changes it goeswhiteso
> the audio continues but thevideois lost. Each time thesurfaceis
> resized, it's possible to see a single frame before it goeswhite
> again.
>
> Does anyone know if this is a bug or is there an alternative way to go
> to full screen?
>
> I do already call
> SurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS),
> without which thesurfaceremains black throughout.
>
> As a workaround, I'm trying to launch a separate activity with a
> separate layout and pass the player through, but at the moment that's
> not working either. Should that be possible or can a MediaPlayer not
> be re-assigned to a new SurfaceView once it's started?
>
> Cheers,
> Kirwan

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to