forked from Kieran/zap.stream
Show video poster
This commit is contained in:
parent
870cdbc2f4
commit
b4f18ba230
@ -10,6 +10,14 @@ export function LiveVideoPlayer(props: HTMLProps<HTMLVideoElement> & { stream?:
|
||||
const hls = new Hls();
|
||||
hls.loadSource(streamCached);
|
||||
hls.attachMedia(video.current);
|
||||
hls.on(Hls.Events.ERROR, (event, data) => {
|
||||
console.debug(event, data);
|
||||
const errorType = data.type;
|
||||
if(errorType === Hls.ErrorTypes.NETWORK_ERROR) {
|
||||
hls.stopLoad();
|
||||
hls.detachMedia();
|
||||
}
|
||||
})
|
||||
return () => hls.destroy();
|
||||
}
|
||||
}, [video, streamCached]);
|
||||
|
@ -29,6 +29,7 @@ export function StreamPage() {
|
||||
|
||||
const stream = findTag(thisEvent.data, "streaming");
|
||||
const status = findTag(thisEvent.data, "status");
|
||||
const image = findTag(thisEvent.data, "image");
|
||||
const isLive = status === "live";
|
||||
const isMine = link.author === login?.pubkey;
|
||||
const zapTarget = profile?.lud16 ?? profile?.lud06;
|
||||
@ -46,7 +47,7 @@ export function StreamPage() {
|
||||
return (
|
||||
<div className="live-page">
|
||||
<div>
|
||||
<LiveVideoPlayer stream={stream} autoPlay={true} />
|
||||
<LiveVideoPlayer stream={stream} autoPlay={true} poster={image} />
|
||||
<div className="flex info">
|
||||
<div className="f-grow">
|
||||
<h1>{findTag(thisEvent.data, "title")}</h1>
|
||||
|
Loading…
Reference in New Issue
Block a user