From 82506df2ddec41e3a4d5f5f26d89872a12a24f97 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Sun, 8 Apr 2018 20:00:54 -0700 Subject: [PATCH] Handle infinity for now --- js/media/elementSource.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/media/elementSource.js b/js/media/elementSource.js index aa07b5bd..706d80f5 100644 --- a/js/media/elementSource.js +++ b/js/media/elementSource.js @@ -129,7 +129,9 @@ export default class ElementSource { getDuration() { const { duration } = this._audio; - return isNaN(duration) ? 0 : duration; + // Safari on iOS currently has a strange behavior where it reports + // the duration as infinity. For now, 0 is better even though it's still wrong. + return isNaN(duration) || duration === Infinity ? 0 : duration; } getTimeElapsed() {