我在我的 django 网站中使用 JWPlayer 6。我想在同一页面上显示不同的视频。由于我正在迭代对象,我无法将不同的类 ID 分配给 Jwplayer 标记。因此,当我加载它时,会显示一个视频,而另一个会弹出此错误:
Loading the player
我一直在寻找解决此问题的方法,但没有成功!
Django 模板
{% 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 %}