-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Video Embeds #5320
base: main
Are you sure you want to change the base?
Video Embeds #5320
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -454,6 +454,10 @@ func (srv *Server) WebPost(c echo.Context) error { | |
thumbUrls = append(thumbUrls, postView.Embed.EmbedRecordWithMedia_View.Media.EmbedImages_View.Images[i].Thumb) | ||
} | ||
data["imgThumbUrls"] = thumbUrls | ||
} else if postView.Embed.EmbedVideo_View != nil { | ||
data["width"] = postView.Embed.EmbedVideo_View.AspectRatio.Width | ||
data["height"] = postView.Embed.EmbedVideo_View.AspectRatio.Height | ||
data["videoUrl"] = fmt.Sprintf("https://%s/xrpc/com.atproto.sync.getBlob?did=did:plc:%s&cid=%s", srv.xrpcc.Host, did, postView.Embed.EmbedVideo_View.Cid) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is rather janky, but it should work, open to more real suggestions |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,11 @@ | |
|
||
{% block html_head_extra -%} | ||
{%- if postView -%} | ||
{%- if videoUrl %} | ||
<meta property="og:type" content="video.other"> | ||
{% else %} | ||
<meta property="og:type" content="article"> | ||
{% endif %} | ||
<meta property="profile:username" content="{{ profileView.Handle }}"> | ||
{%- if requestURI %} | ||
<meta property="og:url" content="{{ requestURI }}"> | ||
|
@@ -33,6 +37,15 @@ | |
{# Don't use avatar image in cards; usually looks bad #} | ||
<meta name="twitter:card" content="summary"> | ||
{% endif %} | ||
{%- if videoUrl %} | ||
<meta property="og:video:type" content="video/mp4"> | ||
<meta property="og:video:height" content="{{ height }}"> | ||
<meta property="og:video:width" content="{{ width }}"> | ||
<meta property="og:image:height" content="{{ height }}"> | ||
<meta property="og:image:width" content="{{ width }}"> | ||
Comment on lines
+44
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why both image and video? |
||
<meta property="og:video:secure_url" content="{{ videoUrl }}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see |
||
<meta property="og:video:url" content="{{ videoUrl }}"> | ||
{% endif %} | ||
<meta name="twitter:label1" content="Posted At"> | ||
<meta name="twitter:value1" content="{{ postView.IndexedAt }}"> | ||
<meta name="article:published_time" content="{{ postView.IndexedAt }}"> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefix all of these fields consistently, like
videoWidth