Mercurial > public > bravenewsurf
annotate bns_website/templates/videos/index.html @ 61:1d2473f4bcaa
Fix bug in template that prevented the embedded video player from playing the entire playlist.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 19 Nov 2011 14:39:28 -0600 |
parents | a0d3bc630ebd |
children | 4de34a1446a0 |
rev | line source |
---|---|
bgneal@60 | 1 {% extends 'base.html' %} |
bgneal@60 | 2 {% load core_tags %} |
bgneal@60 | 3 {% block title %}Watch{% endblock %} |
bgneal@60 | 4 {% block content %} |
bgneal@60 | 5 {% navbar 'videos' %} |
bgneal@60 | 6 <h1>Watch</h1> |
bgneal@60 | 7 |
bgneal@60 | 8 {% if videos %} |
bgneal@60 | 9 <p> |
bgneal@60 | 10 Please enjoy this {{ videos|length }} video playlist of the bands that performed on the |
bgneal@60 | 11 <em>Brave New Surf</em> compilation. You can use the button that looks like a widescreen TV |
bgneal@60 | 12 at the bottom of the player to scroll through all the videos. |
bgneal@60 | 13 </p> |
bgneal@60 | 14 <div id="player"></div> |
bgneal@60 | 15 |
bgneal@60 | 16 <script> |
bgneal@60 | 17 var tag = document.createElement('script'); |
bgneal@60 | 18 tag.src = "http://www.youtube.com/player_api"; |
bgneal@60 | 19 var firstScriptTag = document.getElementsByTagName('script')[0]; |
bgneal@60 | 20 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); |
bgneal@60 | 21 |
bgneal@60 | 22 var player; |
bgneal@60 | 23 function onYouTubePlayerAPIReady() { |
bgneal@60 | 24 player = new YT.Player('player', { |
bgneal@60 | 25 videoId: '{{ videos|first }}', |
bgneal@61 | 26 {% if videos|length > 1 %} |
bgneal@60 | 27 playerVars: { playlist: [ |
bgneal@60 | 28 {% for video in videos|slice:"1:" %} |
bgneal@60 | 29 {% if not forloop.first %},{% endif %}'{{ video }}' |
bgneal@60 | 30 {% endfor %} ]}, |
bgneal@60 | 31 {% endif %} |
bgneal@60 | 32 width: '853', |
bgneal@60 | 33 height: '480' |
bgneal@60 | 34 }); |
bgneal@60 | 35 } |
bgneal@60 | 36 </script> |
bgneal@60 | 37 |
bgneal@60 | 38 {% else %} |
bgneal@60 | 39 <p>Videos of the bands are coming soon. Please check back later.</p> |
bgneal@60 | 40 {% endif %} |
bgneal@60 | 41 {% endblock %} |