feat: add recording to manual editor

This commit is contained in:
Kieran 2023-12-23 19:43:28 +00:00
parent 2bc5fe5eb1
commit e21d8d3ae4
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
5 changed files with 26 additions and 3 deletions

View File

@ -43,7 +43,7 @@ export default function LiveVideoPlayer({
useEffect(() => {
if (streamCached && video.current) {
if (Hls.isSupported()) {
if (Hls.isSupported() && streamCached.endsWith(".m3u8")) {
try {
const hls = new Hls({
enableWorker: true,

View File

@ -52,6 +52,7 @@ export function StreamEditor({ ev, onFinish, options }: StreamEditorProps) {
const [summary, setSummary] = useState("");
const [image, setImage] = useState("");
const [stream, setStream] = useState("");
const [recording, setRecording] = useState("");
const [status, setStatus] = useState("");
const [start, setStart] = useState<string>();
const [tags, setTags] = useState<string[]>([]);
@ -62,12 +63,14 @@ export function StreamEditor({ ev, onFinish, options }: StreamEditorProps) {
const { formatMessage } = useIntl();
useEffect(() => {
const { title, summary, image, stream, status, starts, tags, contentWarning, goal } = extractStreamInfo(ev);
const { title, summary, image, stream, status, starts, tags, contentWarning, goal, recording } =
extractStreamInfo(ev);
setTitle(title ?? "");
setSummary(summary ?? "");
setImage(image ?? "");
setStream(stream ?? "");
setStatus(status ?? StreamState.Live);
setRecording(recording ?? "");
setStart(starts);
setTags(tags ?? []);
setContentWarning(contentWarning !== undefined);
@ -104,11 +107,16 @@ export function StreamEditor({ ev, onFinish, options }: StreamEditorProps) {
.tag(["title", title])
.tag(["summary", summary])
.tag(["image", image])
.tag(["streaming", stream])
.tag(["status", status])
.tag(["starts", starts]);
if (status === StreamState.Live) {
eb.tag(["streaming", stream]);
}
if (status === StreamState.Ended) {
eb.tag(["ends", ends]);
if (recording) {
eb.tag(["recording", recording]);
}
}
for (const tx of tags) {
eb.tag(["t", tx.trim()]);
@ -218,6 +226,16 @@ export function StreamEditor({ ev, onFinish, options }: StreamEditorProps) {
</div>
</div>
)}
{status === StreamState.Ended && (
<div>
<p>
<FormattedMessage defaultMessage="Recording URL" id="Y0DXJb" />
</p>
<div className="paper">
<input type="text" value={recording} onChange={e => setRecording(e.target.value)} />
</div>
</div>
)}
</>
)}
{(options?.canSetTags ?? true) && (

View File

@ -311,6 +311,9 @@
"XgWvGA": {
"defaultMessage": "Reactions"
},
"Y0DXJb": {
"defaultMessage": "Recording URL"
},
"YPh5Nq": {
"defaultMessage": "@ {rate}",
"description": "Showing zap amount in USD @ rate"

View File

@ -103,6 +103,7 @@
"W9355R": "Unmute",
"X2PZ7D": "Create Goal",
"XgWvGA": "Reactions",
"Y0DXJb": "Recording URL",
"YPh5Nq": "@ {rate}",
"YagVIe": "{n}p",
"YwzT/0": "Clip title",

View File

@ -30,6 +30,7 @@ export default defineConfig({
],
build: {
outDir: "build",
sourcemap: true,
},
clearScreen: false,
resolve: {