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

  • Home
  • SEARCH
  • 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 8304513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:52:06+00:00 2026-06-08T17:52:06+00:00

I have an audio element in a HTML5 page. I start playing the audio

  • 0

I have an audio element in a HTML5 page. I start playing the audio and then pause it. After that I go back to homescreen by pressing home button and make a phone call. When the call ends, audio element resumes automatically. This happens on Android 4.0.3

The problem is that, this is not the expected and desired behavior. Unfortunately, When browser is running in background, javascript events are not thrown and I can’t catch and prevent this behavior using Javascript.

Any help is appreciated. Thanks in advance.

  • 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-08T17:52:07+00:00Added an answer on June 8, 2026 at 5:52 pm

    I don’t have an ICS phone to try it out, but here is what I would do:

    pause obviously keeps track of the audio time position.
    4.0 seems to automatically resume where you paused the audio file

    So instead of pausing you could stop your audio file.
    Unfortunately, stop isn’t supported by HTML5.

    You have a tricky solution:

    • pause audio
    • store the position: trackPos = myTrack.currentTime;
    • store volume: trackVol = myTrack.volume;
    • mute it: myTrack.volume = 0;

    Then when the user comes back and hits play again:

    if trackPos exists

    • set the starting position to trackPos: myTrack.currentTime = trackPos;
    • play
    • mytrack.volume = trackVol;
    • delete window.trackPos;

    This is tricky but should work if you are using JavaScript controls.

    If you use native controls though play and pause would be managed by the browser’s interface. Then you should just store the position and start getting REAL dirty:

    • remove the sources:

      myTrack.removeChid( yourSRCs )

    • restore your SRCs and position on focus

    • wait for the user to play

    That’s a quick and dirty draft, not tested. But it should work

    ///EDIT///

    A working Javascript demo, at least on my desktop. Try it on your ICS:
    JSFiddle

    (save the file, I guess you can’t launch jsfiddle properly on a phone)

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

Sidebar

Related Questions

Using HTML5 I have 2 Audio elements and 1 video element on a page.
On my page , I dynamically create an HTML5 Audio element in JavaScript: bell
If you have audio encoded at 44100Hz that means you have 44100 samples per
I have an Audio app using AVAudioPlayer on iOS. Whenever music is playing my
Im a newb. I have a audio sound playing as soon as the new
I have an inline audio file to be played in android using html5. I
Anyone have experience playing audio (right now specifically mp3s) with python using a any
I have searched but cannot find the jQuery selector that gets an element by
HTML5 introduces some nice new elements, <canvas> , <audio> , and <video> , that
I have an audio element in a webpage for a client and i have

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.