유튜브 크롬에서 자동재생 무한반복 시키기

[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개

@arari 근데 자동재생이 서버환경에 따라 오락가락 하네요. 에효효
좋아요. 감사 합니다.
@들레아빠 자동재생은 좀 그러네요. 무한반복만...
감사합니다. ^^
@호텔천사 감사요
@hiwoong 감사요
오오~ 유용한 소스 감사드립니다 ^-^
추천 꾹 눌러드렸어요~!
구글 정책상 크롬 등 일부 브라우저에서는 mute를 하지 않으면 autoplay를 막아놓는 경우가 있는 것으로 알고 있습니다 ㅠㅠ

참고 :
https://stackoverflow.com/questions/58189735/embedded-youtube-iframes-no-longer-autoplay
https://negabaro.github.io/archive/why-does-not-working-autoplay

그럼 비타주리 님께서도 편안한 밤 되시고 장마 조심하세요~!
@Innisfree
감사요. 자동재생은 안 되네요.ㅜㅠ
저 한번 해보겠습니다.
<iframe width="500" height="500" src="https://www.youtube.com/embed/영상아이디?autoplay=1&mute=1&rel=0&controls=0&loop=1&playlist=영상아이디&playsinline=1" title="영상제목" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>


*** &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
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
3년 전 조회 3,109
3년 전 조회 3,128
3년 전 조회 4,424
3년 전 조회 2,675
3년 전 조회 2,827
3년 전 조회 2,841
3년 전 조회 1,976
3년 전 조회 2,792
3년 전 조회 3,381
3년 전 조회 2,822
3년 전 조회 2,401
3년 전 조회 2,860
3년 전 조회 2,128
3년 전 조회 2,009
3년 전 조회 3,649
3년 전 조회 2,216
3년 전 조회 3,210
3년 전 조회 2,186
3년 전 조회 1,770
3년 전 조회 2,105
3년 전 조회 2,325
3년 전 조회 1,928
3년 전 조회 2,599
3년 전 조회 2,759
3년 전 조회 1,986
3년 전 조회 3,710
3년 전 조회 2,360
3년 전 조회 2,372
3년 전 조회 3,191
3년 전 조회 2,317