diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-01-21 13:37:18 -0500 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-01-21 13:37:18 -0500 |
commit | a17e2dfe7a2ed9b033ce8ee224395fdaea21bdfe (patch) | |
tree | e04860010661b4ce2af42d78f1ab6895dee2e395 /www/js | |
parent | 0463505d98e98a204215e8669ce3270ab0448d1a (diff) | |
download | html5ks-a17e2dfe7a2ed9b033ce8ee224395fdaea21bdfe.tar.xz html5ks-a17e2dfe7a2ed9b033ce8ee224395fdaea21bdfe.zip |
Stuff.
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/api.js | 8 | ||||
-rw-r--r-- | www/js/html5ks.js | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/www/js/api.js b/www/js/api.js index 833b120..d659cbb 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -78,13 +78,13 @@ window.html5ks.api = new (function () { audio.onerror = function (e) { if (e.code === e.MEDIA_ERR_SRC_NOT_SUPPORTED) { i = setNextType(i); - if (i) { + if (!i) { + console.log("no audio formats supported"); deferred.resolve(); - } else { - throw new Error(e); } } else { - throw new Error(e); + console.error("unknown audio error"); + deferred.resolve(); } }; audio.load(); diff --git a/www/js/html5ks.js b/www/js/html5ks.js index e1c0bd7..093505e 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -19,7 +19,11 @@ window.html5ks = { sfxVolume: 1, language: "en" }; - var loaded = localStorage.persistent ? JSON.parse(localStorage.persistent) : {}; + try { + var loaded = localStorage.persistent ? JSON.parse(localStorage.persistent) : {}; + } catch (e) { + var loaded = {}; + } var defProp = function (v) { Object.defineProperty(html5ks.persistent, k, { get: function () { |