Audio reports wrong duration and bad seeking

0 favourites
  • 3 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • Problem Description

    Audio (Web Audio API) reports wrong sound file duration when audio is being played from 'Music' folder (as opposed to 'Sound') in Android Chrome. When used in conjunction with playback 'seek' actions, it causes very inaccurate positioning.

    Attach a Capx

    Description of Capx

    Two Sprite 'buttons'; one plays Audio from 'Sounds' folder, another from 'Music' folder. Note that, in actuality, the audio files are located in the 'Music' folder, but the Audio will still play it even though the Audio 'Play' action specifies to play it from the folder 'Sound'.

    The audio is 35 seconds long.

    Steps to Reproduce Bug

    • Run capx in DEBUG mode in Android Chrome.
    • Watch Audio object in debugger.
    • Press LEFT sprite (which plays the audio in 'Music' folder). Audio will play. Look at playback time of audio; note it reports 21 (or so) seconds as duration.
    • Press LEFT sprite again. This is supposed to advance the audio to the 15 second mark as specified in the event sheet. However, this brings it near the end of the audio clip.
    • (If you had allowed audio file to play, debugger will report audio as finished playing (ie '0 playing') early even though audio is still playing back.)
    • Restart debugger/preview.
    • Press RIGHT sprite (plays the audio in 'Sounds' folder). Audio will play. Look at playback time of audio; note it reports 35 (or so) seconds as duration. This is the correct duration.
    • Press RIGHT sprite again. This advanced audio to 15 second mark, and this reflects correctly in the sound and in the debugger.

    Observed Result

    When audio is played in 'Music' folder, debugger reports wrong duration. When seeking is attempted, the playback position is wrong.

    This bug happens only in Android Chrome.

    Android Firefox, Windows Chrome, Windows Firefox, Safari reports correct duration and seeks properly.

    Expected Result

    -Audio should report actual audio file duration in debugger.

    -When 'seeking' to a playback position, the seeking should be the same as other platforms.

    Affected Browsers

    • Chrome: (YES) (Android ONLY)
    • FireFox: (NO)

    Operating System and Service Pack

    Windows 7 SP1

    Construct 2 Version ID


  • The fact this happens only on Chrome for Android strongly indicates a problem with Chrome and not Construct 2's code, but I will leave this open for investigation later.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I can't reproduce any issue in Chrome for Android (currently v52) - the debugger is fiddly on mobile so I just added a text object showing the duration and playback time (.capx: and it displays the correct duration and playback position.

    I know that Google have been doing some heavy work on the audio engine in Chrome for Android recently, and v52 made some big changes, so maybe check your Chrome is up to date and try again. If not try Chrome Dev for Android which is newer. I think you were seeing a problem on an older version that was subsequently fixed, so closing this report.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)