-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: render embeds from link preview
closes #693
- Loading branch information
Showing
6 changed files
with
55 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useState } from "react"; | ||
|
||
import Icon from "../Icons/Icon"; | ||
import { ProxyImg } from "../ProxyImg"; | ||
|
||
export default function GenericPlayer({ url, poster }: { url: string; poster: string }) { | ||
const [play, setPlay] = useState(false); | ||
|
||
if (!play) { | ||
return ( | ||
<div | ||
className="relative aspect-video" | ||
onClick={e => { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
setPlay(true); | ||
}}> | ||
<ProxyImg className="absolute" src={poster} /> | ||
<div className="absolute w-full h-full opacity-0 hover:opacity-100 hover:bg-black/30 flex items-center justify-center transition"> | ||
<Icon name="play-square-outline" size={50} /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
return ( | ||
<iframe | ||
className="aspect-video w-full" | ||
src={url} | ||
frameBorder="0" | ||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
allowFullScreen={true} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters