Scroll & FullScreen Fix

74 views Asked by At

There! I'm working on a personal streaming service website for fun and lately I have made a lot of progress but I have encountered an issue which I find very annoying. So, I can't use fullscreen on my videos and a scrollbar appears on the bottom of the page to scroll to the right and to the left.

So I would like some instructions to remove the scrollbar and fix the fullscreen. Here's the HTML code for the player:

const video = document.getElementById('videoPlayer');
const playButton = document.getElementById('play-button');

function playVideo() {
  video.play();
  playButton.style.display = 'none';
}

video.addEventListener('play', () => {
  playButton.style.display = 'none';
});

video.addEventListener('pause', () => {
  playButton.style.display = 'block';
});

var urlParams = new URLSearchParams(window.location.search);
var videoUrl = decodeURIComponent(urlParams.get('videoUrl'));
var videoPlayer = document.getElementById('videoPlayer');
videoPlayer.src = videoUrl;
videoPlayer.autoplay = false;
videoPlayer.controls = true;
videoPlayer.style.width = "75%";
videoPlayer.style.height = "75%";
videoPlayer.style.paddingTop = "220px";
@charset "utf-8";
* {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
}

.banner {
  width: 100vw;
  height: 100vh;
  background-image: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url(newbckrnd.png);
  background-size: cover;
  background-position: center;
}

.navbar {
  width: 100vw;
  margin: auto;
  padding: 35px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(32, 32, 32, 1.00);
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
}

.logo {
  width: 120px;
  cursor: pointer;
}

.navbar ul li {
  list-style: none;
  display: inline-block;
  margin: 0 20px;
  position: relative;
}

.navbar ul li a {
  text-decoration: none;
  color: lightgray;
  text-transform: uppercase;
}

.navbar ul li::after {
  content: '';
  height: 3px;
  width: 0;
  background: #009688;
  position: absolute;
  left: 0;
  bottom: 0;
  transition: 0.5s;
}

.navbar ul li:hover::after {
  width: 100%;
}

.banner-image {
  position: absolute;
  top: 220px;
  left: 10%;
  transform: translateX(-50%);
  width: 130px;
  height: auto;
  border: 2px solid #3F3F3F;
  padding: 5px;
  margin-right: 10px;
}

.banner-text {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #fff;
}

.banner-text h1 {
  font-size: 3em;
  margin-bottom: 20px;
}

.banner-text p {
  font-size: 1.5em;
  margin-bottom: 40px;
}

.banner-text a {
  display: inline-block;
  padding: 10px 20px;
  background-color: #009688;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
}

.player {
  width: 640px;
  height: 360px;
}

.play-button-container {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  margin: auto;
  z-index: 2;
  text-align: center;
}

#play-button {
  font-size: 2em;
  padding: 0.5em 1em;
  background-color: #333;
  border: 2px solid #000000;
  border-radius: 50%;
  cursor: pointer;
  color: #333;
}

.player:hover+.play-button-container #play-button {
  color: #3F3F3F;
}

#videoPlayer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  height: 100vh;
}

video {
  width: 100%;
  height: 100%;
  object-fit: fill;
}

video:-webkit-full-screen {
  object-fit: fill;
}

body {
  overflow: hidden;
}

 ::-webkit-scrollbar {
  display: none;
}

video {
  padding-top: 16px;
}

#videoPlayer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.play-button-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

#play-button {
  font-size: 2em;
  padding: 0.5em 1em;
  background-color: #525252;
  border: 2px solid #000;
  border-radius: 50%;
  cursor: pointer;
}
<div class="navbar">
  <img src="logofbox-removebg-preview.png" class="logo" alt="LOGO">
  <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="movies.html">Movies</a></li>
    <li><a href="#">TV Shows</a></li>
    <li><a href="#">Categories</a></li>
  </ul>
</div>
<video id="videoPlayer" controls controlsList="nodownload fullscreen" class="player"></video>

<div class="play-button-container">
  <button id="play-button" onclick="playVideo()">Play</button>
</div>

I have tried everything I could think of! Thanks!

0

There are 0 answers