mirror of
https://github.com/davedoesdev/streamana.git
synced 2025-09-26 17:51:12 +08:00
For empty video, use data URI
This commit is contained in:
@@ -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
1
site/empty-video.js
Normal file
File diff suppressed because one or more lines are too long
BIN
site/empty.mp4
BIN
site/empty.mp4
Binary file not shown.
@@ -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);
|
||||
|
Reference in New Issue
Block a user