{% extends 'layouts/layout.html.twig' %}
{% block recommendation %}
<style>
body, html {
margin: 0;
padding: 0;
font-family: 'Arial', sans-serif;
background-color: #141414;
color: white;
height: 100%; /* Full height */
overflow: auto; /* Hide overflow */
}
.deluxe-header {
background-color: #000;
padding: 20px;
color: white;
text-align: center;
font-size: 24px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.deluxe-hero {
position: relative;
width: 100%;
height: 66vh; /* Adjusted height */
overflow: hidden; /* Hide overflow */
}
.deluxe-hero iframe {
position: absolute;
top: -160px; /* Adjust top to cut off borders */
left: 0;
width: 120%;
height: calc(100% + 260px); /* Increase height to cut off borders */
border: none; /* Remove any border */
}
.deluxe-overlay {
position: absolute;
bottom: 0%; /* Align with the bottom of the video */
right: 0.0%;
width: 30%; /* Adjust width as needed */
height: 20vh; /* Adjust height to match video bottom */
background: rgba(0, 0, 0, 0.93);
color: white;
padding: 20px;
display: flex;
align-items: right;
justify-content: right;
clip-path: polygon(100% 100%, 0 100%, 100% 0); /* Triangle cut */
animation: slideInRight 3s ease-out forwards; /* Animation */
z-index: 1000; /* High z-index to ensure visibility on top */
}
.deluxe-overlay-link
{
margin-top:100px;
color: white; /* Ensures the link is white */
text-decoration: none; /* Removes underline from the link */
font-size: 22px; /* Adjust size as needed */
font-weight: bold; /* Makes the text bold */
display: block; /* Ensures the link fills the container for better clickability */
text-align: right; /* Centers the text within the link */
}
.deluxe-link {
color: white; /* Ensures the link is white */
text-decoration: none; /* Removes underline from the link */
font-size: 18px; /* Adjust size as needed */
font-weight: bold; /* Makes the text bold */
display: block; /* Ensures the link fills the container for better clickability */
text-align: center; /* Centers the text within the link */
}
.deluxe-overlay-left {
position: absolute;
bottom: 0%; /* Align with the bottom of the video */
left: 0.0%;
width: 25%; /* Adjust width as needed */
height: 100%; /* Adjust height to match video bottom */
color: white;
padding: 20px;
display: flex;
align-items: right;
justify-content: right;
animation: slideIn 3s ease-out forwards; /* Animation */
z-index: 1000; /* High z-index to ensure visibility on top */
background: rgb(0,0,0,1);
color: white; /* Ensures the link is white */
text-decoration: none; /* Removes underline from the link */
font-size: 18px; /* Adjust size as needed */
font-weight: bold; /* Makes the text bold */
display: block; /* Ensures the link fills the container for better clickability */
text-align: center; /* Centers the text within the link */
}
@keyframes slideIn {
from {
transform: translateX(-400%);
}
to {
transform: translateX(0%);
}
}
@keyframes slideInRight {
from {
transform: translateX(400%);
}
to {
transform: translateX(0%);
}
}
.deluxe-content {
padding: 20px;
text-align: center;
}
.deluxe-movie-grid {
width: 100%;
padding: 20px;
background: rgba(0, 0, 0, 0.7);
display: flex;
flex-wrap: wrap;
justify-content: space-around;
margin-bottom: 20px;
}
.deluxe-movie-left {
width: 250px;
margin: 15px 2px;
box-sizing: border-box;
transition: transform 0.3s ease;
cursor: pointer;
z-index: 10000;
}
.deluxe-movie-left img {
margin-left: 40px;
width: 150%;
height: auto;
display: block;
}
.deluxe-movie {
width: 11.0%;
margin: 15px 2px;
box-sizing: border-box;
transition: transform 0.3s ease;
cursor: pointer;
}
.deluxe-movie:hover {
transform: scale(1.1);
}
.deluxe-movie img {
width: 100%;
height: auto;
display: flex;
content-align: center;
}
.deluxe-movie-info {
text-align: center;
background: rgba(0, 0, 0, 0.8);
padding: 10px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.deluxe-link {
text-decoration: none;
color: inherit;
}
.deluxe-link-left {
text-decoration: none;
color: inherit;
}
</style>
<body>
{% set skippedFirst = false %}
<!-- <div class="deluxe-header">Deluxe Movie Showcase</div> -->
<div class="deluxe-hero" id="deluxe-hero">
{% if movies.current is defined and movies.current %}
<a class="deluxe-overlay-link" href="/movie-detail/{{ movies.current.id }}"> <div class="deluxe-overlay" id="deluxe-overlay"> {{ movies.current.title }} <p style="font-size: 12px;">More Details</p></a></div>
<div class="deluxe-overlay-left">
<div class="deluxe-movie-left">
<a class="deluxe-link-left" href="/movie-detail/{{ movies.current.id }}">
<img src="{{ movies.current.getImageURL().getUrl() }}" alt="{{ movies.current.title }}">
</a>
</div></div>
<!-- YouTube video will be loaded here -->
<div id="youtube-player"></div>
</div>
{% endif %}
<div class="deluxe-content">
<h1>Recommendations</h1>
<p>Explore our curated collection of films.</p>
</div>
<div class="deluxe-movie-grid">
<!-- Dynamic content will be inserted here via PHP Twig -->
{% for movie in movies %}
{% if (skippedFirst) %}
<div class="deluxe-movie">
<a class="deluxe-link" href="/movie-detail/{{ movie.id }}">
<img src="{{ movie.getImageURL().getUrl() }}" alt="{{ movie.title }}">
<div class="deluxe-movie-info">{{ movie.title }}</div>
</a>
</div>
{% endif %}
{% set skippedFirst = true %}
{% endfor %}
</div>
<!-- Load the YouTube IFrame Player API -->
<script src="https://www.youtube.com/iframe_api"></script>
<script>
function onDeluxePlayerReady(event) {
console.log("Player ready");
event.target.unMute();
event.target.setVolume(20);
event.target.playVideo();
setTimeout(function() {
var overlay = document.getElementById('deluxe-overlay');
if (overlay) {
overlay.style.display = 'block';
console.log("Overlay added");
} else {
console.error('Overlay element not found');
}
}, 10000); // Show overlay after 10 seconds
}
function onDeluxePlayerStateChange(event) {
if (event.data === YT.PlayerState.ENDED) {
deluxePlayer.playVideo();
}
}
</script>
<script src="https://www.youtube.com/iframe_api"></script>
<script>
var deluxePlayer;
function onYouTubeIframeAPIReady() {
var firstMovieName = document.getElementById('deluxe-overlay').innerHTML; // Replace this with dynamic data if available
console.log(firstMovieName);
searchYouTube(firstMovieName + " trailer Movie TV Series", function(videoId) {
deluxePlayer = new YT.Player('youtube-player', {
videoId: videoId,
playerVars: {
autoplay: 1,
controls: 0,
modestbranding: 1,
rel: 0,
showinfo: 0,
},
events:
{
'onReady': onDeluxePlayerReady
}
});
});
}
function searchYouTube(query, callback) {
var apiKey = 'AIzaSyABUXy24BFAgNuEjKHVLE1D7YfEti0pB5Y'; // Replace with your actual YouTube API Key
var url = `https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=${encodeURIComponent(query)}&key=${apiKey}`;
fetch(url)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
if (data.items && data.items.length > 0) {
var videoId = data.items[0].id.videoId;
callback(videoId);
} else {
console.error('No videos found');
}
})
.catch(error => console.error('Error fetching YouTube videos:', error));
}
</script>
{% endblock %}