ng-youtube-embed icon indicating copy to clipboard operation
ng-youtube-embed copied to clipboard

player.playVideo is not a function

Open cokeposada opened this issue 5 years ago • 7 comments

The play button on your codepen demo doesn't work and i'm trying to do something like that :(

cokeposada avatar Jul 19 '19 19:07 cokeposada

For some reason, the object returned from Youtube API is different from the documents. I needed the player.stopVideo and it gave me the same error. I have debuged the object returned and none of the methods was there.

thalisson-ca avatar Jan 10 '20 20:01 thalisson-ca

If you're having trouble developing on your local pc, adding port to the iframe's origin address may solve it. I solved it that way.

benjichung1 avatar Jan 31 '20 06:01 benjichung1

@zumbrother What are you referring to, "adding port to the iframe's origin address"? I was struggling with this same issue.

jmoseman01 avatar Feb 10 '20 16:02 jmoseman01

http://unlockcampus.org/code/tutoring/ng-youtube-embed-demo

This example is live and working.

jmoseman01 avatar Feb 10 '20 19:02 jmoseman01

@jmoseman01 If you are using the IFrame API, , you should always specify your domain as the origin parameter value. This library considers the domain, but not the port. Therefore, 80 port will work as default, but won't work for any other port. So if your problem is similar with mine, you can solve the problem by adding the code to add port.

benjichung1 avatar Feb 12 '20 02:02 benjichung1

@zumbrother have you thought about doing a pull request with your change? I almost stopped using this library without the added info from this ticket.

jmoseman01 avatar Feb 12 '20 16:02 jmoseman01

@jmoseman01 After downloading the library, I just modified the line 50 of the source code (ng-youtube-embed.js) from 'options.origin = host;' to 'options.origin = host + ':' + window.location.port;' That's all I did.

benjichung1 avatar Feb 13 '20 15:02 benjichung1