mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-12 15:51:10 +03:00
try out ogv codec loader
This commit is contained in:
47
src/codec.js
Normal file
47
src/codec.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { OGVLoader } from "ogv";
|
||||
|
||||
// example: https://github.com/rgov/js-theora-decoder/blob/main/index.html
|
||||
// dev: copy decoder files from node/ogv/dist/* to project dir
|
||||
// dist: .... to dist
|
||||
|
||||
export function loadVp9() {
|
||||
OGVLoader.loadClass(
|
||||
"OGVDecoderVideoVP9W",
|
||||
(videoCodecClass) => {
|
||||
videoCodecClass().then((decoder) => {
|
||||
decoder.init(() => {
|
||||
onVp9Ready(decoder)
|
||||
})
|
||||
})
|
||||
},
|
||||
{ worker: true }
|
||||
);
|
||||
}
|
||||
|
||||
export function loadOpus() {
|
||||
OGVLoader.loadClass(
|
||||
"OGVDecoderAudioOpusW",
|
||||
(audioCodecClass) => {
|
||||
audioCodecClass().then((decoder) => {
|
||||
decoder.init(() => {
|
||||
onOpusReady(decoder)
|
||||
})
|
||||
})
|
||||
},
|
||||
{ worker: true }
|
||||
);
|
||||
}
|
||||
|
||||
async function onVp9Ready(decoder) {
|
||||
console.log("Vp9 decoder ready");
|
||||
|
||||
/*
|
||||
decoder.processFrame(buffer, () => {
|
||||
player.drawFrame(decoder.frameBuffer)
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
async function onOpusReady(decoder) {
|
||||
console.log("Opus decoder ready");
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
import './style.css'
|
||||
import './style.css';
|
||||
import { loadVp9, loadOpus } from "./codec";
|
||||
|
||||
loadVp9();
|
||||
loadOpus();
|
||||
|
||||
const app = document.querySelector<HTMLDivElement>('#app')!
|
||||
|
||||
|
||||
2
src/vite-env.d.ts
vendored
2
src/vite-env.d.ts
vendored
@@ -1 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite/client" />
|
||||
Reference in New Issue
Block a user