Go Back   CodingForums.com > :: Client side development > Graphics and Multimedia discussions

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-01-2012, 09:49 PM   PM User | #1
Tim@DIM
New Coder

 
Join Date: Dec 2011
Location: Detroit
Posts: 62
Thanks: 17
Thanked 0 Times in 0 Posts
Tim@DIM is an unknown quantity at this point
Lightbulb Have Multiple Videos On One Page And Have Them Play Back In One Larger Player

I dont know if anyone has run into htis problem or is likely to,
but it something i needed to do so i figured id post it here for anyone who may find it interesting/ useful.

So for the video player functionality we have this div:

Code:
<div id='videoPlayback' style='width: 560px; height:315px; background-color: #000000;'><iframe src="http://player.vimeo.com/video/36788063?autoplay=1" width="560" height="315" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
which is controlled by this script:

Code:
<script type="text/javascript">
function playVideo(sourceId, targetId) {
   if (typeof(sourceId)=='string') {sourceId=document.getElementById(sourceId);}
   if (typeof(targetId)=='string') {targetId=document.getElementById(targetId);}
   targetId.innerHTML=sourceId.innerHTML;
   return false;
}
</script>
now to set which videos load in this div:

Code:
<div id='selectDemo1' class="not-here" style='display: none'>
	<iframe src="http://player.vimeo.com/video/30886424?" width="560" height="315" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
</div> 

<div id='selectDemo2' class="not-here" style='display: none'>
	<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/b7_Hvgzyr2o?version=3&autoplay=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/b7_Hvgzyr2o?version=3&autoplay=1&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</div>
Any number of videos can be used for this but you get the idea.

now to select the video to be watched currently in the playback div we use anchors:

Code:
<a href="#videoPlayback" onclick='return playVideo("selectDemo5","videoPlayback")'><img src="images/australia.png" width="240" height="135" /></a>
Tim@DIM is offline   Reply With Quote
Reply

Bookmarks

Tags
multiple videos, video embed, video playback, vimeo, youtube

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:41 AM.


Advertisement
Log in to turn off these ads.