// vDecoder example import { VDecoder } from "./VDecoder.js"; // 测试用 import { initWebGLCanvas, draw } from "../video/test.js"; // decoder // const socket = io("ws://192.168.0.150:3000", { // reconnectionDelayMax: 10000, // }); // socket.on("connect", (data) => { // console.log("socket connect"); // }); const vDecoder = new VDecoder({ maxChip: 100, }); vDecoder.on("ready", () => { console.log("ready"); // 测试canvas initWebGLCanvas(); vDecoder.fetch({ path: "https://laser-data.oss-cn-shenzhen.aliyuncs.com/test-video/1011", range: [], }); vDecoder.on("fetchDone", (clip) => { console.log("fetchDone", clip); }); //监听 decodeData vDecoder.on("decodeData", (data) => { // console.log("decodeData", data); const { width, height, data: buffer } = data; // draw(new Uint8Array(buffer), width, height); // window.updateTexture( new Uint8Array(buffer) ); // window.up }); vDecoder.on("decodeDone", async (id) => { let clipId = null; // vDecoder.flush(); // vDecoder.fetch({ // path: "https://laser-data.oss-cn-shenzhen.aliyuncs.com/test-video/1011", // range: [0, 66], // }); // console.log("clipId", clipId); }); });