Answer the question
In order to leave comments, you need to log in
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
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question