creceveur
asked on
Stop YouTube video auto-play onClick
I have a YouTube video that autorun's on a landing page. At the bottom of the page, I have another YouTube video that the user can click on to play. Upon clicking on the second video, I want the first one to stop playing so the two audio outputs don't mix and become indistinguishable. Is this possible? Thanks
ASKER
That would require a double-click to play the video - one to initialize the object, and another to play it. That would also require creation of my of thumbnails, correct?
Is there not any way to monitor for clicks, and then stop the first video? I found this code on the internet, but I don't understand Javascript enough to customize it to my page.
[code]function onClick(evt:MouseEvent):vo id {
myPlayer.myVid.stop();
gotoAndStop(evt.target.nam e.toString ());
}
project.addEventListener(M ouseEvent. CLICK, onClick);
anotherButton.addEventList ener(Mouse Event.CLIC K, onClick);[/code]
Is there not any way to monitor for clicks, and then stop the first video? I found this code on the internet, but I don't understand Javascript enough to customize it to my page.
[code]function onClick(evt:MouseEvent):vo
myPlayer.myVid.stop();
gotoAndStop(evt.target.nam
}
project.addEventListener(M
anotherButton.addEventList
ASKER
Also, that method would not show the current video playing, as it would load the other video's thumbnail, right?
The code I gave you will autoplay the top video as before if you cut and paste the object code you have into the div and script.
Yes you need a picture of the video or just a big play button the size of the video.
The code you pasted may or may not work depending on the plugin used to play the video.
Yes you need a picture of the video or just a big play button the size of the video.
The code you pasted may or may not work depending on the plugin used to play the video.
ASKER
The code I'm using for the video is (YouTube):
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/eQ8ZWMlObGE&hl=en"></param><param name="wmode" value="transparent"></para m><embed src="http://www.youtube.com/v/eQ8ZWMlObGE&hl=en" type="application/x-shockw ave-flash" wmode="transparent" width="425" height="344"></embed></obj ect>
Is there a way to make the onclick script I posted work?
Thanks
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/eQ8ZWMlObGE&hl=en"></param><param name="wmode" value="transparent"></para
Is there a way to make the onclick script I posted work?
Thanks
I think the code you show is to add functionality to a flash embedded clip.
ASKER
OK, this will work for me. Is it possible to grow the script to swap between 3 videos? Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Brilliant question brilliant reply
thanks all I spent days trying to get this done myself before checking here.
k
thanks all I spent days trying to get this done myself before checking here.
k
Open in new window