start/play embedded (iframe) youtube-video on click of an image

前端 未结 7 1309
一整个雨季
一整个雨季 2020-12-07 22:20

I\'m trying to start playing an embedded youtube video by clicking an image. The idea is to have an image on top of a video, and when the image is clicked it fades out and s

7条回答
  •  [愿得一人]
    2020-12-07 22:51

    You are supposed to be able to specify a domain that is safe for scripting. the api document mentions "As an extra security measure, you should also include the origin parameter to the URL" http://code.google.com/apis/youtube/iframe_api_reference.html src="http://www.youtube.com/embed/J---aiyznGQ?enablejsapi=1&origin=mydomain.com" would be the src of your iframe.

    however it is not very well documented. I am trying something similar right now.

提交回复
热议问题