Render YouTube iframe for applicable video embeds (#607)

pull/613/head
quentinmay 3 years ago committed by GitHub
parent 950625e671
commit 4b1c9660be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -458,6 +458,10 @@ img {
border-radius: 3px;
}
.chatlog__embed-youtube-container {
margin-top: 0.6em;
}
.chatlog__embed-image-container {
margin-top: 0.6em;
}

@ -214,8 +214,19 @@
}
</div>
}
@if (!string.IsNullOrWhiteSpace(embed.Url) && embed.Url.IndexOf("youtube.com/watch?v=") != -1)
{
@if (!string.IsNullOrWhiteSpace(embed.Description))
if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
{
<div class="chatlog__embed-youtube-container">
<iframe class="chatlog__embed-youtube" width="400" height="225" frameBorder="0" style="border-radius: 5px"
src="@embed.Url.Replace("/watch?v=", "/embed/")">
</iframe>
</div>
}
}
else if (!string.IsNullOrWhiteSpace(embed.Description))
{
<div class="chatlog__embed-description">
<div class="markdown preserve-whitespace">@Raw(FormatEmbedMarkdown(embed.Description))</div>
@ -250,6 +261,8 @@
</div>
@if (embed.Thumbnail is not null && !string.IsNullOrWhiteSpace(embed.Thumbnail.Url))
{
if (string.IsNullOrWhiteSpace(embed.Url) || embed.Url.IndexOf("youtube.com/watch?v=") == -1)
{
<div class="chatlog__embed-thumbnail-container">
<a class="chatlog__embed-thumbnail-link" href="@await ResolveUrlAsync(embed.Thumbnail.ProxyUrl ?? embed.Thumbnail.Url)">
@ -257,6 +270,7 @@
</a>
</div>
}
}
</div>
@if (embed.Image is not null && !string.IsNullOrWhiteSpace(embed.Image.Url))

Loading…
Cancel
Save