agent-device
Version:
Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.
1 lines • 675 B
JavaScript
import{t as e}from"./mp4-atoms.js";import t from"node:fs";const n=[`moov`,`mvhd`];function r(e){let t=a(e);if(!t)return;let n=t[0];if(n===1)return i(t.readUInt32BE(20),Number(t.readBigUInt64BE(24)));if(n!==0)return;let r=t.readUInt32BE(16);if(r!==4294967295)return i(t.readUInt32BE(12),r)}function i(e,t){if(!(e<=0||t<0||!Number.isSafeInteger(t)))return Math.round(t*1e3/e)}function a(r){let i=e(r,n);if(!i||!Number.isSafeInteger(i.size))return;let a=i.offset+i.headerSize;if(i.size-i.headerSize<32)return;let o=Buffer.alloc(32),s;try{return s=t.openSync(r,`r`),t.readSync(s,o,0,o.length,a)===o.length?o:void 0}catch{return}finally{s!==void 0&&t.closeSync(s)}}export{r as t};