Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:39:25+00:00 2026-06-08T04:39:25+00:00

I need to catch touch events to the MediaController progress slider, so that updates

  • 0

I need to catch touch events to the MediaController progress slider, so that updates to the MediaPlayer don’t occur until the finger lifts off the slider.

[ Perhaps my situation is unique: I am playing streaming video that comes in multiple “stacks” for each “program”. The next stack is not loaded until the previous one is finished. The slider needs to represent the duration of all stacks, and the progress of the “thumb” needs to represent total duration. This is easily done by overriding the getBufferPercentage(), getCurrentPosition(), and getDuration() methods of MediaPlayerControl ]

More problematic is “scrubbing” (moving the thumb) back and forth along the timeline. If it causes the data source to be set multiple times along with a seekTo for every movement, things very quickly bog down and crash. It would be better if the MediaPlayer did no action until the user has finished the scrub.

As others have written, Yes it would be best to write my own implementation of the MediaController. But why redo all that work? I tried extending MediaController, but that got complicated quickly. I just wanted to catch the touch events to the slider!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:39:27+00:00Added an answer on June 8, 2026 at 4:39 am

    One is able to get a handle to the elements of MediaController:

    final int topContainerId1 = getResources().getIdentifier("mediacontroller_progress", "id", "android");
    final SeekBar seekbar = (SeekBar) mController.findViewById(topContainerId1);
    

    Then set a listener on the seekbar, which will require you to implement its three public methods:

    seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            // Log.i("TAG", "#### onProgressChanged: " + progress);
            // update current position here
            }
    
        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
            // Log.i("TAG", "#### onStartTrackingTouch");
            // this tells the controller to stay visible while user scrubs
            mController.show(3600000);
            // if it is possible, pause the video
            if (playerState == MPState.Started || playerState == MPState.Paused) {
                mediaPlayer.pause();
                playerState = MPState.Paused;
            }
        }
    
        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
            int seekValue = seekBar.getProgress();
            int newMinutes = Math.round((float)getTotalDuration() * (float)seekValue / (float)seekBar.getMax());
            // Log.i("TAG", "#### onStopTrackingTouch: " + newMinutes);
            mController.show(3000); // = sDefaultTimeout, hide in 3 seconds
        }
    });
    

    Caveats:
    This is not updating the current position as you scrub, the left-hand-side TextView time value. (I had a truly remarkable way to do this which this margin is too small to contain).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to catch that exception but I can't figure out which one it
Everything is brilliant until I encounter place where I actually do need to catch
I'm writing a regex that I need to catch strings that are plurial starting
I'm building a app that I need to catch the text of textarea with
I need to catch keypresses in my C# program that has a WebBrowser control
Ex, I need to catch remove and add files events on some directory on
I need to catch KeyDown & especially KeyUp events for 1,2,3,4,5,6,7,8,9 keyboard buttons. How
We need to catch the login data that have extra information as captcha inputs
I have been developing some Android application and I need to catch some events:
I need to catch or filter a number from string example: var Mystring =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.