diff --git a/embed/controls.js b/embed/controls.js index cec629de..42e2ff28 100644 --- a/embed/controls.js +++ b/embed/controls.js @@ -93,14 +93,20 @@ function MistUI(MistVideo,structure) { //apply skin CSS var uid = MistUtil.createUnique(); - var toload = MistVideo.skin.css.length; - if (toload) { container.style.opacity = "0"; } + var loaded = 0; + if (MistVideo.skin.css.length) { container.style.opacity = 0; } for (var i in MistVideo.skin.css) { var style = MistVideo.skin.css[i]; style.callback = function(css) { - this.textContent = MistUtil.css.prependClass(css,uid,true); - toload--; - if (toload <= 0) { + if (css == "/*Failed to load*/") { + this.textContent = css; + MistVideo.showError("Failed to load CSS from "+this.getAttribute("data-source")); + } + else { + this.textContent = MistUtil.css.prependClass(css,uid,true); + } + loaded++; + if (MistVideo.skin.css.length <= loaded) { container.style.opacity = ""; } }; diff --git a/embed/skins.js b/embed/skins.js index 92304a74..e75ddd28 100644 --- a/embed/skins.js +++ b/embed/skins.js @@ -418,7 +418,9 @@ MistSkins["default"] = { //remove all the things when unmuted var fu = function(){ if (!MistVideo.video.muted) { - MistVideo.container.removeChild(largeMutedButton); + if (largeMutedButton.parentNode) { + MistVideo.container.removeChild(largeMutedButton); + } MistVideo.video.removeEventListener("volumechange",fu); document.body.removeEventListener("click",i); MistVideo.video.removeEventListener("mouseenter",f); @@ -2621,10 +2623,10 @@ function MistSkin(MistVideo) { //load css var styles = []; - var toload = 0; for (var i in this.css) { if (typeof this.css[i] == "string") { - styles.push(MistUtil.css.load(MistVideo.urlappend(this.css[i]),this.colors)); + var a = MistUtil.css.load(MistVideo.urlappend(this.css[i]),this.colors); + styles.push(a); } } this.css = styles; //overwrite diff --git a/embed/util.js b/embed/util.js index 3a9d8011..ac6ffd6e 100644 --- a/embed/util.js +++ b/embed/util.js @@ -363,9 +363,7 @@ var MistUtil = { callback(xhr.response); } else if (errorCallback) { - xhr.onerror = function() { - errorCallback(xhr); - } + errorCallback(xhr); } }; if (errorCallback) { @@ -461,7 +459,12 @@ var MistUtil = { } cache[url] = d; },function(){ - throw "Failed to load CSS from "+url; + var d = "/*Failed to load*/"; + for (var i in cache[url]) { + cache[url][i](d); + } + cache[url] = d; + }); }