Thread viewer for Bluesky
at master 27 lines 755 B view raw
1<script lang="ts"> 2 import { getPostContext } from '../posts/PostComponent.svelte'; 3 import { InlineVideoEmbed, RawVideoEmbed } from '../../models/embeds'; 4 5 let { embed }: { embed: InlineVideoEmbed | RawVideoEmbed } = $props(); 6 let { post } = getPostContext(); 7 8 function videoURL(embed: InlineVideoEmbed | RawVideoEmbed) { 9 if (embed instanceof InlineVideoEmbed) { 10 return embed.playlistURL; 11 } else { 12 let cid = embed.video.ref['$link']; 13 return `https://video.bsky.app/watch/${post.author.did}/${cid}/playlist.m3u8`; 14 } 15 } 16</script> 17 18<div> 19 <p>[<a href={videoURL(embed)}>Video</a>]</p> 20 21 {#if embed.alt} 22 <details class="image-alt"> 23 <summary>Show alt</summary> 24 {embed.alt} 25 </details> 26 {/if} 27</div>