MCPcopy Index your code
hub / github.com/hoothin/UserScripts / createVideo

Function createVideo

Picviewer CE+/dist.user.js:27199–27222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27197 }
27198 });
27199 function createVideo() {
27200 let media = document.createElement('video');
27201 media.addEventListener('error', e => {
27202 if (/^blob:/.test(media.src)) return;
27203 _GM_xmlhttpRequest({
27204 method: 'GET',
27205 url: media.src,
27206 responseType: 'blob',
27207 onload: function(response) {
27208 const blobUrl = URL.createObjectURL(response.response);
27209
27210 media.src = blobUrl;
27211 media.load();
27212 media.play().catch(err => console.warn('[CSP Fixer] Autoplay after fix was blocked.', err));
27213
27214 const releaseBlob = () => URL.revokeObjectURL(blobUrl);
27215 media.addEventListener('ended', releaseBlob);
27216 window.addEventListener('beforeunload', releaseBlob);
27217 curLoadingMedia = null;
27218 }
27219 });
27220 });
27221 return media;
27222 }
27223
27224 async function input(sel, v) {
27225 await new Promise((resolve) => {

Callers 3

initFunction · 0.70
handleFunction · 0.70
loadImgFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected