Vinlic / WebVideoCreator

🌈 A framework for rendering web animations into videos. It's implemented based on Node.js + Puppeteer + Chrome + FFmpeg, utilizing the latest browser APIs.
Apache License 2.0
115 stars 29 forks source link

Blob & Base64 <audio> not recorded #29

Open 0xAnthony opened 4 months ago

0xAnthony commented 4 months ago

Hi, it looks like audio tags with base64 and blob src are not recorded.

Here is how I add dynamically the audio :

// Create blob
const mimeType = 'audio/mpeg';
const blob = base64ToBlob(base64, mimeType);
const audioUrl = URL.createObjectURL(blob);

// Create <audio> element
const audio = document.createElement('audio');
const source = document.createElement('source');
source.src = audioUrl;
source.type = mimeType;

// Add element to document
audio.appendChild(source);
document.body.appendChild(audio);
audio.play();

// Dynamically stop & delete element
setTimeout(() => {
    audio.pause();
    document.body.removeChild(audio);
    URL.revokeObjectURL(audioUrl);
}, duration);

Note : The Base64 are valid and this setup works if I just define audio.src to a remote mp3 file.