2

hi i have a webpage which allows users to enter the youtube video and embeds and shows it( a bit of url manupilation to get video id and link an iframe src=youtube.com/embed/videoid -not the point here)....the video shows up nicely with my preferences of height and width. how do i know if the user clicked on the youtube video to watch it...i basically want it to expand the video area when the user clicks on the video so he can get a better and bigger view...thanks btw im doing this as a front end jscript/jquery project thing so asp.net/php is a no go ...im looking for something that triggers a function to resize and play the video as the user attempts to click on the iframe/or a mask div...anything..

Yohann
  • 136
  • 2
  • 13

1 Answers1

6

I think the trategy is to "mask" the video with a transparent div. Create a div with "position:absolute" and appropriate values for "left/top" in order to make the div "overlap" your video. Once user click the div, you enlarge the video & hide the "mask".


About the way to play video when click the mask : Javascript play Youtube Video

Community
  • 1
  • 1
vantrung -cuncon
  • 10,207
  • 5
  • 47
  • 62
  • hi thanks for the reply...the div would mask the iframe...but the video wont load ... i mean you can click the div which would enlarge the iframe dimensions..but you'd need to click again to play the video...i was looking for something that triggers a function to resize and play the youtube video – Yohann Oct 06 '11 at 04:16
  • I see this kind of thing recommended all the time. Just an FYI, causing "play" from the API doesn't record the play to the view count on YouTube. – normmcgarry Aug 30 '12 at 15:55