Skip to content

Commit 0daa7c1

Browse files
add player embed
1 parent 138826f commit 0daa7c1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/routes/status.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ proc createStatusRouter*(cfg: Config) =
4646
video = ""
4747

4848
if conv.tweet.video.isSome():
49-
images = @[get(conv.tweet.video).thumb]
50-
video = getVideoEmbed(cfg, conv.tweet.id)
49+
let vid = get(conv.tweet.video)
50+
images = @[vid.thumb]
51+
let vids = vid.variants.filterIt(it.contentType == VideoType.mp4)
52+
video = getVidUrl(vids[0].url)
5153
elif conv.tweet.gif.isSome():
5254
images = @[get(conv.tweet.gif).thumb]
5355
video = getPicUrl(get(conv.tweet.gif).url)

src/views/general.nim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,17 @@ proc renderHead*(prefs: Prefs; cfg: Config; req: Request; titleText=""; desc="";
109109

110110
if rss.len > 0:
111111
meta(property="twitter:card", content="summary")
112+
elif video.len > 0:
113+
meta(property="twitter:card", content="player")
112114
else:
113115
meta(property="twitter:card", content="summary_large_image")
114116

115117
if video.len > 0:
116118
meta(property="og:video:url", content=video)
117119
meta(property="og:video:secure_url", content=video)
118-
meta(property="og:video:type", content="text/html")
120+
meta(property="og:video:type", content="video/mp4")
121+
meta(name="twitter:player:stream", content=video)
122+
meta(name="twitter:player:stream:content_type", content="video/mp4")
119123

120124
# this is last so images are also preloaded
121125
# if this is done earlier, Chrome only preloads one image for some reason

0 commit comments

Comments
 (0)