Open Bug 1267207 Opened 9 years ago Updated 3 years ago

html5 audio duration is kept after the src attribute has been removed

Categories

(Core :: Audio/Video: Playback, defect, P3)

x86_64
Linux
defect

Tracking

()

UNCONFIRMED

People

(Reporter: tigger, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Build ID: 20160309193552 Steps to reproduce: In HTML / Javascript: HTML: <audio id="audioPlayer"></audio> <a href="#" onclick="clearTrack();return false">clear track</a> Javascript: var a = document.getElementById('audioPlayer'); a.src = '/path/to/valid/file.mp3'; a.play(); function clearTrack() { a.pause(); a.currentTime = 0; // Setting duration to 0 does nothing too //a.duration = 0; a.removeAttribute("src"); console.log('src:['+ a.src +'] duration:['+ a.duration +']'); } Actual results: Track will play. Clicking "clear track" will stop the audio and the console log will show no 'src' value (correct) but will show a 'duration' of the track, which no longer exists. Expected results: 'duration' should also be removed or reset to zero or null or false or undefined when the src attribute is removed.
User Agent Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0 Build ID 20160427030215 Reproduced on latest Nightly. A link showing the issue: http://jsbin.com/digituguga/edit?html,js,output. Another thing that worth to be noticed is that other browsers, like Chrome, have the same behavior. I won't mark this as new because I don't know if this is the expected behavior or not. Maybe someone else can confirm.
Component: Untriaged → Audio/Video
OS: Unspecified → Linux
Product: Firefox → Core
Hardware: Unspecified → x86_64
Version: 45 Branch → Trunk
Component: Audio/Video → Audio/Video: Playback
Mass change P2 -> P3
Priority: P2 → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.