Youtube video autoplay and mute

Permalink
I'm trying to create a video gallery of youtube videos and was wondering if anyone knew how I could set up a grid of youtube video thumbnails that would auto-play on mute until the user clicks on one at which point the video would start over from the beginning with the sound on.

Pretty much the exact same way Facebook handles videos. They autoplay on mute for a teaser and if you click on them they start over with sound.

This is the page it would be forhttp://www.agenity.com/what-we-do/video-production/.... Ultimately I'd like to have the top video play on auto-play with sound and have several of the ones below it be playing on mute until you click on them to give a max headroom type effect.

Let me know if anyone can help with this.

Thanks..

getjoel
 
ob7dev replied on at Permalink Reply
ob7dev
For just one video, something like this:
<div id="player"></div>
<script>
 // 2. This code loads the IFrame Player API code asynchronously.
 var tag = document.createElement('script');
 tag.src = "https://www.youtube.com/iframe_api";
 var firstScriptTag = document.getElementsByTagName('script')[0];
 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
 // 3. This function creates an <iframe> (and YouTube player)
 //    after the API code downloads.
 var player;
 function onYouTubeIframeAPIReady() {
     player = new YT.Player('player', {
         height: '300',
         width: '400',
         videoId: 'WFAMJf6vBz8',


Check out the iframe api for youtube:
https://developers.google.com/youtube/iframe_api_reference....

That code is from an example I found, but I added the event listeners in the onPlayerReady function. From there you can add the mouseover and mouseout event listeners and target the youtube player.

To do multiple videos you need to turn this into an array.
It would also be worth writing some code that faded the volume instead of cutting it off immediately.

The last part of the code (part 5) is part of the original code example I found, its not specific to what you are trying to do.

Here's where I found the original snippet:
https://productforums.google.com/forum/#!topic/youtube/XS5_P_9OXCo...
getjoel replied on at Permalink Reply
getjoel
Would you be interested in doing it for me? If so, how much?
PM me if you want.
ob7dev replied on at Permalink Reply
ob7dev
Sure it would be a fun project I'll PM you.
sk01 replied on at Permalink Reply
sk01
something likehttp://www.speedcopter.com/ but with one bigger autoplay video on top?
getjoel replied on at Permalink Reply
getjoel
Am I missing something or are the thumbnails on this page not playing video? I'm looking to have the thumbnails all playing the respective videos on mute.. and then when someone clicks on them have them start over with full sound the same way videos work on Facebook.
sk01 replied on at Permalink Reply
sk01
what youtube do you use? :D
the one I visit just displays thumbnails of the videos.
having appx 40 videos playing simultaneously is a bit overkill, isn't it?