Spaccogram/webk/public/requestVideoFrameCallbackPo...

1 line
3.1 KiB
Plaintext

{"version":3,"file":"requestVideoFrameCallbackPolyfill-DBr1l6Ii.js","sources":["../src/helpers/dom/requestVideoFrameCallbackPolyfill.ts"],"sourcesContent":["// @ts-nocheck\n// https://github.com/ThaUnknown/rvfc-polyfill/blob/main/index.js\n\nif(!('requestVideoFrameCallback' in HTMLVideoElement.prototype) && 'getVideoPlaybackQuality' in HTMLVideoElement.prototype) {\n HTMLVideoElement.prototype._rvfcpolyfillmap = {};\n HTMLVideoElement.prototype.requestVideoFrameCallback = function(callback) {\n const quality = this.getVideoPlaybackQuality();\n const baseline = this.mozPresentedFrames || this.mozPaintedFrames || quality.totalVideoFrames - quality.droppedVideoFrames;\n\n const check = (old, now) => {\n const newquality = this.getVideoPlaybackQuality();\n const presentedFrames = this.mozPresentedFrames || this.mozPaintedFrames || newquality.totalVideoFrames - newquality.droppedVideoFrames;\n if(presentedFrames > baseline) {\n const processingDuration = this.mozFrameDelay || (newquality.totalFrameDelay - quality.totalFrameDelay) || 0;\n const timediff = now - old; // HighRes diff\n callback(now, {\n presentationTime: now + processingDuration * 1000,\n expectedDisplayTime: now + timediff,\n width: this.videoWidth,\n height: this.videoHeight,\n mediaTime: Math.max(0, this.currentTime || 0) + timediff / 1000,\n presentedFrames,\n processingDuration\n });\n delete this._rvfcpolyfillmap[handle];\n } else {\n this._rvfcpolyfillmap[handle] = requestAnimationFrame(newer => check(now, newer));\n }\n }\n\n const handle = Date.now();\n const now = performance.now();\n this._rvfcpolyfillmap[handle] = requestAnimationFrame(newer => check(now, newer));\n return handle; // spec says long, not doube, so can't re-use performance.now\n };\n\n HTMLVideoElement.prototype.cancelVideoFrameCallback = function(handle) {\n cancelAnimationFrame(this._rvfcpolyfillmap[handle]);\n delete this._rvfcpolyfillmap[handle];\n };\n}\n\nexport {};\n"],"names":["callback","quality","baseline","check","old","now","newquality","presentedFrames","processingDuration","timediff","handle","newer"],"mappings":"AAGG,EAAE,8BAA+B,iBAAiB,YAAc,4BAA6B,iBAAiB,YAC9F,iBAAA,UAAU,iBAAmB,GAC7B,iBAAA,UAAU,0BAA4B,SAASA,EAAU,CAClE,MAAAC,EAAU,KAAK,0BACfC,EAAW,KAAK,oBAAsB,KAAK,kBAAoBD,EAAQ,iBAAmBA,EAAQ,mBAElGE,EAAQ,CAACC,EAAKC,IAAQ,CACpB,MAAAC,EAAa,KAAK,0BAClBC,EAAkB,KAAK,oBAAsB,KAAK,kBAAoBD,EAAW,iBAAmBA,EAAW,mBACrH,GAAGC,EAAkBL,EAAU,CAC7B,MAAMM,EAAqB,KAAK,eAAkBF,EAAW,gBAAkBL,EAAQ,iBAAoB,EACrGQ,EAAWJ,EAAMD,EACvBJ,EAASK,EAAK,CACZ,iBAAkBA,EAAMG,EAAqB,IAC7C,oBAAqBH,EAAMI,EAC3B,MAAO,KAAK,WACZ,OAAQ,KAAK,YACb,UAAW,KAAK,IAAI,EAAG,KAAK,aAAe,CAAC,EAAIA,EAAW,IAC3D,gBAAAF,EACA,mBAAAC,CAAA,CACD,EACM,OAAA,KAAK,iBAAiBE,CAAM,CAAA,MAE9B,KAAA,iBAAiBA,CAAM,EAAI,yBAA+BP,EAAME,EAAKM,CAAK,CAAC,CAClF,EAGID,EAAS,KAAK,MACdL,EAAM,YAAY,MACnB,YAAA,iBAAiBK,CAAM,EAAI,yBAA+BP,EAAME,EAAKM,CAAK,CAAC,EACzED,CAAA,EAGQ,iBAAA,UAAU,yBAA2B,SAASA,EAAQ,CAChD,qBAAA,KAAK,iBAAiBA,CAAM,CAAC,EAC3C,OAAA,KAAK,iBAAiBA,CAAM,CAAA"}