From e667b8b5164cb9c61d101875649f6d9f11c341c1 Mon Sep 17 00:00:00 2001 From: James Simpson Date: Wed, 30 Jun 2021 13:44:49 -0500 Subject: [PATCH] Fix error with Safari UA check Fixes #1491 --- src/howler.core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/howler.core.js b/src/howler.core.js index 8cc55ffa..d14910ec 100644 --- a/src/howler.core.js +++ b/src/howler.core.js @@ -268,7 +268,8 @@ var checkOpera = ua.match(/OPR\/([0-6].)/g); var isOldOpera = (checkOpera && parseInt(checkOpera[0].split('/')[1], 10) < 33); var checkSafari = ua.indexOf('Safari') !== -1 && ua.indexOf('Chrome') === -1; - var isOldSafari = (checkSafari && parseInt(ua.match(/Version\/(.*?) /)[1], 10) < 15); + var safariVersion = ua.match(/Version\/(.*?) /); + var isOldSafari = (checkSafari && safariVersion && parseInt(safariVersion[1], 10) < 15); self._codecs = { mp3: !!(!isOldOpera && (mpegTest || audioTest.canPlayType('audio/mp3;').replace(/^no$/, ''))),