videoId 안에 wr_link1 이 들어가게

videoId 안에 wr_link1 이 들어가게

QA

videoId 안에 wr_link1 이 들어가게

본문

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

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'] ?>')

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

답변을 작성하시기 전에 로그인 해주세요.
전체 123,478 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT