put ogv.js to html

This commit is contained in:
open-trade 2022-01-18 17:24:36 +08:00
parent c09f65b6cc
commit 9f42fd534c
4 changed files with 25 additions and 7 deletions

4
.gitignore vendored
View File

@ -2,4 +2,6 @@ node_modules
.DS_Store
dist
dist-ssr
*.local
*.local
*log
ogvjs

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="ogvjs/ogv.js"></script>
<title>Vite App</title>
</head>
<body>

View File

@ -2,8 +2,8 @@
"name": "web_hbb",
"version": "1.0.0",
"scripts": {
"dev": "cp node_modules/ogv/dist/* dist/ && vite",
"build": "tsc && vite build",
"dev": "cp -rf node_modules/ogv/dist/* ogvjs/ && vite",
"build": "cp node_modules/ogv/dist/* dist/ogvjs/ && tsc && vite build",
"preview": "vite preview"
},
"devDependencies": {

View File

@ -1,11 +1,26 @@
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
/*
OGVDemuxerOggW: 'ogv-demuxer-ogg-wasm.js',
OGVDemuxerWebMW: 'ogv-demuxer-webm-wasm.js',
OGVDecoderAudioOpusW: 'ogv-decoder-audio-opus-wasm.js',
OGVDecoderAudioVorbisW: 'ogv-decoder-audio-vorbis-wasm.js',
OGVDecoderVideoTheoraW: 'ogv-decoder-video-theora-wasm.js',
OGVDecoderVideoVP8W: 'ogv-decoder-video-vp8-wasm.js',
OGVDecoderVideoVP8MTW: 'ogv-decoder-video-vp8-mt-wasm.js',
OGVDecoderVideoVP9W: 'ogv-decoder-video-vp9-wasm.js',
OGVDecoderVideoVP9SIMDW: 'ogv-decoder-video-vp9-simd-wasm.js',
OGVDecoderVideoVP9MTW: 'ogv-decoder-video-vp9-mt-wasm.js',
OGVDecoderVideoVP9SIMDMTW: 'ogv-decoder-video-vp9-simd-mt-wasm.js',
OGVDecoderVideoAV1W: 'ogv-decoder-video-av1-wasm.js',
OGVDecoderVideoAV1SIMDW: 'ogv-decoder-video-av1-simd-wasm.js',
OGVDecoderVideoAV1MTW: 'ogv-decoder-video-av1-mt-wasm.js',
OGVDecoderVideoAV1SIMDMTW: 'ogv-decoder-video-av1-simd-mt-wasm.js',
*/
export function loadVp9() {
OGVLoader.loadClass(
window.OGVLoader.loadClass(
"OGVDecoderVideoVP9W",
(videoCodecClass) => {
videoCodecClass().then((decoder) => {
@ -19,7 +34,7 @@ export function loadVp9() {
}
export function loadOpus() {
OGVLoader.loadClass(
window.OGVLoader.loadClass(
"OGVDecoderAudioOpusW",
(audioCodecClass) => {
audioCodecClass().then((decoder) => {