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

No longer works for youtube videos #5

Open
MarioDena opened this issue Nov 5, 2019 · 9 comments
Open

No longer works for youtube videos #5

MarioDena opened this issue Nov 5, 2019 · 9 comments

Comments

@MarioDena
Copy link

As of today with the default settings for github pages youtube videos break the markup.

@nathancy
Copy link
Owner

nathancy commented Nov 5, 2019

Could you provide more details and a minimum reproducible example? The embed Youtube video on the demo page seems to still be working

@MarioDena
Copy link
Author

MarioDena commented Nov 6, 2019

Hello, It does work as long as you don't insert any linked links. This problem is presented on both github pages and up-to-date jekyll.

If you use markdown to place linked links your links will be parsed as raw text.

EDIT: Haven't tested for inline style links

@xeTaiz
Copy link

xeTaiz commented Feb 19, 2020

I had an issue with the template containing the following:
src="..../embed/{{ include.id }}"
changing to
{{include.id}} without spaces solved my issue

@nathancy
Copy link
Owner

So the fix was changing

src="..../embed/{{ include.id }}"

to

src="..../embed/{{include.id}}"

Does anyone know a reason why that fixes it? If it seems to work, I'll patch it in

@inetbiz
Copy link

inetbiz commented Oct 29, 2020

What about CORS restrictions in chrome? Access to video at 'https://drive.google.com/file/d/1wDyOec7bTNsLnoPRsTzEmwTU1i6r4wb-/view' reduce-visual-assets-filesize.html:1 from origin 'https://denverprophit.us' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

htaccess

Header set Access-Control-Allow-Origin: *
Header set X-Frame-Options SAMEORIGIN
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always edit Set-Cookie (.*) "$1; SameSite=secure"
Header set Accept-Language: en-US,en;q=0.5
Header set Content-Language "en-US"
Header set Connection keep-alive
ServerSignature email
SetEnv TZ {{timezone}}
DefaultLanguage en-US
AddDefaultCharset UTF-8
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
SetEnv SERVER_ADMIN {{webmaster}}

Header Response

HTTP/1.1 200 OK =>
Date => Thu, 29 Oct 2020 18:14:04 GMT
Server => Apache
Referrer-Policy => strict-origin-when-cross-origin
Upgrade => h2,h2c
Connection => keep-alive, close
Last-Modified => Thu, 29 Oct 2020 17:57:14 GMT
Accept-Ranges => bytes
Content-Length => 19454
Cache-Control => max-age=600, private, must-revalidate
Expires => Sat, 28 Nov 2020 18:14:04 GMT
Vary => Accept-Encoding,User-Agent
Access-Control-Allow-Origin => *
Access-Control-Allow-Credentials => false
X-Frame-Options => SAMEORIGIN
Accept-Language => en-US,en;q=0.5
Content-Language => en-US
Content-Type => text/html; charset=UTF-8

Chrome Devtools

image

@nathancy
Copy link
Owner

Sorry I've never encountered that CORS error. My guess is that you haven't turned on link sharing for your Google drive video. Take a look at the embed Google Drive section.

@inetbiz
Copy link

inetbiz commented Oct 30, 2020

@nathancy had already done that.
image

@Matticusau
Copy link

In my case the issue seems to be that the id is not being carried forward into the generated HTML
image

This was because i was trying to pass the id directly in the include line but had not quoted the id. Such as {% include youtubePlayer.html id="XXXXXXXXXXXX" %}

@Penworks
Copy link

Update for new readers

This works for YouTube as of November 2023.

In case its relevant, if you have several videos on the same page you can use the following method

Front matter

youtubeId: xxxxxxxx
youtubeId1: xxxxxxxx
youtubeId2: xxxxxxxx

Embed include:

{% include youtubeplayer.html id=page.youtubeId %}
{% include youtubeplayer.html id=page.youtubeId1 %}
{% include youtubeplayer.html id=page.youtubeId2 %}

The above method can be used for Vimeo player too. I haven't tested other players/hosts.

  • In my opinion, using the page.youtubeId method is preferable to placing the Id in the include script.

  • Also, I did remove the whitespace around the embed Id code in youtubeplayer.md, but I'm not sure that made any difference.

  • FYI, you can use a href links in your page as well, it makes no difference to how this addon works.

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

No branches or pull requests

6 participants