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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:34:00+00:00 2026-05-15T06:34:00+00:00

I am having a problem getting onprogress event for the audio tag working on

  • 0

I am having a problem getting onprogress event for the audio tag working on chrome. it seems to work on fire fox.

http://www.scottandrew.com/pub/html5audioplayer/ works on chrome but there is no progress bar update. When I copy the code and change the src to a .wav file and run it on fire fox it works perfectly.

<style type="text/css">
    #content
    {
        clear:both;
        width:60%;
    }
    .player_control
    {
        float:left;
        margin-right:5px;
            height: 20px;
        }
    #player
    {
        height:22px;
    }       
    #duration
    {
        width:400px;
        height:15px;
        border: 2px solid #50b;
    }
    #duration_background
    {
        width:400px;
        height:15px;
        background-color:#ddd; 
    }
    #duration_bar
    {
        width:0px;
        height:13px;
        background-color:#bbd;
    }
    #loader
    {
        width:0px;
        height:2px;                  
    }
        .style1
        {
            height: 35px;
        }
    </style>
    <script type="text/javascript">     
    var audio_duration;
    var audio_player; 

    function pageLoaded() {         
        audio_player = $("#aplayer").get(0);
        //get the duration
        audio_duration = audio_player.duration;         
        $('#totalTime').text(formatTimeSeconds(audio_player.duration));
        //set the volume            
    }               

    function update(){
        //get the duration of the player
        dur = audio_player.duration;
        time = audio_player.currentTime;
        fraction = time/dur;
        percent = (fraction*100);
        wrapper = document.getElementById("duration_background");
        new_width = wrapper.offsetWidth*fraction;
        document.getElementById("duration_bar").style.width = new_width + "px";
        $('#currentTime').text(formatTimeSeconds(audio_player.currentTime));
        $('#totalTime').text(formatTimeSeconds(audio_player.duration));
    }

    function formatTimeSeconds(time) {
        var minutes = Math.floor(time / 60);
        var seconds = "0" + (Math.floor(time) - (minutes * 60)).toString();
        if (isNaN(minutes) || isNaN(seconds))
        {
            return "0:00";
        }
        var Strseconds = seconds.substr(seconds.length - 2);
        return minutes + ":" + Strseconds;
    }

    function playClicked(element){
        //get the state of the player
        if(audio_player.paused)
        {
            audio_player.play();
            newdisplay = "||";
        }else{
            audio_player.pause();
            newdisplay = ">";
        }

        $('#totalTime').text(formatTimeSeconds(audio_player.duration));
        element.value = newdisplay;         
    }

    function trackEnded(){
        //reset the playControl to 'play'
        document.getElementById("playControl").value=">";
    }

    function durationClicked(event){
        //get the position of the event
        clientX = event.clientX;
        left = event.currentTarget.offsetLeft;
        clickoffset = clientX - left;
        percent = clickoffset/event.currentTarget.offsetWidth;
        duration_seek = percent*audio_duration;
        document.getElementById("aplayer").currentTime=duration_seek;

    }

    function Progress(evt){
        $('#progress').val(Math.round(evt.loaded / evt.total * 100));
        var width = $('#duration_background').css('width')          
        $('#loader').css('width', evt.loaded / evt.total * width.replace("px",""));
    }

    function getPosition(name) {
        var obj = document.getElementById(name);
        var topValue = 0, leftValue = 0;
        while (obj) {
            leftValue += obj.offsetLeft;
            obj = obj.offsetParent;
        }
        finalvalue = leftValue;
        return finalvalue;
    }
    function SetValues() {
        var xPos = xMousePos;
        var divPos = getPosition("duration_background");
        var divWidth = xPos - divPos;
        var Totalwidth = $('#duration_background').css('width').replace("px","")
        audio_player.currentTime = divWidth / Totalwidth * audio_duration;
        $('#duration_bar').css('width', divWidth);          
    }

    </script>
</head>
    <script type="text/javascript"  src="js/MousePosition.js" ></script>
    <body onLoad="pageLoaded();">
        <table>
            <tr>
                <td valign="bottom"><input id="playButton" type="button" onClick="playClicked(this);" value=">"/></td>
                <td colspan="2" class="style1" valign="bottom">
                    <div id='player'>
                        <div id="duration" class='player_control' >
                            <div id="duration_background"  onClick="SetValues();">
                                <div id="loader" style="background-color: #00FF00; width: 0px;"></div>
                                <div id="duration_bar" class="duration_bar"></div>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td>
                    <span id="currentTime">0:00</span>
                </td>
                <td align="right"  >
                    <span id="totalTime">0:00</span>
                </td>
            </tr>
        </table>            
        <audio id='aplayer' src='<%=getDownloadLink() %>' type="audio/ogg; codecs=vorbis" onProgress="Progress(event);" onTimeUpdate="update();" onEnded="trackEnded();" >
        <b>Your browser does not support the <code>audio</code> element. </b>
        </audio>
    </body>

  • 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-15T06:34:00+00:00Added an answer on May 15, 2026 at 6:34 am

    The progress event doesn’t fire in Chrome for WAV files but it does for MP3.

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

Sidebar

Ask A Question

Stats

  • Questions 443k
  • Answers 443k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Absolutely size can be a factor on DB performance! However,… May 15, 2026 at 6:07 pm
  • Editorial Team
    Editorial Team added an answer Zend Controller Response uses output buffering by default (you may… May 15, 2026 at 6:07 pm
  • Editorial Team
    Editorial Team added an answer Idea A greedy approach is the way to go: If… May 15, 2026 at 6:07 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.