I’ve written a simple script to load FFMPEGWASM but it gives an error:
Error loading FFmpeg: ReferenceError: Can’t find variable: FFmpeg
Full code is here
<h1>FFmpeg Loading Example</h1>
<p id="message"></p>
<script src="https://cdn.jsdelivr.net/npm/@ffmpeg/[email protected]/dist/umd/ffmpeg.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", async () => {
const message = document.getElementById('message');
try {
const ffmpeg = new FFmpeg();
message.innerText = 'Loading FFmpeg...';
await ffmpeg.load();
message.innerText = 'FFmpeg loaded successfully!';
} catch (error) {
console.error('Error loading FFmpeg:', error);
message.innerText = 'Error loading FFmpeg.';
}
});
</script>