We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 73f3d71 commit 390a245Copy full SHA for 390a245
scripts.js
@@ -19,9 +19,23 @@ function getVideoIdFromURL(url) {
19
}
20
21
function onYouTubeIframeAPIReady() {
22
+ const screenWidth = window.innerWidth;
23
+ let playerWidth, playerHeight;
24
+
25
+ if (screenWidth >= 1200) {
26
+ playerWidth = 640;
27
+ playerHeight = 360;
28
+ } else if (screenWidth >= 768) {
29
+ playerWidth = 480;
30
+ playerHeight = 270;
31
+ } else {
32
+ playerWidth = 320;
33
+ playerHeight = 180;
34
+ }
35
36
player = new YT.Player('player', {
- height: '360',
- width: '640',
37
+ height: playerHeight.toString(),
38
+ width: playerWidth.toString(),
39
events: {
40
'onReady': onPlayerReady,
41
'onStateChange': onPlayerStateChange
0 commit comments