Youtube api fix
[snf-cloudcms] / cloudcms / templates / content / intro_video.html
1 <a href="#" id="stop-youtube" title="hide video">X</a>
2 <div class="video-thumb">
3         <a href="#" class="play">play</a>
4         <img src="{{ content.image.get_absolute_url }}" alt="">
5         <div class="player-placeholder"></div>
6 </div>
7
8 <script>
9         var video_settings = {
10                 'wrapper': $(".video-thumb"),
11                 'youtube_id': '{{ content.youtube_id}}',
12         }; 
13
14         function onYouTubeIframeAPIReady() {
15                 var youtube = new YouTube(video_settings);
16                 window.youtube = youtube;
17         }
18
19         // This code loads the IFrame Player API code asynchronously.
20         var tag = document.createElement('script');
21         tag.src = "https://www.youtube.com/iframe_api";
22         var firstScriptTag = document.getElementsByTagName('script')[0];
23         firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
24 </script>