Skip to content
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

Allow embedding videos in local HTML files #4450

Conversation

tomasz1986
Copy link
Contributor

routes: Allow embedding videos in local HTML files (fixes #4448)

The current Content Security Policy does not allow to embed videos
inside local HTML files which are viewed in the browser via the file
protocol. This commit adds the file protocol to the allowed frame
ancestors, so that the embedded videos load correctly in local HTML
files.

This behaviour is consistent which how the official YouTube website
allows to embed videos from itself.

Signed-off-by: Tomasz Wilczyński twilczynski@naver.com

The current Content Security Policy does not allow to embed videos
inside local HTML files which are viewed in the browser via the file
protocol. This commit adds the file protocol to the allowed frame
ancestors, so that the embedded videos load correctly in local HTML
files.

This behaviour is consistent which how the official YouTube website
allows to embed videos from itself.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
@tomasz1986 tomasz1986 requested a review from a team as a code owner February 24, 2024 19:20
@tomasz1986 tomasz1986 requested review from syeopite and removed request for a team February 24, 2024 19:20
Copy link
Member

@SamantazFox SamantazFox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

@SamantazFox SamantazFox added the need-testing This feature needs to be deployed and tested to see if it's working, and doesn't break something label Mar 10, 2024
@SamantazFox SamantazFox added in-testing This feature has been deployed and is being tested and removed need-testing This feature needs to be deployed and tested to see if it's working, and doesn't break something labels May 13, 2024
@SamantazFox
Copy link
Member

SamantazFox commented Jun 15, 2024

test case used:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
<body>
  <div>
    <!-- Test 1: instance without this patch = does not load -->
    <iframe id='ivplayer' width='640' height='360' src='https://{domainA}/embed/n3vQbR1GhmA?quality=dash'></iframe>

    <!-- Test 2: instance with this patch applied = loads as expected -->
    <iframe id='ivplayer' width='640' height='360' src='https://{domainB}/embed/n3vQbR1GhmA?quality=dash'></iframe>
  </div>
</body>
</html>

@SamantazFox SamantazFox added ready and removed in-testing This feature has been deployed and is being tested labels Jun 15, 2024
@SamantazFox SamantazFox changed the title routes: Allow embedding videos in local HTML files (fixes #4448) Allow embedding videos in local HTML files Jul 10, 2024
@SamantazFox SamantazFox merged commit 5e0f553 into iv-org:master Jul 10, 2024
7 checks passed
@SamantazFox
Copy link
Member

Thanks for your contribution :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Content Security Policy violation when trying to embed in a local HTML file
2 participants