Monday, June 7, 2010

[android-developers] Re: MediaController in MediaPlayer

Thanks Sean. I will try this out and post my findings.

Thanks again

Abhi

On Jun 7, 10:16 am, Sean Hodges <seanhodge...@googlemail.com> wrote:
> Abhi,
>
> I'm not to sure about video playback outside of the VideoView, I
> expect you have some substitute view to replace VideoView, as
> MediaPlayer is just an interface to the back-end A/V component and
> does no UI handling.
>
> Looking at theMediaController, it accepts any view that implements
> MediaPlayerControl:http://developer.android.com/intl/fr/reference/android/widget/MediaCo...
>
> The only build-in view that does this in the Android SDK is the
> VideoView - but you should be able to make your substitute view
> implement MediaPlayerControl and use it in exactly the same way. You
> will just need to handle the callback methods that are defined in
> MediaPlayerControl.
>
> e.g.
>
> public class MyVideoCanvas
>     extends SurfaceView
>     implements MediaPlayerControl {
>
>     privateMediaControllerctlr;
>     private MediaPlayer mediaPlayer;
>
>     public void onCreate() {
>         mediaPlayer = new MediaPlayer();
>
>         ctlr = newMediaController(this);
>         ctlr.setMediaPlayer(this);
>         ctlr.setAnchorView(this);
>         ctlr.setEnabled(true);
>         ctlr.show();
>     }
>
>     public void pause() {
>         // This is an example of a callback method from MediaPlayerControl...
>         mediaPlayer.pause();
>     }
>
>     // ...
>
> }
>
> I haven't tested this, but I don't see why it shouldn't work.
>
> Sean
>
> On Mon, Jun 7, 2010 at 2:41 PM, Abhi <abhishek.r.sha...@gmail.com> wrote:
> > Hey Sean
>
> > Thanks for the link. But that's using VideoView and I am using
> > MediaPlayer instead. I already have a player using VideoView but am
> > having issues with it, so I decided to switch over to MediaPlayer. I
> > have a player running so far but no auto Media Controller (like the
> > one in the link with VideoView).
>
> > Abhi
>
> > On Jun 7, 9:34 am, Sean Hodges <seanhodge...@googlemail.com> wrote:
> >> Hey Abhi,
>
> >> Take a look at the VideoDemo class in Mark Murphy's tutorial projects:
>
> >>http://github.com/commonsguy/cw-advandroid/blob/master/Media/Video/sr...
>
> >> On Mon, Jun 7, 2010 at 2:28 PM, Abhi <abhishek.r.sha...@gmail.com> wrote:
> >> > guys
>
> >> > any lead on this question would help me a bunch...
>
> >> > thanks,
>
> >> > abhi
>
> >> > On Jun 4, 1:05 pm, Abhi <abhishek.r.sha...@gmail.com> wrote:
> >> >> Hello,
>
> >> >> I am using MediaPlayer to build a Video player for playing local video
> >> >> files. However, I don't know how to enableMediaControllerfor my
> >> >> player. I want the media control buttons that pop up when you touch
> >> >> the video surface.
>
> >> >> Can anyone help me out please?
>
> >> >> Thanks,
>
> >> >> Abhi
>
> >> > --
> >> > 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
>
> > --
> > 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
>
>

--
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