Log in

View Full Version : YouTube playlist embed question



mlegg
11-05-2011, 12:03 AM
On this page I want to embed a YouTube player with a playlist of all the videos for the site. http://www.pscompetitiveedge.com/videos.html

http://i42.tinypic.com/nb5f2s.png

If you click on the button that is highlighted red (on the bottom to the far right next to the YouTube logo) it pops up the videos on your playlist with left and right scroll bars to view more.

What I would like to do is really have the one main player and below have thumbnail versions of the other videos. So when you click one of the thumbnails that the video loads in the YouTube Player.


The reason I chose YouTube is so that these videos are seen on any browser and system, including tablets and smart phones. The orginal web guy for this site had only Flash videos, and the owner didn't like that he wasn't able to see his site on his iPad. :rolleyes:

The player is in an iframe (from the embed code on YouTube). Are there any extra parameters to add to do what I am asking?

<iframe src="http://www.youtube.com/embed/videoseries?list=PLC2A07613BF0ACEAA&amp;hl=en_US&amp;version=3" allowfullscreen="" frameborder="0" height="437" width="800"></iframe>

molendijk
11-05-2011, 05:05 PM
Do you want to activate the videos by clicking on one of the thumbnails that appear when you click on the highlighted button?
Or do you simpy want to activate a given video by clicking on a link (= a thumbnail) that has been put anywhere on the screen?
In the first case, you'll have to create very large playlists.
In the second case, you'll have to create a javascript function doing the job. Here (http://classical-music.tk)'s an example (without thumbnails, but the text-links could be replaced with thumbnail-links).
Arie Molendijk.
===

mlegg
11-05-2011, 06:23 PM
I would like it so that under the main YouTube player would be a scrolling images list with the small videos rather than the list being on the player. See Photoshopped image below.

http://i39.tinypic.com/2hnvtcg.jpg

molendijk
11-05-2011, 08:22 PM
Experiment with this (replace the text-links with your thumbnail-links):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>
</head>

<body style="font-family: verdana; font-size:12px" onload="document.getElementById('smooth_transition').style.display='none'">

<div style="position: relative; margin-left: 8%; text-align: center"></div>

<!-- VIDEO CONTAINER. Just an example of loading / replacing videos without flicker in IE. Document.write the iframes if you want validation for a strict doctype -->
<div id="video" style="position: absolute; left:45px; top: 40px; right: 45px; bottom: 70px; border:1px solid black">
<iframe name="my_music" src="http://www.youtube.com/embed/JkQS1MIplKI?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width: 100%; height: 100%; background: black" frameborder="0"></iframe>

<!--[if IE]>
<iframe id="smooth_transition" src="http://www.youtube.com/apiplayer" style="position: absolute; width: 100%; height: 100%; overflow: hidden"></iframe>
<![endif]-->
<!--[if !IE]><!-->
<div id="smooth_transition"></div>
<!--<![endif]-->
<!-- iframe shim -->
<div id="click_to_start">
</div>
</div>

<!-- PLAYLISTS -->
<div id="playlist" style="position: absolute; bottom: 10px; width:596px; height:40px;left:50%; margin-left:-348px; overflow: auto; background: silver; border: 1px solid black">
<div style="margin-left: 10px; margin-top:10px; margin-right: 10px">
<a style="cursor: pointer" onclick="frames['my_music'].location.replace('about:blank'); document.getElementById('click_to_start').style.display='block'; document.getElementById('smooth_transition').style.display='block'">Stop video</a> &nbsp;&nbsp;
<a style="cursor: pointer" onmousedown="document.getElementById('click_to_start').style.display='none'; frames['my_music'].location.replace('http://www.youtube.com/embed/JkQS1MIplKI?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');document.getElementById('smooth_transition').style.display='block';" onmouseup="setTimeout('document.getElementById(\'smooth_transition\').style.display=\'none\'',500)">Greetings Intro</a>&nbsp;&nbsp;&nbsp;

<a style="cursor: pointer" onmousedown="document.getElementById('click_to_start').style.display='none'; frames['my_music'].location.replace('http://www.youtube.com/embed/sYLDzO1IY-8?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');document.getElementById('smooth_transition').style.display='block';" onmouseup="setTimeout('document.getElementById(\'smooth_transition\').style.display=\'none\'',500)">Competitive Edge</a>&nbsp;&nbsp;&nbsp;

<a style="cursor: pointer" onmousedown="document.getElementById('click_to_start').style.display='none'; frames['my_music'].location.replace('http://www.youtube.com/embed/CE022-_h_YU?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');document.getElementById('smooth_transition').style.display='block';" onmouseup="setTimeout('document.getElementById(\'smooth_transition\').style.display=\'none\'',500)">Competitive Edge</a>&nbsp;&nbsp;&nbsp;

<a style="cursor: pointer" onmousedown="document.getElementById('click_to_start').style.display='none'; frames['my_music'].location.replace('http://www.youtube.com/embed/3Z7C-tuvsKY?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');document.getElementById('smooth_transition').style.display='block';" onmouseup="setTimeout('document.getElementById(\'smooth_transition\').style.display=\'none\'',500)">Competitive Edge</a>&nbsp;&nbsp;&nbsp;

</div>
</div>
</body>

</html>

mlegg
11-06-2011, 02:37 AM
Is there a way to take that a step further? Rather than the video name being a link? Can it make small thumbnails or previews of the videos to choose from?
thanks

molendijk
11-06-2011, 11:27 AM
See this (http://www.reelseo.com/youtube-thumbnail-image/) for getting thumbnail-links instead of using text-links.
Arie.

molendijk
11-06-2011, 02:34 PM
Just to be sure you understand what I mean, I made an example page for you. The images don't scroll, but there are examples for it on DynamicDrive, I guess. Here's the page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>

<style type="text/css">
.video_position_size {position: absolute; left:120px; top: 70px; right: 120px; bottom: 70px; border:1px solid black}
</style>


<script type="text/javascript">
function load_video(which)
{
frames['my_videos'].location.replace('http://www.youtube.com/embed/'+which+'?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');document.getElementById('smooth_transition').style.display='block'; setTimeout("document.getElementById('smooth_transition').style.display='none'",500)
}
</script>

</head>

<body style="font-family: verdana; font-size:12px" >

<!-- VIDEO CONTAINER. Just an example of loading / replacing videos without flicker in IE. Document.write the iframes if you want validation for a strict doctype -->
<div class="video_position_size">
<iframe name="my_videos" src="http://www.youtube.com/embed/JkQS1MIplKI?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width: 100%; height: 100%; background: black" frameborder="0"></iframe>
</div>



<!-- Smooth transition -->
<!--[if IE]>
<div class="video_position_size">
<iframe id="smooth_transition" src="http://www.youtube.com/apiplayer?version=3&video_id" style="position: absolute; width: 100%; height: 100%; overflow: hidden; display: none"></iframe>
</div>
<![endif]-->
<!--[if !IE]><!-->
<div id="smooth_transition"></div>
<!--<![endif]-->


<!-- PLAYLISTS -->
<div style="position: absolute; bottom: 0px; width:460px; left:50%; margin-left:-230px; overflow: auto; border: 0px solid red; padding-left: 10px">

<a style="position: relative; cursor: pointer; top: -25px; padding: 5px; background: black; color: white" onclick="frames['my_videos'].location.replace('about:blank'); document.getElementById('smooth_transition').style.display='block'">Stop video</a> &nbsp;&nbsp;

<a onclick="load_video('JkQS1MIplKI')"><img src="http://img.youtube.com/vi/JkQS1MIplKI/1.jpg" height="60" title="competitive 1" alt="" style="cursor: pointer"></a>&nbsp;

<a onclick="load_video('sYLDzO1IY-8')"><img src="http://img.youtube.com/vi/sYLDzO1IY-8/1.jpg" height="60" title="competitive 2" alt="" style="cursor: pointer"></a>&nbsp;

<a onclick="load_video('CE022-_h_YU')"><img src="http://img.youtube.com/vi/CE022-_h_YU/1.jpg" height="60" title="competitive 3" alt="" style="cursor: pointer"></a>&nbsp;

<a onclick="load_video('3Z7C-tuvsKY')"><img src="http://img.youtube.com/vi/3Z7C-tuvsKY/1.jpg" height="60" title="competitive 4" alt="" style="cursor: pointer"></a>&nbsp;

</div>

</body>

</html>
Arie.

mlegg
11-06-2011, 03:27 PM
Yes that's what I've been racking my head trying to do. So let's say I put 10 videos in there, does that little preview box under the video get larger?

thanks

molendijk
11-06-2011, 06:11 PM
Not necessarily. If you want the div containing the thumbnails to have a fixed width, you must make it scrollable, like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title></title>

<style type="text/css">
.video_position_size {position: absolute; left:120px; top: 90px; right: 120px; bottom: 90px; border:1px solid black}
</style>


<script type="text/javascript">
function load_video(which)
{
frames['my_videos'].location.replace('http://www.youtube.com/embed/'+which+'?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');document.getElementById('smooth_transition').style.display='block'; setTimeout("document.getElementById('smooth_transition').style.display='none'",500)
}
</script>

</head>

<body style="font-family: verdana; font-size:12px" >

<!-- VIDEO CONTAINER. Just an example of loading / replacing videos without flicker in IE. Document.write the iframes if you want validation for a strict doctype -->
<div class="video_position_size">
<iframe name="my_videos" src="http://www.youtube.com/embed/JkQS1MIplKI?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width: 100%; height: 100%; background: black" frameborder="0"></iframe>
</div>



<!-- Smooth transition -->
<!--[if IE]>
<div class="video_position_size">
<iframe id="smooth_transition" src="http://www.youtube.com/apiplayer?version=3&video_id" style="position: absolute; width: 100%; height: 100%; overflow: hidden; display: none"></iframe>
</div>
<![endif]-->
<!--[if !IE]><!-->
<div id="smooth_transition"></div>
<!--<![endif]-->


<!-- Stop button -->
<div style="position: absolute; top: 1px; right: 1px;cursor: pointer; padding: 5px; background: black; color: white" onclick="frames['my_videos'].location.replace('about:blank'); document.getElementById('smooth_transition').style.display='block'">Stop video</div>


<!-- PLAYLIST -->

<!-- We have 4 thumbnails. Each thumbnail's width equals 80px. Suppose we only want to explicitly show 3 thumbnails. Then the width of the outermost div for the playlist must equal 3x80=240px. The width of the innermost div must ewqual 4x80=230px. -->

<div style="position: absolute;bottom: 5px;left: 50%; margin-left: -150px; width: 240px; overflow: auto; border:1px solid black">

<div style="width: 320px">

<a style="float: left" onclick="load_video('JkQS1MIplKI')"><img src="http://img.youtube.com/vi/JkQS1MIplKI/1.jpg" height="60" width="80" title="competitive 1" alt="" style="cursor: pointer"></a>

<a style="float: left" onclick="load_video('sYLDzO1IY-8')"><img src="http://img.youtube.com/vi/sYLDzO1IY-8/1.jpg" height="60" width="80" title="competitive 2" alt="" style="cursor: pointer"></a>

<a style="float: left" onclick="load_video('CE022-_h_YU')"><img src="http://img.youtube.com/vi/CE022-_h_YU/1.jpg" height="60" width="80" title="competitive 3" alt="" style="cursor: pointer"></a>

<a style="float:left" onclick="load_video('3Z7C-tuvsKY')"><img src="http://img.youtube.com/vi/3Z7C-tuvsKY/1.jpg" height="60" width="80" title="competitive 4" alt="" style="cursor: pointer"></a>

</div>

</div>

</body>

</html>
Play with it until you understand everything.
(Note: some of your videos have been deleted).
===
Arie.

Afsal
09-22-2012, 12:58 PM
I would like it so that under the main YouTube player would be a scrolling images list with the small videos rather than the list being on the player . . .


Here is the solution dear!


<iframe allowfullscreen="allowfullscreen" frameborder="0" height="315" src="http://www.youtube.com/embed/videoseries?list=PL6B3A5E1C22C42BA8&showinfo=1" width="560"></iframe>

bernie1227
09-24-2012, 06:42 AM
That is simply an Iframe to a video.

jscheuer1
09-24-2012, 06:56 AM
No it's not. It's a YouTube iframe embed. And look at the URL. It's an example of how to display an existing playlist starting at a certain video and displaying the others as thumbnail links, rather than for a single video. At least that's what it's supposed to be. Did you try it out? Remember, these things often have to be live to work properly. Worked for me.

bernie1227
09-24-2012, 07:15 AM
I did not have the recourses with me at the time to test it properly, so I went to the url. By just going to the URL, it appears to be just a fullscreen video, albiet embedded when used with an iframe.

genteel
09-26-2012, 05:49 AM
molendijk's code has been amazingly helpful for solving a problem I had with our player. I'm now wondering if you can help me take it a step further. What happens if I have multiple video players on one page? Is there any way to make Video 1A, Video 1B & Video 1C all play in Player 1, while Video 2A, Video 2B & Video 2C all play in Player 2? (And potentially up to 16 players in one blog.)

I'm a bit desperate for a response, as I need to post the second video player on the weekend, and I'm afraid it doesn't work as it is.
Thank you kindly!

(And P.S. Afsal's iframe embed videoseries+showinfo trick doesn't work on ipad/iphone.)

djr33
09-26-2012, 05:59 AM
(And P.S. Afsal's iframe embed videoseries+showinfo trick doesn't work on ipad/iphone.) Nothing will work on iOS for apple mobile devices. They don't have flash, so youtube and sites like it won't ever work, at all. The exception for youtube (but not other sites) is that iOS has a built-in app that allows you watch the videos; but all it does is uses the URL from the page and loads that video in the other app, without any modification possible from a website.
Or (since I haven't tried it) are you saying that the youtube app won't load the video using that solution? It's possible, since it's in an iframe. But you should be able to click on it. There would be a work around possible, depending on the details, such as, if nothing else, displaying a link to the video if the browser is iOS. (Possible, just a bit more work.)

genteel
09-26-2012, 06:08 AM
Or (since I haven't tried it) are you saying that the youtube app won't load the video using that solution?

I'm just saying that the youtube app on iOS won't load the playlist thumbnails along the bottom of the player, which was the whole goal of this post. It only looks like one video, and though it will continue into the rest of the playlist, there is no way to pick or choose which one you want to watch next... unlike molendijk's solution. So I didn't want anyone to be led astry by Afsal's easy fix, because it doesn't quite solve my nor the OP's problem.

djr33
09-26-2012, 06:20 AM
Right, but that's just inherent on iOS, so there's no point in trying to fix it (and there's no better solution possible). The options/solutions are for basically anything else (and especially computers, with potentially some limitations on other mobile devices too).

genteel
09-26-2012, 06:32 AM
Yes, that's right. I'm not trying to campaign for Apple and Adobe to kiss and make up... I'm really just trying to say that molendijk's solution DOES work on the iPad right there on the page without flicking over to the app. So back to my question (which seems to have been deleted?), is there any way to take molendijk's code and make it work for multiple players on the same page. For example, Player 1 would have Video 1A, Video 1B, & Video 1C in a "playlist" div beneath the iframe and Player 2 would have Video 2A, Video 2B, & Video 2C in a "playlist" beneath it.

djr33
09-26-2012, 06:45 AM
Your question's still there (just a couple posts back). And sorry, but I don't know the answer to that one. I just know something about how iOS works with flash. Hopefully someone else can answer it.

bernie1227
09-26-2012, 07:50 AM
I'm just saying that the youtube app on iOS won't load the playlist thumbnails along the bottom of the player, which was the whole goal of this post. It only looks like one video, and though it will continue into the rest of the playlist, there is no way to pick or choose which one you want to watch next... unlike molendijk's solution. So I didn't want anyone to be led astry by Afsal's easy fix, because it doesn't quite solve my nor the OP's problem.

That doesn't actually matter, ios6 is out, and there is no longer a built in YouTube app.


On the topic of flash on the iOS, the reason it was omitted from the software, is because Steve Jobs (RIP) saw that flash was dying, and wanted to basically lead apple away from that kind of path.

jscheuer1
09-26-2012, 09:23 AM
Generally any code that can put one thing on a web page can, if it doesn't already have a provision to do so be made to put multiple things of the same general thing on a web page. If the code doesn't already provide for that, it can take some work to make it do so.

For a quick fix, one can almost always make an iframe and put the second one on a separate page in the iframe, and so on for a third, fourth, etc., as many as are desired.

You never want to put too many videos on one page though, unless only the one that's playing is downloading and you have no more than one playing at first. That's regardless of whether or not the others are in iframes. The reason being that downloading a video is resource intensive.

genteel
09-26-2012, 09:39 AM
Generally any code that can put one thing on a web page can, if it doesn't already have a provision to do so be made to put multiple things of the same general thing on a web page. If the code doesn't already provide for that, it can take some work to make it do so.

Well, that is what I need help with specifically. Has anyone read the original post and the code presented by molendijk? I took a chance reaching out for a little help, and I feel like people are just posting hypothetical answers to questions I'm not asking. This all has to do with making a playlist for youtube videos. I'm not going to be downloading 16 videos at once. I just want to have two separate players with two separate playlists, as per the code on page 1... neither of which will autoplay. I'm obviously not a coder; I'm just trying to help a client put some of their videos on a website.

jscheuer1
09-26-2012, 09:45 AM
I'd say use an iframe like I mentioned in the second part of my post.

bernie1227
09-26-2012, 10:25 AM
here (http://www.w3schools.com/tags/tag_iframe.asp) is a quick tutorial on iframes.

molendijk
09-26-2012, 12:29 PM
I just want to have two separate players with two separate playlists, as per the code on page 1... neither of which will autoplay. I'm obviously not a coder; I'm just trying to help a client put some of their videos on a website.
I'll try to create it after work (it's 14:30 right now here).
Arie.

molendijk
09-26-2012, 09:42 PM
OK, I got it working. It took me longer than I'd thought. First view the demo HERE (http://mesdomaines.nu/playlists/youtube_player.html). I hope this is what you want.
Here are the files, except for playlist3.html. I'll post it separately because the message will be too long otherwise.

youtube_player.html (the main page):

<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Multiple playlists with thumbnails</title>
<style>
a{color: white; text-decoration: none}
</style>
<body style="background: black; color: white; font-family: verdana; font-size: 12px; overflow: hidden">
<div style="position: absolute; left: 0px; top:10px; right: 0px; text-align: center">
<a href="javascript: void(0)" onclick="frames.youtube.location.replace('playlist1.html')">Playlist 1</a>
<a href="javascript: void(0)" onclick="frames.youtube.location.replace('playlist2.html')">Playlist 2</a>
<a href="javascript: void(0)" onclick="frames.youtube.location.replace('playlist3.html')">Playlist 3</a>
</div>
<div style="position: absolute; left: -2px; top: 40px; right: 0px; bottom: 0px">
<iframe name="youtube" style="position: absolute; width:100%; height: 100%; background: black" src="go_to_playlists.html" frameborder="0"></iframe>
</div>
</body>
</html>

playlist1.html:

<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<script type="text/javascript">
function load_video(which)
{
frames['my_videos'].location.replace('http://www.youtube.com/embed/'+which+'?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');
}
</script>
</head>
<body style="font-family: verdana; font-size:12px; background: black" onload="if(top.location==document.URL){window.location.replace('youtube_player.html')}"><div>
<!-- VIDEO CONTAINER. Just an example of loading / replacing videos without flicker in IE. Document.write the iframes if you want validation for a strict doctype -->
<div style="position: absolute; left:120px; top: 20px; right: 120px; bottom: 110px; border: 1px solid white">
<iframe name="my_videos" src="http://www.youtube.com/embed/ZRfWU-ZpLZ8?rel=0&amp;autoplay=0&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width: 100%; height: 100%; background: black" frameborder="0" allowTransparency onload="document.getElementById('smooth_transition').style.visibility='hidden'"></iframe>
</div>
<div style="position: absolute; left:120px; top: 2px; background:black; color: white">Playlist 1: Ancient Times</div>
<!-- smooth transition -->
<div id="smooth_transition" style="position: absolute; left:120px; top: 20px; right: 120px; bottom: 110px; border:1px solid white; background:black; z-index:100; visibility: visible; "></div>
<!-- Stop button -->
<div style="position: absolute; top: -5px; right: 115px;cursor: pointer; padding: 5px; background: black; color: white" onclick="document.getElementById('smooth_transition').style.visibility='hidden'; frames['my_videos'].location.replace('go_to_playlists_or_thumbnails.html'); ">Stop video</div>
<!-- PLAYLIST -->
<!-- We have 4 thumbnails. Each thumbnail's width equals 80px. Suppose we only want to explicitly show 3 thumbnails. Then the width of the outermost div for the playlist must equal 3x80=240px. The width of the innermost div must ewqual 4x80=230px. -->
<div style="position: absolute;bottom: 5px;left: 50%; margin-left: -150px; width: 240px; overflow-x: auto; overflow-y: hidden; border:1px solid gray; ">
<div style="position:relative; width: 320px">
<a style="float: left" onclick="load_video('ZRfWU-ZpLZ8')"><img src="http://img.youtube.com/vi/ZRfWU-ZpLZ8/1.jpg" height="80" width="80" title="prehistoric 1" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
<a style="float: left" onclick="load_video('TUliLKSJ4bQ')"><img src="http://img.youtube.com/vi/TUliLKSJ4bQ/1.jpg" height="80" width="80" title="prehistoric 2" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
<a style="float: left" onclick="load_video('FUPca8xaIc4')"><img src="http://img.youtube.com/vi/FUPca8xaIc4/1.jpg" height="80" width="80" title="prehistoric 3" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
<a style="float:left" onclick="load_video('rIM1glECugU')"><img src="http://img.youtube.com/vi/rIM1glECugU/2.jpg" height="80" width="80" title="From earliest life to modern humans" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
</div>
</div>
</div></body>
</html>
playlist2.html:

<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<script type="text/javascript">
function load_video(which)
{
frames['my_videos'].location.replace('http://www.youtube.com/embed/'+which+'?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');
}
</script>
</head>
<body style="font-family: verdana; font-size:12px; background: black" onload="if(top.location==document.URL){window.location.replace('youtube_player.html')}"><div>
<!-- VIDEO CONTAINER. Just an example of loading / replacing videos without flicker in IE. Document.write the iframes if you want validation for a strict doctype -->
<div style="position: absolute; left:120px; top: 20px; right: 120px; bottom: 110px; border: 1px solid white">
<iframe name="my_videos" src="http://www.youtube.com/embed/PVSrH2pN2zw?rel=0&amp;autoplay=0&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width: 100%; height: 100%; background: black" frameborder="0" allowTransparency onload="document.getElementById('smooth_transition').style.visibility='hidden'"></iframe>
</div>
<div style="position: absolute; left:120px; top: 2px; background:black; color: white">Playlist 2: Music by Grieg</div>
<!-- smooth transition -->
<div id="smooth_transition" style="position: absolute; left:120px; top: 20px; right: 120px; bottom: 110px; border:1px solid white; background:black; z-index:100; visibility: visible; "></div>
<!-- Stop button -->
<div style="position: absolute; top: -5px; right: 115px;cursor: pointer; padding: 5px; background: black; color: white" onclick="document.getElementById('smooth_transition').style.visibility='hidden'; frames['my_videos'].location.replace('go_to_playlists_or_thumbnails.html'); ">Stop video</div>
<!-- PLAYLIST -->
<!-- We have 4 thumbnails. Each thumbnail's width equals 80px. Suppose we only want to explicitly show 3 thumbnails. Then the width of the outermost div for the playlist must equal 3x80=240px. The width of the innermost div must ewqual 4x80=230px. -->
<div style="position: absolute;bottom: 5px;left: 50%; margin-left: -150px; width: 240px; overflow-x: auto; overflow-y: hidden; border:1px solid gray; ">
<div style="position:relative; width: 320px">
<a style="float: left" onclick="load_video('PVSrH2pN2zw')"><img src="http://img.youtube.com/vi/PVSrH2pN2zw/1.jpg" height="80" width="80" title="Grieg: Two Elegiac Melodies" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
<a style="float: left" onclick="load_video('ax3tdHwqvvo')"><img src="http://img.youtube.com/vi/ax3tdHwqvvo/2.jpg" height="80" width="80" title="Grieg: Norwegian Dances" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
<a style="float: left" onclick="load_video('O0iLAmvZ1ZE')"><img src="http://img.youtube.com/vi/O0iLAmvZ1ZE/1.jpg" height="80" width="80" title="Grieg: Piano Concerto" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
<a style="float:left" onclick="load_video('bRrPVJxIyGg')"><img src="http://img.youtube.com/vi/bRrPVJxIyGg/2.jpg" height="80" width="80" title="Grieg: Holberg Suite - Rigaudon" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>
</div>
</div>
</div></body>
</html>

go_to_playlists.html:

<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
</head>
<body style="background: black; color: white; font-family: verdana; font-size: 12px" onload="if(top.location==document.URL){window.location.replace('youtube_player.html')}">
<div style="position: absolute; left: 49%; top: 50%; margin-left:-80px">
Choose a playlist (links on top)
</div>
</body>
</html>
go_to_playlists_or_thumbnails.html:

<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
</head>
<body style="background: black; color: white; font-family: verdana; font-size: 12px" onload="if(top.location==document.URL){window.location.replace('youtube_player.html')}">
<div style="position: absolute; left: 39%; top: 50%; margin-left:-2px;">
Choose a playlist (top) or a thumbnail (bottom)
</div>
</body>
</html>
If for some reason the visitor stumbles on a file other than the main page (youtube_player.html), he/she will be automatically redirected to the main page. So starting with playlist1.html, for instance, will not show this page 'in isolation'.
These pages should be tested online (live), as certain browsers may show a strange behavior if the pages are tested locally (on the hard disk).
I hope I didn't produce any typos. playlist3.html and explanations below.
Arie.

molendijk
09-26-2012, 09:49 PM
And here some explanation plus playlist3.html.
Explanations:
The easiest way to develop the multiple-playlists-thing from my earlier code turned out to be a multiple page solution: a separate page for each player with thumbnails. I made three pages: playlist1.html, playlist2.html and playlist3.html. They are almost identical except for the videos and some text at the top. We could make more pages, of course.
These pages load in an iframe contained in a file called youtube_player.html. The iframe in this file (=youtube_player.html) doesn't only load playlist1.html, playlist2.html and playlist3.html, but also a file named go_to_playlists.html when we start, and a file called go_to_playlists_or_thumbnails.html when we stop a video (both files contain some info for the visitor).

Here's playlist3.html:

<!doctype html>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title></title>

<script type="text/javascript">
function load_video(which)
{
frames['my_videos'].location.replace('http://www.youtube.com/embed/'+which+'?rel=0&amp;autoplay=1&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1');
}
</script>

</head>

<body style="font-family: verdana; font-size:12px; background: black" onload="if(top.location==document.URL){window.location.replace('youtube_player.html')}"><div>

<!-- VIDEO CONTAINER. Just an example of loading / replacing videos without flicker in IE. Document.write the iframes if you want validation for a strict doctype -->
<div style="position: absolute; left:120px; top: 20px; right: 120px; bottom: 110px; border: 1px solid white">
<iframe name="my_videos" src="http://www.youtube.com/embed/0bsldX6fFG0?rel=0&amp;autoplay=0&amp;showinfo=0&amp;start=0&amp;autohide=0&amp;modestbranding=1" style="position: absolute; width: 100%; height: 100%; background: black" frameborder="0" allowTransparency onload="document.getElementById('smooth_transition').style.visibility='hidden'"></iframe>
</div>

<div style="position: absolute; left:120px; top: 2px; background:black; color: white">Playlist 3: Jazz. Plus: The Cougar Scene</div>

<!-- smooth transition -->
<div id="smooth_transition" style="position: absolute; left:120px; top: 20px; right: 120px; bottom: 110px; border:1px solid white; background:black; z-index:100; visibility: visible; "></div>

<!-- Stop button -->
<div style="position: absolute; top: -5px; right: 115px;cursor: pointer; padding: 5px; background: black; color: white" onclick="document.getElementById('smooth_transition').style.visibility='hidden'; frames['my_videos'].location.replace('go_to_playlists_or_thumbnails.html'); ">Stop video</div>


<!-- PLAYLIST -->

<!-- We have 4 thumbnails. Each thumbnail's width equals 80px. Suppose we only want to explicitly show 3 thumbnails. Then the width of the outermost div for the playlist must equal 3x80=240px. The width of the innermost div must ewqual 4x80=230px. -->

<div style="position: absolute;bottom: 5px;left: 50%; margin-left: -150px; width: 240px; overflow-x: auto; overflow-y: hidden; border:1px solid gray; ">

<div style="position:relative; width: 320px">

<a style="float: left" onclick="load_video('0bsldX6fFG0')"><img src="http://img.youtube.com/vi/0bsldX6fFG0/1.jpg" height="80" width="80" title="Previn plays Previn" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>

<a style="float: left" onclick="load_video('_iMuKMJmsrs')"><img src="http://img.youtube.com/vi/_iMuKMJmsrs/1.jpg" height="80" width="80" title="Kapustin: Intermezzo" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>

<a style="float: left" onclick="load_video('LB3VfxfBlnY')"><img src="http://img.youtube.com/vi/LB3VfxfBlnY/1.jpg" height="80" width="80" title="Garner: Mack the Knife" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>

<a style="float:left" onclick="load_video('TjLCJKoot4U')"><img src="http://img.youtube.com/vi/TjLCJKoot4U/3.jpg" height="80" width="80" title="The Cougar Scene" alt="" style="cursor: pointer; padding:0px; margin: 0px"></a>

</div>

</div>



</div></body>

</html>

molendijk
09-26-2012, 11:06 PM
You never want to put too many videos on one page though, unless only the one that's playing is downloading and you have no more than one playing at first. That's regardless of whether or not the others are in iframes. The reason being that downloading a video is resource intensive.
The unless part is important. I've a site (http://mesdomaines.nu/music/music.html) where the page contains hundreds (maybe thousands, I haven't counted) of videos without noticeable loading time. Videos should be loaded asynchronously and / onclick.
Arie.

djr33
09-26-2012, 11:28 PM
Hm... not to intentionally totally contradict you... but selecting a video on that page just crashed my firefox ;) (Technically it didn't crash; it just stalled out for about 3 minutes before I could click anything again. Then the video started to play.)

molendijk
09-26-2012, 11:37 PM
That must have been some strange accident. No problem here with visiting the page using Firefox. Does it happen every time you go to the page with FF? Note that FF sometimes does strange things, like telling me that it is alreadyb active (and thus not doing anything when I try to restart it) after I closed it. It sometimes happens independently of the question what page or site I want to visit.
Arie.

djr33
09-26-2012, 11:54 PM
I just tried again. Seems to do the same thing. I realize that if I closed everything I have open and restarted my computer (it seems a bit tired at the moment) it would probably work better, and FF does some strange things once in a while, but it's operating just fine on DD for the moment, for example, and on a few other sites. Youtube itself causes no such delay.

molendijk
09-27-2012, 12:20 AM
That's weird. It can't be the code (I think), since everything works fine here. Is anyone else experiencing this same problem, or does Daniel have to buy a new computer?
Arie.

molendijk
10-06-2012, 07:35 PM
What I made (see earlier post) was not exactly the thing genteel wanted (so she told me via email). But I think I got the solution know. I posted it in the Submit a DHTML or CSS code forum HERE (http://www.dynamicdrive.com/forums/showthread.php?71542-A-page-with-multiple-video-players-(youtube)-each-having-playlists-with-thumbnails).
Arie.