UNPKG

3.24 kBPlain TextView Raw
1{"code":"function defineName$__(cls,name){\n\tObject.defineProperty(cls,\"name\",{value:name,configurable:true});\n};;\nfunction inheritClass$__(cls){\n\tObject.getPrototypeOf(cls.prototype).constructor?.inherited?.(cls);\n};\n\n/*body*/\nimport * as os from '../util/os';\n\nfunction gcd(a,b){\n\t\n\tif (b === 0) {\n\t\t\n\t\treturn a;\n\t} else {\n\t\t\n\t\treturn gcd(b,a % b);\n\t};\n};\n\nexport class OPVideo extends OPMedia {\n\t\n\t\n\t\n\t// chdck media for other params\n\tget width(){\n\t\treturn this.params[5];\n\t}\n\tget height(){\n\t\treturn this.params[6];\n\t}\n\tget aspectRatio(){\n\t\treturn this.params[7];\n\t}// 4:3\n\t\n\tstatic _for(blob,parameters = {}){\n\t\t\n\t\tconst params = parameters.params;\n\t\t\n\t\t\n\t\tconst meta = parameters.meta;\n\t\tparams.push(\n\t\t\t+meta[1].Width,\n\t\t\t+meta[1].Height,\n\t\t\tmeta[1].DisplayAspectRatio_String\n\t\t);\n\t\t;\n\t\t\n\t\treturn this.get(this.encodeKey(params));\n\t}\n\tstatic {\n\t\tdefineName$__(this,'OPVideo');this.alias = 'VID';\n\t\tinheritClass$__(this);}\n}; globalThis.OPVideo = OPVideo;\n","map":{"version":3,"file":"video.js","sourceRoot":"","sources":["/Users/abdellah/workspace/scrimba/op/src/types/video.imba"],"sourcesContent":["import * as os from '../util/os'\n\ndef gcd(a, b)\n\tif b === 0\n\t\ta\n\telse\n\t\tgcd b, a % b\n\nexport global class OPVideo < OPMedia\n\tstatic alias = 'VID'\n\n\t# chdck media for other params\n\tget width do params[5]\n\tget height do params[6]\n\tget aspectRatio do params[7] # 4:3\n\n\tstatic def _for blob, parameters = {}\n\t\tconst params = parameters.params\n\t\tif $node$\n\t\t\tconst meta = parameters.meta\n\t\t\tparams.push(\n\t\t\t\t+meta[1].Width\n\t\t\t\t+meta[1].Height\n\t\t\t\tmeta[1].DisplayAspectRatio_String\n\t\t\t)\n\n\t\telif $browser$\n\t\t\tconst el = <video src=parameters.blob-url>\n\t\t\tconst promise = await new Promise do(resolve)\n\t\t\t\tel.addEventListener('loadedmetadata') do\n\t\t\t\t\tresolve [el.duration, el.videoWidth, el.videoHeight]\n\t\t\tel.load!\n\t\t\tconst [duration, width, height] = await promise\n\n\t\t\tconst ratioGCD = gcd(width, height)\n\t\t\tconst aspectRatio = (width / ratioGCD) + \":\" + (height / ratioGCD)\n\n\t\t\tparams.push duration, width, height, aspectRatio\n\n\t\tself.get(encodeKey(params))"],"names":[],"mappings":";;;;;;;;AAAA,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,YAAY;;AAEhC,QAAG,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC;;CACZ,EAAE,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAA;;EACT,OAAA,CAAC;EAAA,MACE;;EACH,OAAA,GAAG,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;EAAA;CAAA;;AAEd,MAAM,CAAQ,KAAK,CAAC,OAAO,SAAG,OAAO,EAAA;;;;;CAIpC,GAAG,CAAC,KAAK;EAAI,OAAA,KAAA,MAAM,CAAC,CAAC,CAAC;EAZvB;CAaC,GAAG,CAAC,MAAM;EAAI,OAAA,KAAA,MAAM,CAAC,CAAC,CAAC;EAbxB;CAcC,GAAG,CAAC,WAAW;EAAI,OAAA,KAAA,MAAM,CAAC,CAAC,CAAC;EAd7B;;CAgBC,MAAM,CAAK,IAAI,CAAC,IAAI,CAAE,UAAU,GAAG,EAAE,CAAA;;QAC9B,MAAM,GAAG,UAAU,CAAC,MAAM;EACvB;;QACF,IAAI,GAAG,UAAU,CAAC,IAAI;EAC5B,MAAM,CAAC,IAAI;GACV,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK;GACd,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;GACf,IAAI,CAAC,CAAC,CAAC,CAAC,yBAAyB;GACjC;EAAA;;EAeF,OAAA,IAAI,CAAC,GAAG,CAAC,KAAA,SAAS,CAAC,MAAM,CAAC,CAAC;EAAA;;qCA9BrB,KAAK,GAAG,KAAK;;AA8BQ,cA/BT,OAAO,GAAP,OAAO;AA+BE;"},"dependencies":[],"meta":{"vite":{"lang":"js"}}}
\No newline at end of file