feat: play stream with zap.stream embed
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Kieran 2024-01-22 11:32:50 +00:00
parent d1ebd49d56
commit 45fbd06bff
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
11 changed files with 35 additions and 12 deletions

View File

@ -6,6 +6,7 @@ const AppleMusicEmbed = ({ link }: { link: string }) => {
<iframe <iframe
allow="autoplay *; encrypted-media *; fullscreen *; clipboard-write" allow="autoplay *; encrypted-media *; fullscreen *; clipboard-write"
frameBorder="0" frameBorder="0"
// eslint-disable-next-line react/no-unknown-property
credentialless="" credentialless=""
height={isSongLink ? 175 : 450} height={isSongLink ? 175 : 450}
style={{ width: "100%", maxWidth: 660, overflow: "hidden", background: "transparent" }} style={{ width: "100%", maxWidth: 660, overflow: "hidden", background: "transparent" }}

View File

@ -47,6 +47,7 @@ export default function HyperText({ link, depth, showLinkPreview, children }: Hy
if (youtubeId) { if (youtubeId) {
return ( return (
<iframe <iframe
// eslint-disable-next-line react/no-unknown-property
credentialless="" credentialless=""
className="-mx-4 md:mx-0 w-max my-2" className="-mx-4 md:mx-0 w-max my-2"
src={`https://www.youtube.com/embed/${youtubeId}`} src={`https://www.youtube.com/embed/${youtubeId}`}

View File

@ -10,6 +10,7 @@ const MixCloudEmbed = ({ link }: { link: string }) => {
<> <>
<br /> <br />
<iframe <iframe
// eslint-disable-next-line react/no-unknown-property
credentialless="" credentialless=""
title="SoundCloud player" title="SoundCloud player"
width="100%" width="100%"

View File

@ -1,6 +1,7 @@
const SoundCloudEmbed = ({ link }: { link: string }) => { const SoundCloudEmbed = ({ link }: { link: string }) => {
return ( return (
<iframe <iframe
// eslint-disable-next-line react/no-unknown-property
credentialless="" credentialless=""
width="100%" width="100%"
height="166" height="166"

View File

@ -3,6 +3,7 @@ const SpotifyEmbed = ({ link }: { link: string }) => {
return ( return (
<iframe <iframe
// eslint-disable-next-line react/no-unknown-property
credentialless="" credentialless=""
style={{ borderRadius: 12 }} style={{ borderRadius: 12 }}
src={convertedUrl} src={convertedUrl}

View File

@ -46,12 +46,14 @@ const TidalEmbed = ({ link }: { link: string }) => {
.catch(console.error); .catch(console.error);
}, [link]); }, [link]);
if (!source) if (!source) {
return ( return (
<a href={link} target="_blank" rel="noreferrer" onClick={e => e.stopPropagation()} className="ext"> <a href={link} target="_blank" rel="noreferrer" onClick={e => e.stopPropagation()} className="ext">
{link} {link}
</a> </a>
); );
}
// eslint-disable-next-line react/no-unknown-property
return <iframe src={source} style={extraStyles} width="100%" title="TIDAL Embed" frameBorder={0} credentialless="" />; return <iframe src={source} style={extraStyles} width="100%" title="TIDAL Embed" frameBorder={0} credentialless="" />;
}; };

View File

@ -7,7 +7,9 @@ const TwitchEmbed = ({ link }: { link: string }) => {
src={`https://player.twitch.tv/${args}`} src={`https://player.twitch.tv/${args}`}
className="w-max" className="w-max"
allowFullScreen={true} allowFullScreen={true}
credentialless=""></iframe> // eslint-disable-next-line react/no-unknown-property
credentialless=""
/>
); );
}; };

View File

@ -3,6 +3,7 @@ const WavlakeEmbed = ({ link }: { link: string }) => {
return ( return (
<iframe <iframe
// eslint-disable-next-line react/no-unknown-property
credentialless="" credentialless=""
style={{ borderRadius: 12 }} style={{ borderRadius: 12 }}
src={convertedUrl} src={convertedUrl}

View File

@ -1,4 +1,5 @@
import { NostrEvent, NostrLink } from "@snort/system"; import { NostrEvent, NostrLink } from "@snort/system";
import { useState } from "react";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
@ -12,6 +13,7 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
const status = findTag(ev, "status"); const status = findTag(ev, "status");
const starts = Number(findTag(ev, "starts")); const starts = Number(findTag(ev, "starts"));
const host = ev.tags.find(a => a[0] === "p" && a[3] === "host")?.[1] ?? ev.pubkey; const host = ev.tags.find(a => a[0] === "p" && a[3] === "host")?.[1] ?? ev.pubkey;
const [play, setPlay] = useState(false);
function statusLine() { function statusLine() {
switch (status) { switch (status) {
@ -49,11 +51,9 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
switch (status) { switch (status) {
case "live": { case "live": {
return ( return (
<Link to={link} target="_blank"> <button className="nowrap" onClick={() => setPlay(true)}>
<button className="nowrap"> <FormattedMessage defaultMessage="Watch Stream" id="furjvW" />
<FormattedMessage defaultMessage="Join Stream" id="GQPtfk" /> </button>
</button>
</Link>
); );
} }
case "ended": { case "ended": {
@ -69,7 +69,20 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
} }
} }
} }
if (play) {
const link = `https://zap.stream/embed/${NostrLink.fromEvent(ev).encode()}`;
return (
<iframe
// eslint-disable-next-line react/no-unknown-property
credentialless=""
src={link}
width="100%"
style={{
aspectRatio: "16/9",
}}
/>
);
}
return ( return (
<div className="sm:flex g12 br p24 bg-primary items-center"> <div className="sm:flex g12 br p24 bg-primary items-center">
<div> <div>

View File

@ -539,9 +539,6 @@
"GL8aXW": { "GL8aXW": {
"defaultMessage": "Bookmarks ({n})" "defaultMessage": "Bookmarks ({n})"
}, },
"GQPtfk": {
"defaultMessage": "Join Stream"
},
"GSye7T": { "GSye7T": {
"defaultMessage": "Lightning Address" "defaultMessage": "Lightning Address"
}, },
@ -1256,6 +1253,9 @@
"fsB/4p": { "fsB/4p": {
"defaultMessage": "Saved" "defaultMessage": "Saved"
}, },
"furjvW": {
"defaultMessage": "Watch Stream"
},
"g5pX+a": { "g5pX+a": {
"defaultMessage": "About" "defaultMessage": "About"
}, },

View File

@ -178,7 +178,6 @@
"G3A56c": "Subscribed to Push", "G3A56c": "Subscribed to Push",
"GFOoEE": "Salt", "GFOoEE": "Salt",
"GL8aXW": "Bookmarks ({n})", "GL8aXW": "Bookmarks ({n})",
"GQPtfk": "Join Stream",
"GSye7T": "Lightning Address", "GSye7T": "Lightning Address",
"GUlSVG": "Claim your included Snort nostr address", "GUlSVG": "Claim your included Snort nostr address",
"Gcn9NQ": "Magnet Link", "Gcn9NQ": "Magnet Link",
@ -414,6 +413,7 @@
"flnGvv": "What's on your mind?", "flnGvv": "What's on your mind?",
"fqwcJ1": "On-chain Donation", "fqwcJ1": "On-chain Donation",
"fsB/4p": "Saved", "fsB/4p": "Saved",
"furjvW": "Watch Stream",
"g5pX+a": "About", "g5pX+a": "About",
"g985Wp": "Failed to send vote", "g985Wp": "Failed to send vote",
"gDzDRs": "Emoji to send when reactiong to a note", "gDzDRs": "Emoji to send when reactiong to a note",