Release - v12.11 | v0.12.7
This commit is contained in:
@@ -4,7 +4,7 @@ import { RouterOutlet } from '@angular/router';
|
||||
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
||||
import { fetchFile, toBlobURL } from '@ffmpeg/util';
|
||||
|
||||
const baseURL = "https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm";
|
||||
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.7/dist/esm';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@@ -16,33 +16,34 @@ const baseURL = "https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm";
|
||||
export class AppComponent {
|
||||
loaded = false;
|
||||
ffmpeg = new FFmpeg();
|
||||
videoURL = "";
|
||||
message = "";
|
||||
videoURL = '';
|
||||
message = '';
|
||||
async load() {
|
||||
this.ffmpeg.on("log", ({ message }) => {
|
||||
this.ffmpeg.on('log', ({ message }) => {
|
||||
this.message = message;
|
||||
});
|
||||
await this.ffmpeg.load({
|
||||
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
||||
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
|
||||
wasmURL: await toBlobURL(
|
||||
`${baseURL}/ffmpeg-core.wasm`,
|
||||
"application/wasm"
|
||||
'application/wasm'
|
||||
),
|
||||
workerURL: await toBlobURL(
|
||||
`${baseURL}/ffmpeg-core.worker.js`,
|
||||
"text/javascript"
|
||||
'text/javascript'
|
||||
),
|
||||
});
|
||||
this.loaded = true;
|
||||
};
|
||||
}
|
||||
async transcode() {
|
||||
const videoURL = "https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi";
|
||||
await this.ffmpeg.writeFile("input.avi", await fetchFile(videoURL));
|
||||
await this.ffmpeg.exec(["-i", "input.avi", "output.mp4"]);
|
||||
const videoURL =
|
||||
'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi';
|
||||
await this.ffmpeg.writeFile('input.avi', await fetchFile(videoURL));
|
||||
await this.ffmpeg.exec(['-i', 'input.avi', 'output.mp4']);
|
||||
const fileData = await this.ffmpeg.readFile('output.mp4');
|
||||
const data = new Uint8Array(fileData as ArrayBuffer);
|
||||
this.videoURL = URL.createObjectURL(
|
||||
new Blob([data.buffer], { type: 'video/mp4' })
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user