유튜브 크롬에서 자동재생 무한반복 시키기
[code]
<iframe id="ytPlayer" style="width:100%;display:block" src="https://www.youtube.com/embed/?playlist=유튜브아이디&loop=1&autoplay=1" allow="autoplay" frameborder=0 allowfullscreen></iframe>
<script>ytPlayer.style.height = ytPlayer.offsetWidth * 9 / 16 + "px";</script>
[/code]
----------
<script>ytPlayer.style.height = ytPlayer.offsetWidth * 9 / 16 + "px";</script>
이건 반응형 코드이니 본인들이 알아서...
핵심은 아이디를 playlist 로 주고 allow="autoplay" 를 넣는 것입니다.
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 12개
추천 꾹 눌러드렸어요~!
구글 정책상 크롬 등 일부 브라우저에서는 mute를 하지 않으면 autoplay를 막아놓는 경우가 있는 것으로 알고 있습니다 ㅠㅠ
참고 :
https://stackoverflow.com/questions/58189735/embedded-youtube-iframes-no-longer-autoplay
https://negabaro.github.io/archive/why-does-not-working-autoplay
그럼 비타주리 님께서도 편안한 밤 되시고 장마 조심하세요~!
감사요. 자동재생은 안 되네요.ㅜㅠ
*** &mute=1 *** 이값은 넣어도 되고 빼도 됩니다. (음향 유무)
*** &playlist=영상아이디&playsinline=1 **** (이 부분이 추가되어야 무한 재생됩니다.)
참고 링크
https://gyuri-v.tistory.com/entry/%EB%8F%99%EC%98%81%EC%83%81-%EC%99%84%EC%A0%84-%EC%A0%95%EB%B3%B5-%E2%91%A1-%EC%9C%A0%ED%8A%9C%EB%B8%8C-iframe