Closed ghost closed 9 years ago
@carlos1518 & @giorgiobeggiorasitebysite
Did you append enablejsapi=1 to the src URL? E.g.:
<iframe width="600" height="400" src="//www.youtube.com/embed/<video-id>?enablejsapi=1" frameborder="0" allowfullscreen></iframe>
@derRobert Never had to use that attribute before. Actually i managed to fix the code without that, seems like the the iframe api can't take control of the video iframe with the current method of custom "id" = "video id" attribute, i have not had the time to issue a pull request, i would like to know why this happened before that, because my method takes a different approach, and this is the second time that i have run into this issue.
@Heisem yeah it looks like if I use a div with the video id it works. I can't target my embeeded iframe though videoArray[j]. I'm wondering what did you modify in order to target the iframe?
@bransinanderson I couldn't target the iframe so i replaced it with a div just like you said, with the height of the iframe and 100% width.
@Heisem @lunametrics I got it working.
I changed the reloadFrames variable to a value of 1.
The problem with this script is that it targets all iframes. So it tries to work it's magic on anything iframe and fails. I changed the script to target only iframes that contain the word youtube.
Around line 68.
jQuery('iframe[src*="youtube"]')
@bransinanderson Your solution works really good, i ended up using your implementation, looks like there is a pull request for this. Thanks
It's not working anymore, there are no console errors.