Skip to content

Embedding YouTube videos displays "Video unavailable" #46

@SKevo18

Description

@SKevo18

Bug Report

Current Behavior
Embedding YouTube videos will display a "Video unavailable" message:

Steps to Reproduce

  1. Paste a YouTube link in the post composer
  2. Publish the post

Expected Behavior
The video embed loads correctly

Screenshots
Image

Flarum core: 1.8.10
PHP version: 8.3.12
MySQL version: 11.4.3-MariaDB-ubu2204
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, intl, exif, mysqli, pdo_mysql, Phar, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, xmlreader, xmlwriter, xsl, zip, Zend OPcache
+-----------------------------------+--------------+--------+
| Flarum Extensions                 |              |        |
+-----------------------------------+--------------+--------+
| ID                                | Version      | Commit |
+-----------------------------------+--------------+--------+
| flarum-flags                      | v1.8.2       |        |
| flarum-tags                       | v1.8.4       |        |
| flarum-approval                   | v1.8.2       |        |
| flarum-markdown                   | v1.8.1       |        |
| flarum-mentions                   | v1.8.5       |        |
| flarum-subscriptions              | v1.8.1       |        |
| v17development-seo                | v2.0.7       |        |
| askvortsov-rich-text              | v2.1.7       |        |
| flarum-sticky                     | v1.8.2       |        |
| flarum-lock                       | v1.8.2       |        |
| fof-user-directory                | 1.4.0        |        |
| fof-follow-tags                   | 1.2.9        |        |
| yannisme-oxotheme                 | 2.1.8        |        |
| v17development-blog               | v0.8.0       |        |
| sycho-profile-cover               | v1.3.5       |        |
| rob006-last-post-avatar           | 1.2.4        |        |
| nearata-twofactor                 | v2.2.1       |        |
| migratetoflarum-canonical         | 1.0.0        |        |
| imdong-spam-alert                 | v0.0.1       |        |
| ianm-follow-users                 | 1.4.11       |        |
| fof-sitemap                       | 2.2.1        |        |
| fof-secure-https                  | 1.1.3        |        |
| fof-polls                         | 2.2.14       |        |
| fof-nightmode                     | 1.6.0        |        |
| fof-linguist                      | 1.1.5        |        |
| fof-ignore-users                  | 1.2.1        |        |
| fof-formatting                    | 1.1.0        |        |
| fof-cookie-consent                | 1.1.3        |        |
| fof-ban-ips                       | 1.1.2        |        |
| flarum-nicknames                  | v1.8.2       |        |
| flarum-lang-english               | v1.8.0       |        |
| flarum-lang-czech                 | v1.1.1       |        |
| flarum-bbcode                     | v1.8.0       |        |
| datlechin-link-preview            | v1.6.0       |        |
| clarkwinkelmann-status            | 1.0.0        |        |
| clarkwinkelmann-anonymous-posting | 1.1.1        |        |
| blomstra-gdpr                     | 1.0.0-beta.3 |        |
| askvortsov-markdown-tables        | v1.2.1       |        |
| antoinefr-bbcode-fa               | v1.1.0       |        |
+-----------------------------------+--------------+--------+
Queue driver: sync
Session driver: file
Scheduler status: Nikdy nespuštěno
Mail driver: mail
Debug mode: off

Possible solution(s)
Possible (but unverified) fix: add a referrerpolicy="no-referrer-when-downgrade" attribute to the <iframe> that is being rendered.

I observed that Lite YouTube Embed extension does display the thumbnail, but playing the video doesn't work.

Ref. post on support.freeflarum.com

From a quick Google search, it appears that YouTube suddenly dislikes when the reffererpolicy is set to "same-origin" (which is what Flarum uses by default) and refuses to display the video.

Update: I confirmed that it is indeed the Referrer header (or attribute) not being set to no-referrer-when-downgrade that makes YouTube block the video

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions