Zen Cart Logo
Forums / General Questions / Embedding YouTube videos on Product pages

Embedding YouTube videos on Product pages

Views: 6,316

Results 21 to 25 of 25
2 Mar 2022, 1:24 PM
#21
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,873
Plugin Contributions:
7

Embedding YouTube videos on Product pages

Perplexed by the difficulties people seem to face with the issue of embedding videos, I have posted my own long-used solution on GitHub.

Here is a link direct to the readme:

https://github.com/torvista/Zen_Cart-Embed_YouTube_videos/blob/main/files/includes/templates/shared/youtube/youtube_readme.txt

Any problems: post in GitHub.

22 Nov 2022, 8:02 PM
#22
cdickinson66 avatar

cdickinson66

New Zenner

Join Date:
Feb 2012
Posts:
8
Plugin Contributions:
0

Re: Embedding YouTube videos on Product pages

@torvista

Thanks for the script. I put it into my site correctly and it is working for me.
However do you know how to modify the player to accept a Playlist instead of a single video?

Thanks

22 Nov 2022, 9:42 PM
#23
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,873
Plugin Contributions:
7

Re: Embedding YouTube videos on Product pages

As far as I am aware if you navigate from the youtube video owner mainpage and choose playlist to get to the video, the v= link will be of the playlist instead of a single video, so use that.

22 Nov 2022, 11:25 PM
#24
cdickinson66 avatar

cdickinson66

New Zenner

Join Date:
Feb 2012
Posts:
8
Plugin Contributions:
0

Re: Embedding YouTube videos on Product pages

Thanks for replying .
I dont think I understand where to edit what you mentioned.

I tried to follow the instructions here:
https://developers.google.com/youtube/player_parameters

change
https://www.youtube.com/embed/VIDEO_ID
to
https://www.youtube.com/embed?listType=playlist&list=PLAYLIST_ID

By editing your script youtube_tn.js

The line

iframe.setAttribute("src", "//www.youtube.com/embed/"
to
iframe.setAttribute("src", "//www.youtube.com/embed?listType=playlist&list="

But that did not work for me.

23 Nov 2022, 9:56 AM
#25
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,873
Plugin Contributions:
7

Re: Embedding YouTube videos on Product pages

Sorry, it was too early in the morning....so after morning chores:

Single video:

<div class="youtube-container">
<p>Cat Video</p>
<div class="youtube-player" data-yt_id="abc123abc123">
</div>
</div>

Video as part of playlist:

<div class="youtube-container">
<p>Cat Videos - Playlist</p>
<div class="youtube-player" data-yt_id="abc123abc123" data-yt_params="list=xyz123xyz123xyz123xyz123xyz123xyz123">
</div>
</div>