(urlString, cb)
| 12399 | img.src = dataurl; |
| 12400 | } |
| 12401 | function urlToBlobWithFetch(urlString, cb){ |
| 12402 | fetch(urlString).then(response => response.blob()).then(blob => { |
| 12403 | let ext = extFromMimeAndUrl(blob.type, urlString); |
| 12404 | if (blob.type && blob.type.indexOf("text/html") === 0 && (blob.size || 0) < 1000) return cb(null, ''); |
| 12405 | if (ext === "none") ext = "webp"; |
| 12406 | let conversion = formatDict.get(ext); |
| 12407 | if (canvas && conversion) { |
| 12408 | var self = this; |
| 12409 | var a = new FileReader(); |
| 12410 | a.readAsDataURL(blob); |
| 12411 | a.onload = function (e) { |
| 12412 | dataURLToCanvas(e.target.result, canvas => { |
| 12413 | canvas.toBlob(nblob => { |
| 12414 | if (!nblob) { |
| 12415 | cb(blob); |
| 12416 | } else { |
| 12417 | cb(nblob, conversion || "png"); |
| 12418 | } |
| 12419 | }, "image/" + (conversion || "png")); |
| 12420 | }); |
| 12421 | }; |
| 12422 | a.onerror = function (e){ |
| 12423 | cb(blob); |
| 12424 | } |
| 12425 | } else { |
| 12426 | cb(blob, ext); |
| 12427 | } |
| 12428 | }).catch(error => { |
| 12429 | cb(null); |
| 12430 | }); |
| 12431 | } |
| 12432 | function loadVideoJsLibrary() { |
| 12433 | if (!window.videoJsStatus) { |
| 12434 | window.videoJsStatus = 'none'; |
no test coverage detected