N
N
Nikita Shchypylov2016-08-12 10:59:23
YouTube
Nikita Shchypylov, 2016-08-12 10:59:23

How to remove those black bars on youtube preview?

Hello everyone
And so, there is a video that is loaded on the page
Question: can I somehow replace the standard preview, since now it is small and black bars appear?
joxi.ru/D2Peq49U4a7VA3 - problem screen
Code:

<script>
  // Load the IFrame Player API code asynchronously.
  var tag = document.createElement('script');
  tag.src = "https://www.youtube.com/player_api";
  var firstScriptTag = document.getElementsByTagName('script')[0];
  firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

  // Replace the 'ytplayer' element with an <iframe> and
  // YouTube player after the API code downloads.
  var player;
  function onYouTubePlayerAPIReady() {
    player = new YT.Player('ytplayer', {
      height: '390',
      width: '640',
      videoId: 'OQsmg24y8_E',
      controls: 2
    });
  }
</script>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
My joy, 2016-08-12
@Nikulio

Because it is necessary to observe the proportion of 16:9 so that the black frames are not visible. In your code, the width of the player is 640. And the height must be in compliance with the proportion: 360 , and you have 390.

R
Roman, 2016-08-12
@r_zaycev

Make a normal aspect ratio 16:9, 640x360 pixels

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question