I'm trying to build a page where a YouTube player is embedded with a default video loaded. On the sidebar, I have a few pics of other videos. When one of the pics are clicked, the template reloads itself but with the YouTube player now playing the other video. Each of these pics will have a YouTube url which needs to be played when clicked. Very similar to the YouTube page of any video.
HTML:
<div class="col-md-12 col-xs-12 video_menu_item">
<div class="video_menu_description">
<a href="/library/videos/" value="https://www.youtube.com/embed/EWrT-aBDxeI" name="para">
<img src="/images/X.jpg" alt="Video name thumbnail" style="width:60%;height:100px;">
</a>
</div>
</div>
<div class="video_section_outer">
<div class="col-md-12 col-xs-12 video_scroll_track">
<div class="col-md-12 col-xs-12 video_item_outer">
<h4 class="col-md-12 col-xs-12 video_track_sub_heading"><b>video.v_name</b></h4>
<div class="col-md-12 col-xs-12 test_button_start">
<iframe width="420" height="315" src="{{ link }}" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>
</div>
URLS.PY:
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
# Video Sections
url(r'^library/tests/', 'bt.views.tests', name='tests'),
url(r'^library/videos-(?P<link1>[\w-]+)/', 'bt.views.videos', {'link': 'para'}),
url(r'^library/videos/', 'bt.views.videos', name='videos'),
]
VIEWS.PY:
@csrf_exempt
def videos(request, link1 = "https://www.youtube.com/embed/Qj4nEYQA9ks"):
content = {"link" : link1}
return render_to_response('videos.html', content)