Created
May 22, 2017 21:43
-
-
Save miketaylr/52696a79a1c95d200c20bee2863e4df2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function a(e, n, t) { | |
var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {} | |
, a = e.url | |
, i = e.type | |
, u = o.tryForceFlash | |
, d = !!o.reuseElements | |
, l = d ? C : M | |
, f = s.default.parse(a); | |
f.protocol && f.hostname || b.trace("Received relative URL as audio source! Might not work as expected: ", a); | |
var m = d ? T : new Audio; | |
m.setAttribute("id", "mediaelement_" + _), | |
_++, | |
document.body.appendChild(m); | |
var p = !1 | |
, y = setTimeout(function() { | |
p = !0, | |
t(new Error(JSON.stringify({ | |
message: "Player initialization timed out", | |
commonType: g.CommonAudioErrorCodes.INIT_TIMEOUT | |
}))) | |
}, g.INIT_TIMEOUT_MS) | |
, h = { | |
mode: u ? "auto_plugin" : "auto", | |
enablePluginDebug: !1, | |
plugins: ["flash"], | |
type: g.CommonAudioFormatToMediaElementTypes[i], | |
pluginPath: "/web-client/", | |
flashName: "flashmediaelement.swf", | |
defaultVideoWidth: 480, | |
defaultVideoHeight: 270, | |
pluginWidth: -1, | |
pluginHeight: -1, | |
timerRate: 250, | |
success: function(e, t) { | |
e.onerror = function(e) { | |
r(e.currentTarget, o.defaultError) | |
} | |
, | |
p || (clearTimeout(y), | |
t.src = a, | |
t.setAttribute("data-reuse-elements", l), | |
n(t)) | |
}, | |
error: function(e) { | |
if (clearTimeout(y), | |
(0, | |
c.default)(e) && e.src) { | |
if (p) | |
return; | |
e.src = a, | |
e.setAttribute && e.setAttribute("data-reuse-elements", l), | |
n(e) | |
} | |
t(e) | |
} | |
}; | |
return new MediaElement(m,h) | |
} |
Author
miketaylr
commented
May 22, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment