Bug 189330 - audio.duration returns "Infinity"
Summary: audio.duration returns "Infinity"
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 11
Hardware: iPhone / iPad iOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-09-05 18:17 PDT by Stephen
Modified: 2019-08-23 13:12 PDT (History)
4 users (show)

See Also:


Attachments
Alert that appears with test code. (45.29 KB, image/jpeg)
2018-09-05 18:17 PDT, Stephen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.