DEV: Prevent videos from preloading metadata (#23807)

Preloading just metadata is not always respected by browsers, and
sometimes the whole video will be downloaded. This switches to using a
placeholder image for the video and only loads the video when the play
button is clicked.
This commit is contained in:
Blake Erickson
2023-10-12 13:47:48 -06:00
committed by GitHub
parent 460e702887
commit 2443446e62
11 changed files with 215 additions and 70 deletions

View File

@@ -48,7 +48,7 @@ RSpec.describe "hotlinked media blocking" do
post = Fabricate(:post, raw: "![alt text|video](#{hotlinked_url})")
expect(post.cooked).not_to have_tag("video source[src]")
expect(post.cooked).to have_tag(
"video source",
"div",
with: {
PrettyText::BLOCKED_HOTLINKED_SRC_ATTR => hotlinked_url,
},