diff --git a/package-lock.json b/package-lock.json index 45a81b86..01821195 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "0.1.0", "license": "BSD-3-Clause", "dependencies": { - "@types/dom-mediacapture-transform": "^0.1.5", "codemirror": "^5.58.2", "dat.gui": "^0.7.6", "file-loader": "^6.2.0", @@ -470,19 +469,6 @@ "integrity": "sha512-Dx9f9CkXJkDAxt9M05vc7DItSqsiEhWN7Rx3vgO/maltv/nX9TaMX2sd/iAMENnL1D5FivetktJEyCBLFu50CQ==", "dev": true }, - "node_modules/@types/dom-mediacapture-transform": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/@types/dom-mediacapture-transform/-/dom-mediacapture-transform-0.1.5.tgz", - "integrity": "sha512-Mgu6H5LVJPgJuAumx0xFEdZvn9whHy+J3gEJbJz5xdWrUJ8ZwZ/JTvWwYOQPkCGzGWykPN7ufQn94iil+VCWGw==", - "dependencies": { - "@types/dom-webcodecs": "*" - } - }, - "node_modules/@types/dom-webcodecs": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/@types/dom-webcodecs/-/dom-webcodecs-0.1.7.tgz", - "integrity": "sha512-1euwRyJ7rQrddOa24d5ZcoDRMp68xEIwyb7PKb3Wpc2OullUxHQ4a63WPa5V8R+KtCWISKjgS+f83HCUVhXS/w==" - }, "node_modules/@types/eslint": { "version": "8.21.1", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.21.1.tgz", diff --git a/package.json b/package.json index 7d5d9c27..f60e6423 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "export": "next export" }, "dependencies": { - "@types/dom-mediacapture-transform": "^0.1.5", "codemirror": "^5.58.2", "dat.gui": "^0.7.6", "file-loader": "^6.2.0", diff --git a/src/sample/videoUploadingWebCodecs/main.ts b/src/sample/videoUploadingWebCodecs/main.ts index 82746f78..e45cd859 100644 --- a/src/sample/videoUploadingWebCodecs/main.ts +++ b/src/sample/videoUploadingWebCodecs/main.ts @@ -61,35 +61,11 @@ const init: SampleInit = async ({ canvas, pageState }) => { minFilter: 'linear', }); - function getVideoFrameFromVideoElement(video) { - return new Promise((resolve) => { - const videoTrack = video.captureStream().getVideoTracks()[0]; - const trackProcessor = new MediaStreamTrackProcessor({ - track: videoTrack, - }); - const transformer = new TransformStream({ - transform(videoFrame) { - videoTrack.stop(); - resolve(videoFrame); - }, - flush(controller) { - controller.terminate(); - }, - }); - const trackGenerator = new MediaStreamTrackGenerator({ - kind: 'video', - }); - trackProcessor.readable - .pipeThrough(transformer) - .pipeTo(trackGenerator.writable); - }); - } - async function frame() { // Sample is no longer the active page. if (!pageState.active) return; - const videoFrame = await getVideoFrameFromVideoElement(video); + const videoFrame = new VideoFrame(video); const uniformBindGroup = device.createBindGroup({ layout: pipeline.getBindGroupLayout(0),