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 7639235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:22:04+00:00 2026-05-31T08:22:04+00:00

Guys i able to play audio file using Mediaplayer. But i need to play

  • 0

Guys i able to play audio file using Mediaplayer. But i need to play a audio file for specific time.

Eg: play audio1.mp3 till 5 minutes.
The audio file is of 10 seconds only.But it should keep playing till 5 minutes.

  • 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-05-31T08:22:05+00:00Added an answer on May 31, 2026 at 8:22 am

    try this

     mediaplayerplayer.setLooping(true);<--- this lets the audio to loop...
    

    and this is the countdown timer

    MyCount counter;
    Long s1;
    
    counter= new MyCount(300000,1000);
    counter.start();
    
    public void asdf(View v){  <---- method for onclick of buttons pause and resuming timer
        switch(v.getId()){
            case R.id.button1:<-- for pause
                counter.cancel();
                break;
            case R.id.button2:<--- for resume
                counter= new MyCount(s1,1000);
                counter.start();
        }
    }
    
    public class MyCount extends CountDownTimer {
        public MyCount(long millisInFuture, long countDownInterval) {
            super(millisInFuture, countDownInterval);
        }
    
        @Override
        public void onFinish() {
            mediaplayer.stop();
            mediaplayer.release();
        }
    
        @Override
        public void onTick(long millisUntilFinished) {
            s1=millisUntilFinished;
        }
    }
    

    this helps you to pause the mediaplayer also… along with timer.. and lets you play the song for complete 5 mins

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

Sidebar

Related Questions

Okay, here goes. Stack Overflow virgin here but hopefully you guys will be able
Hi guys I'm building a facility to be able to generate a csv file
I have an odd error that you guys will hopefully be able to help
Which tools do you guys use? How do demangle c++ symbols do be able
Guys, I am using SQL Server 2000 and executing the sp_columns stored procedure to
I have an FFmpeg-based video-playing app which is able to play content from any
Frequent visitor but first post here on StackOverflow, I'm hoping that you guys might
HI guys. Im using mod_rewrite to do some redirects on a web site. I
Hey guys, I've got what I imagine is a simple question, but for some
Hey guys I'm fairly green when it comes to wpf, so I need a

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.