2013-05-13 7 views
1

내 django 웹 사이트에서 JWPlayer 6을 사용하고 있습니다. 같은 페이지에 다른 동영상을 표시하고 싶습니다. 내가 객체를 반복한다는 사실 때문에 Jwplayer 태그에 다른 클래스 ID를 할당 할 수 없습니다. 나는 아직 성공을이 문제를 해결하지하는 방법을 찾고 있었어요JWplayer를 사용할 때 플레이어를로드 할 수 없습니다.

 Loading the player 

: 나는 그것을로드 할 때, 다른 하나는이 오류를 나타납니다 동안 따라서, 하나 개의 비디오가 표시됩니다!

장고 템플릿

{% block content %} 

    {% for flip in flips %} 

    <p> {{flip.title}} </p> 
     <center> 
      <div id="myElement">Loading the player...</div> 
      <script type="text/javascript"> 
       jwplayer("myElement").setup({ 
        image: "{{MEDIA_URL}}/{{flip.vid_image}}", 
      source[ {file: "{{MEDIA_URL}}/{{flip.vid_watch}}" }, 
       {file: "{{MEDIA_URL}}/{{flip.vid_mp}}" 
       ], 
        title:"{{flip.title}}", 
        width:692, 
        height:389 
       }); 
       </script> 
     </center> 
      <p>Description: {{flip.description}} </p> 
    {% endblock %} 
+0

이 다른 StackOverflow 스레드에는 솔루션이 있습니다. - http://stackoverflow.com/questions/16152380/django-displaying-video-with-jwplayer – emaxsaun

답변

1

여기에 답을 제임스 Herrieven에

{% block content %} 
    {% for flip in flips %} 
     <p> {{flip.title}} </p> 
    <center> 
     <div id="myElement_{{ forloop.counter }}">Loading the player...</div> 
      <script type="text/javascript"> 
      jwplayer("myElement_{{ forloop.counter }}").setup({ 
       image: "{{MEDIA_URL}}/{{flip.vid_image}}", 
       source[ {file: "{{MEDIA_URL}}/{{flip.vid_watch}}" }, 
         {file: "{{MEDIA_URL}}/{{flip.vid_mp}}"} 
       ], 
       title:"{{flip.title}}", 
       width:692, 
       height:389 
      }); 
      </script> 
     </center> 
     <p>Description: {{flip.description}} </p> 
     {% endfor %} 


    {% endblock %} 

감사합니다!

관련 문제