jquery - Unable to Load player when using JWplayer -


i'm using jwplayer 6 in django website. want display different videos on same page. due fact i'm iterating on objects, can't assign different class id's jwplayer tag. when load it, 1 video display while other pop out error:

      loading player 

i've been looking way fix yet no success!

django template

{% block content %}     {% flip in flips %}       <p> {{flip.title}} </p>       <center>           <div id="myelement">loading 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 %} 

here answer

 {% block content %}     {% flip in flips %}         <p> {{flip.title}} </p>    <center>        <div id="myelement_{{ forloop.counter }}">loading 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 %} 

thanks james herrieven!


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -