Android remove Fastforward and rewind buttons from mediaplayer
Asked Answered
F

2

6

I would Like to remove the fastforward and rewind buttons from mediacontroller in Android. Can anyone help me with this? I want to do it inside my main activity.

Forevermore answered 1/7, 2012 at 14:46 Comment(0)
C
28

When creating a MediaController, make sure to set the boolean to false in the constructor:

MediaController mediaController = new MediaController(this, false);

From the documentation:

The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

Conclude answered 11/11, 2013 at 6:18 Comment(5)
I guess, this should be accepted answer for the question above as this removes the rewind and forward button from the videoViewBazan
I also want to remove the play icon and only want to show the seek-bar, how can i achieve this?Threadbare
@Threadbare how to remove play pause also?Striper
@RuchaBhattJoshi that's outside of this question's concerns. but a quick google search leads me to this answer - https://mcmap.net/q/1630442/-hide-play-pause-button-of-media-controller-in-android. Hopefully it still worksConclude
@Conclude yeah i guess so, anyways thank you so much :)Striper
H
6

If you're trying to remove the buttons from a MediaPlayer than is not part of your app, this is impossible. You cannot mess with other apps' code. Some of them may allow you to pass this as an intent extra while launching them, but the majority probably won't.

If it is part of your app, just comment out the code related to the buttons.

EDIT: From the MediaController documentation:

  • The "rewind" and "fastforward" buttons are shown unless requested otherwise by using the MediaController(Context, boolean) constructor with the boolean set to false

So all you need to do is pass false in the constructor.

Horsley answered 1/7, 2012 at 15:0 Comment(4)
(devdaily.com/java/jwarehouse/android/core/java/android/widget/… are saying that you can by using the MediaController(Context, boolean) constructor with the boolean set to false.Forevermore
Well, you have access to the source. Not sure why you'd want to remove a feature, but you can comment the code for those buttons out.Horsley
I havent made any buttons. I am using the standard mediacontroller that has the buttons within itself. ` mVideoView = (VideoView) findViewById(R.id.surface_view); MediaController mc = new MediaController(this); mVideoView.setMediaController(mc); `Forevermore
What is the code for that so i should use it in my main activity.Forevermore

© 2022 - 2024 — McMap. All rights reserved.