Bug 189330

Summary: audio.duration returns "Infinity"
Product: WebKit Reporter: Stephen <drew>
Component: MediaAssignee: Nobody <webkit-unassigned>
Status: RESOLVED WORKSFORME    
Severity: Normal CC: jer.noble, keith_miller, peng.liu6, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 11   
Hardware: iPhone / iPad   
OS: iOS 11   
Attachments:
Description Flags
Alert that appears with test code. none

Description Stephen 2018-09-05 18:17:54 PDT
Created attachment 348990 [details]
Alert that appears with test code.

When using audio.duration on iOS, Mac, other Safari supported devices, it will return "Infinity."
This occurs on iOS 12 and below.
This can be easy to reproduce, with code, provided below.

<audio id="audio" ontimeupdate="test()" src="myaudio.mp3">
<script>
function test(){
      let audio = document.getElementId("audio");
      alert(audio.duration);
}
</script>
Comment 1 Keith Miller 2018-09-19 08:38:07 PDT
Hmm, I think this is probably not a JavaScriptCore issue. I'm gonna move this over to Media Elements.
Comment 2 Radar WebKit Bug Importer 2018-09-19 08:38:25 PDT
<rdar://problem/44603907>
Comment 3 Jer Noble 2018-09-19 13:32:47 PDT
Stephen, could you attach the "myaudio.mp3" that triggers this behavior?
Comment 4 Peng Liu 2019-08-23 13:12:05 PDT
I cannot reproduce the bug on the latest version of iOS 12 with several mp3 files. If Stephen can provide the mp3 file he used to reproduce the bug, I would be happy to open this bug and investigate it.