Monday, April 23, 2012

Re: [YouTube-API] Player doesn't work after I change the video container's opacity

I had the same experience with trying to 'blend' jQuery in with the YouTube JavaScript API.  What you want to do is, fadeOut() and fadeIn() the parent containers that hold your videos.  Don't put any jQuery API commands directly on the YouTube player items themselves.  Keep your jQuery code in once place, and keep your your YouTube API JavaScript code in a completely different place - don't blend the scripting process together.

my 2 cents




On Mon, Apr 23, 2012 at 6:23 AM, Jennifer Refat <mellowbeing@gmail.com> wrote:
I have my player set up so that it's in a div container called videoContent which fades in and out when the user clicks on the "close" and "replay" buttons, respectively.  

When I remove the fade functionality:
$('#videoContent, .btnClose').fadeOut('slow');

everything works fine - I can stop the video, seek to the beginning and restart playing it.  When I add back the fadeOut() function, I get the error: 

"Uncaught TypeError: Object #<HTMLObjectElement> has no method 'seekTo'"

It seems that the reference to the Youtube player is no longer available. This is incredibly frustrating.. Essentially, changing opacity to 0 makes the videoContent div get the attribute "display: none" but it's still in the DOM... How do I get around this??

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/V_aMQkOaFfoJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment