Handle infinity for now

This commit is contained in:
Jordan Eldredge 2018-04-08 20:00:54 -07:00
parent 373d613e19
commit 82506df2dd

View file

@ -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() {