video-player.ejs 1.1 KB

12345678910111213141516
  1. <div id="player-container" class="container-fluid" style="background-color: black; height: 650px; padding: 0px;">
  2. <% if(is_video_provider(url, 'youtube')) { %>
  3. <iframe id="video-player" src="<%- youtube_embed_link(url) %>" width="560" height="315" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
  4. <% } else if(is_video_provider(url, 'vimeo')) { %>
  5. <iframe id="video-player" src="<%- vimeo_embed_link(url) %>" width="640" height="360" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe>
  6. <% } %>
  7. <script>
  8. var container = document.getElementById('player-container')
  9. document.getElementById("video-player"). width = container.clientWidth;
  10. document.getElementById("video-player"). height = container.clientHeight;
  11. window.addEventListener("resize", function(event) {
  12. document.getElementById("video-player"). width = container.clientWidth;
  13. document.getElementById("video-player"). height = container.clientHeight;
  14. })
  15. </script>
  16. </div>