How to hide the recomendtions when I pause the video?

61 Views Asked by At

This is a part of my code so when I am pausing the youtube video some suggested video or recommended videos are coming in the bottom so I want to hide that so is there any fix I can use to hide those videos?

        document.getElementById("thumbnail_container")!.classList.add("display-none");
        document.getElementById("video_frame")!.classList.remove("display-none");

            player = new (window as any).YT.Player('video_frame', {
            height: '100%',
            width: '100%',
            videoId: videoId,
            playerVars: {
                rel: 0,
                modestbranding: 1,
                controls: 1,
                showinfo: 0,
            },
            events: {
                'onReady': onPlayerReady,
                'onStateChange': onPlayerStateChange
            }
            });
        function onPlayerReady(event : any) {
            event.target.playVideo();
        }
        function onPlayerStateChange(event : any) {
            if (event.data === (window as any).YT.PlayerState.ENDED) {
                player.stopVideo();
                player.destroy();
                videoCompleted();
            }
        }
        function videoCompleted() {
            document.getElementById("thumbnail_container")!.classList.remove("display-none");
            document.getElementById("video_frame")!.classList.add("display-none");
            player = undefined;
        }
0

There are 0 best solutions below