Skip to content

Commit 2dbb813

Browse files
committed
Move .lfsconfig and update usage
1 parent befb75f commit 2dbb813

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed
File renamed without changes.

apps/website/docs/getting-started/usage.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@ a ~31 MB ffmpeg-core.wasm.
1717
// import { FFmpeg } from '@ffmpeg/ffmpeg';
1818
// import { fetchFile } from '@ffmpeg/util';
1919
function() {
20-
const baseURL = 'https://unpkg.com/@ffmpeg/[email protected]/dist/umd'
2120
const [loaded, setLoaded] = useState(false);
2221
const ffmpegRef = useRef(new FFmpeg());
2322
const videoRef = useRef(null);
2423
const messageRef = useRef(null);
2524

2625
const load = async () => {
26+
const baseURL = 'https://unpkg.com/@ffmpeg/[email protected]/dist/umd'
2727
const ffmpeg = ffmpegRef.current;
2828
ffmpeg.on("log", ({ message }) => {
2929
messageRef.current.innerHTML = message;
3030
});
31+
// toBlobURL is used to bypass CORS issue, urls with the same
32+
// domain can be used directly.
3133
await ffmpeg.load({
3234
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`),
3335
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`),
@@ -138,11 +140,17 @@ function() {
138140
const messageRef = useRef(null);
139141

140142
const load = async () => {
143+
const baseURL = 'https://unpkg.com/@ffmpeg/[email protected]/dist/umd'
141144
const ffmpeg = ffmpegRef.current;
142145
ffmpeg.on("log", ({ message }) => {
143146
messageRef.current.innerHTML = message;
144147
});
145-
await ffmpeg.load();
148+
// toBlobURL is used to bypass CORS issue, urls with the same
149+
// domain can be used directly.
150+
await ffmpeg.load({
151+
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`),
152+
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`),
153+
});
146154
setLoaded(true);
147155
}
148156

@@ -186,12 +194,18 @@ function() {
186194
const messageRef = useRef(null);
187195

188196
const load = async () => {
197+
const baseURL = 'https://unpkg.com/@ffmpeg/[email protected]/dist/umd'
189198
const ffmpeg = ffmpegRef.current;
190199
// Listen to progress event instead of log.
191200
ffmpeg.on("progress", ({ progress }) => {
192201
messageRef.current.innerHTML = `${progress * 100} %`;
193202
});
194-
await ffmpeg.load();
203+
// toBlobURL is used to bypass CORS issue, urls with the same
204+
// domain can be used directly.
205+
await ffmpeg.load({
206+
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`),
207+
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`),
208+
});
195209
setLoaded(true);
196210
}
197211

apps/website/netlify.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33
[headers.values]
44
Cross-Origin-Opener-Policy = "same-origin"
55
Cross-Origin-Embedder-Policy = "require-corp"
6-
Access-Control-Allow-Origin = "*"

0 commit comments

Comments
 (0)