videoId 안에 wr_link1 이 들어가게

videoId 안에 wr_link1 이 들어가게

QA

videoId 안에 wr_link1 이 들어가게

답변 2

본문

문법을 모르겠어서 문의 드립니다. 원래 저자리에 

videoId:'OMRZevAb_jU', 들어가야 하는데  <?php echo $list[$i]['wr_link1'] ?> 넣고 싶어요

 

<script>
  var player;
  function onYouTubeIframeAPIReady(){
    player = new YT.Player('player',{
      width:'100%',
      videoId:'<?php echo $list[$i]['wr_link1'] ?>',
      playerVars:{'autoplay':1,'playsinline':1},
      events:{ 'onReady':onPlayerReady }
    });
  }
  function onPlayerReady(e){
    e.target.mute();
    e.target.playVideo();
  }
</script>

이 질문에 댓글 쓰기 :

답변 2

<script>
  var player;
  function onYouTubeIframeAPIReady( vid){
    player = new YT.Player('player',{
      width:'100%',
      videoId:vid,
      playerVars:{'autoplay':1,'playsinline':1},
      events:{ 'onReady':onPlayerReady }
    });
  }
  function onPlayerReady(e){
    e.target.mute();
    e.target.playVideo();
  }
</script>

 

추측에 onYouTubeIframeAPIReady()이 함수가

$list loop 안에 있을 듯하니

호출하는 부분에서

onYouTubeIframeAPIReady( '<?php echo $list[$i]['wr_link1'] ?>')

하는 방식으로 해야 될 겁니다.

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
filter #html ×
  • 질문이 없습니다.
전체 0
© SIRSOFT
현재 페이지 제일 처음으로