JavaScript

Youtube iframe API

ahleum 2021. 12. 28. 15:27

 비율 계산   16:9를 하고 싶을 땐

width: 100%

padding-top : 56.25%

 

 

 

 

iframe 삽입에 대한 YouTube Player API 참조 문서  |  YouTube IFrame Player API  |  Google Developers

 

iframe 삽입에 대한 YouTube Player API 참조 문서  |  YouTube IFrame Player API  |  Google Developers

Embed a YouTube player in your application.

developers.google.com

 

videoId :  페이지 주소에서 뒤에 저 드래그 되어 있는 부분을 가져오면 된다

 

 

 

유튜브 소스보기로 iframe 형태로 가져올 수도 있지만 그러면 제어할 수 있는 것이 한정적이다

자동재생과 음소거 등 여러 가지를 제어가 가능하다

 

사이트에 들어가서 제어가 가능한 부분들은 더 보고 추가로 넣을 수 있다.