0 Favourites

Audio reports wrong duration and bad seeking

  • 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

    http://faulknermano.com/pub/c2/sound_music_bug_2016_08_04.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

    r232

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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: https://dl.dropboxusercontent.com/u/15217362/sound_music_bug_2016_08_31.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)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
223 15,824
Tom's avatar
Tom Construct Team Founder
Unread hot topic
221 16,408
dripple's avatar
dripple
Unread hot topic
119 7,534
Silverforce's avatar
Silverforce