For empty video, use data URI

This commit is contained in:
David Halls
2023-11-07 21:43:12 +00:00
parent 6435207d93
commit 6152c24bd2
4 changed files with 9 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
#!/bin/bash
cd "$(dirname "$0")"
ffmpeg -f lavfi -i color=white:640x480:d=1,format=rgb24 -f lavfi -i anullsrc=cl=mono:r=48000 -vf format=yuv420p -t 1 ../site/empty.mp4
f="$(mktemp XXXXXXXXXX.mp4)"
ffmpeg -f lavfi -i color=white:640x480:d=1,format=rgb24 -f lavfi -i anullsrc=cl=mono:r=48000 -vf format=yuv420p -t 1 -y "$f"
cat > ../site/empty-video.js <<EOF
export default "data:video/mp4;base64,$(base64 --wrap=0 "$f")";
EOF
rm "$f"

1
site/empty-video.js Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -9,6 +9,7 @@ import {
max_video_config,
} from './resolution.js';
import empty_video_url from './empty-video.js';
const go_live_el = document.getElementById('go-live');
go_live_el.disabled = false;
go_live_el.addEventListener('click', function () {
@@ -678,7 +679,7 @@ async function start() {
// Safari on iOS requires us to play() in the click handler and doesn't
// track async calls. So we play a blank video first. After that, the video
// element is blessed for script-driven playback.
video_el.src = 'empty.mp4';
video_el.src = empty_video_url;
await video_el.play();
canvas_el.addEventListener('webglcontextlost', cleanup);