l / index.html
Curlzz's picture
Add 2 files
797a787 verified
Raw History Blame Contribute Delete
49.5 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TogetherFlix - Watch Together with Your Love</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.video-container {
position: relative;
padding-bottom: 56.25%;
height: 0;
overflow: hidden;
border-radius: 12px;
}
.video-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 12px;
}
.chat-message.sent {
background-color: #3b82f6;
color: white;
border-radius: 18px 18px 0 18px;
align-self: flex-end;
}
.chat-message.received {
background-color: #e5e7eb;
color: black;
border-radius: 18px 18px 18px 0;
align-self: flex-start;
}
.webcam-container {
position: relative;
width: 100%;
padding-bottom: 56.25%;
background-color: #1f2937;
border-radius: 12px;
overflow: hidden;
}
.webcam-container video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.heart-pulse {
animation: pulse 1.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.3); }
100% { transform: scale(1); }
}
.platform-tab.active {
background-color: #3b82f6;
color: white;
}
.platform-tab.inactive {
background-color: #e5e7eb;
color: #4b5563;
}
.video-thumbnail {
transition: transform 0.2s;
}
.video-thumbnail:hover {
transform: scale(1.03);
}
.glow-border {
box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}
.fade-in {
animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
</style>
</head>
<body class="bg-gray-900 text-gray-100 font-sans">
<div class="min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-gradient-to-r from-blue-900 to-purple-900 p-4 shadow-lg">
<div class="container mx-auto flex justify-between items-center">
<div class="flex items-center space-x-3">
<div class="flex items-center">
<i class="fas fa-heart text-pink-500 text-2xl mr-2"></i>
<h1 class="text-2xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-pink-400 to-red-500">Together<span class="text-white">Flix</span></h1>
</div>
<div class="hidden md:flex space-x-1 ml-6">
<button id="youtubeTab" class="platform-tab active px-4 py-2 rounded-lg">
<i class="fab fa-youtube mr-2"></i>YouTube
</button>
<button id="netflixTab" class="platform-tab inactive px-4 py-2 rounded-lg">
<i class="fas fa-film mr-2"></i>Netflix
</button>
</div>
</div>
<div class="flex items-center space-x-4">
<button id="heartBtn" class="text-pink-400 hover:text-pink-300 text-2xl transition-colors">
<i class="fas fa-heart"></i>
</button>
<div class="flex items-center space-x-2 bg-gray-800 px-3 py-1 rounded-full">
<div class="w-8 h-8 rounded-full bg-gradient-to-r from-pink-500 to-purple-500 flex items-center justify-center">
<i class="fas fa-user text-white"></i>
</div>
<span class="hidden sm:inline">You & <span class="text-pink-300">Your Love</span></span>
</div>
</div>
</div>
<div class="md:hidden flex justify-center mt-3 space-x-1">
<button id="mobileYoutubeTab" class="platform-tab active px-4 py-2 rounded-lg text-sm">
<i class="fab fa-youtube mr-2"></i>YouTube
</button>
<button id="mobileNetflixTab" class="platform-tab inactive px-4 py-2 rounded-lg text-sm">
<i class="fas fa-film mr-2"></i>Netflix
</button>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 container mx-auto p-4 flex flex-col lg:flex-row gap-6">
<!-- Video Section -->
<div class="lg:w-2/3 flex flex-col gap-6">
<!-- Video Player -->
<div id="youtubePlayerSection" class="bg-gray-800 rounded-xl shadow-xl overflow-hidden fade-in">
<div class="video-container glow-border">
<iframe id="youtubePlayer" src="https://www.youtube.com/embed/dQw4w9WgXcQ?enablejsapi=1" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
<div class="p-4">
<h2 id="videoTitle" class="text-xl font-bold">Rick Astley - Never Gonna Give You Up (Official Music Video)</h2>
<div class="flex justify-between items-center mt-2">
<div class="flex items-center space-x-2 text-gray-400">
<span>4.5M views</span>
<span>•</span>
<span>3 years ago</span>
</div>
<div class="flex space-x-2">
<button class="p-2 rounded-full hover:bg-gray-700">
<i class="fas fa-thumbs-up"></i>
</button>
<button class="p-2 rounded-full hover:bg-gray-700">
<i class="fas fa-thumbs-down"></i>
</button>
<button class="p-2 rounded-full hover:bg-gray-700">
<i class="fas fa-share"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Netflix Player (Hidden by default) -->
<div id="netflixPlayerSection" class="bg-gray-800 rounded-xl shadow-xl overflow-hidden hidden fade-in">
<div class="video-container glow-border">
<div class="absolute inset-0 flex items-center justify-center bg-black">
<div class="text-center">
<i class="fas fa-film text-6xl text-red-600 mb-4"></i>
<h3 class="text-2xl font-bold mb-2">Netflix Together</h3>
<p class="text-gray-400 mb-4">Start watching the same Netflix show simultaneously</p>
<button id="startNetflixBtn" class="bg-red-600 hover:bg-red-700 text-white px-6 py-3 rounded-lg font-medium transition-colors">
<i class="fas fa-play mr-2"></i>Start Netflix Party
</button>
</div>
</div>
</div>
<div class="p-4">
<h2 id="netflixTitle" class="text-xl font-bold">Select a Netflix Show</h2>
<div class="flex justify-between items-center mt-2">
<div class="flex items-center space-x-2 text-gray-400">
<span>Synced with your partner</span>
</div>
<div class="flex space-x-2">
<button class="p-2 rounded-full hover:bg-gray-700">
<i class="fas fa-cog"></i>
</button>
</div>
</div>
</div>
</div>
<!-- Video Controls -->
<div class="bg-gray-800 rounded-xl shadow-xl p-4">
<div class="flex flex-col space-y-4">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-3">
<button id="playPauseBtn" class="bg-red-600 hover:bg-red-700 text-white p-3 rounded-full transition-colors">
<i class="fas fa-play"></i>
</button>
<span id="currentTime" class="text-gray-300">0:00</span>
<span class="text-gray-500">/</span>
<span id="duration" class="text-gray-300">3:33</span>
</div>
<div class="flex items-center space-x-3">
<button id="videoChatBtn" class="bg-blue-600 hover:bg-blue-700 text-white p-2 rounded-full transition-colors">
<i class="fas fa-video"></i>
</button>
<button id="syncBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2 transition-colors">
<i class="fas fa-sync-alt"></i>
<span>Sync</span>
</button>
</div>
</div>
<input id="seekBar" type="range" min="0" max="100" value="0" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer">
</div>
</div>
<!-- Video Chat Section -->
<div id="videoChatSection" class="bg-gray-800 rounded-xl shadow-xl p-4 hidden">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-lg">
<i class="fas fa-video mr-2 text-blue-400"></i>
Video Chat
</h3>
<button id="closeVideoChatBtn" class="text-gray-400 hover:text-white">
<i class="fas fa-times"></i>
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<div class="webcam-container relative">
<video id="localVideo" autoplay muted></video>
<div class="absolute bottom-2 left-2 bg-black bg-opacity-50 text-white px-2 py-1 rounded text-sm">
You
</div>
</div>
<div class="mt-3 flex justify-center space-x-3">
<button id="toggleWebcamBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition-colors">
<i class="fas fa-video mr-2"></i>Enable Camera
</button>
<button id="toggleMicBtn" class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded-lg transition-colors">
<i class="fas fa-microphone mr-2"></i>Enable Mic
</button>
</div>
</div>
<div>
<div class="webcam-container relative">
<video id="remoteVideo" autoplay></video>
<div class="absolute bottom-2 left-2 bg-black bg-opacity-50 text-white px-2 py-1 rounded text-sm">
Your Love
</div>
</div>
<div class="mt-3 text-center text-gray-400">
<i class="fas fa-user-clock text-xl mb-2"></i>
<p>Waiting for your partner to join...</p>
</div>
</div>
</div>
</div>
<!-- Netflix Content Browser -->
<div id="netflixContentSection" class="bg-gray-800 rounded-xl shadow-xl p-4 hidden">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-lg">
<i class="fas fa-film mr-2 text-red-400"></i>
Netflix Shows
</h3>
<div class="relative">
<input type="text" placeholder="Search Netflix..." class="bg-gray-700 text-white pl-10 pr-4 py-2 rounded-lg focus:outline-none focus:ring-2 focus:ring-red-500 w-64">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4">
<div class="video-thumbnail cursor-pointer">
<div class="relative pb-[150%] bg-gray-700 rounded-lg overflow-hidden">
<img src="https://image.tmdb.org/t/p/w500/9yxep7oJdkQ3Hm4K23T0mPuHrzn.jpg" alt="Stranger Things" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-30 transition-all duration-300 flex items-center justify-center">
<button class="bg-red-600 hover:bg-red-700 text-white p-3 rounded-full opacity-0 hover:opacity-100 transition-opacity">
<i class="fas fa-play"></i>
</button>
</div>
</div>
<p class="mt-2 text-sm font-medium truncate">Stranger Things</p>
</div>
<div class="video-thumbnail cursor-pointer">
<div class="relative pb-[150%] bg-gray-700 rounded-lg overflow-hidden">
<img src="https://image.tmdb.org/t/p/w500/3lBDg3i6nn5R2NKFCJ6oKyUe2k5.jpg" alt="The Crown" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-30 transition-all duration-300 flex items-center justify-center">
<button class="bg-red-600 hover:bg-red-700 text-white p-3 rounded-full opacity-0 hover:opacity-100 transition-opacity">
<i class="fas fa-play"></i>
</button>
</div>
</div>
<p class="mt-2 text-sm font-medium truncate">The Crown</p>
</div>
<div class="video-thumbnail cursor-pointer">
<div class="relative pb-[150%] bg-gray-700 rounded-lg overflow-hidden">
<img src="https://image.tmdb.org/t/p/w500/6Z7fZg1aXqYkLJWZQ5yPuQviZQu.jpg" alt="Money Heist" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-30 transition-all duration-300 flex items-center justify-center">
<button class="bg-red-600 hover:bg-red-700 text-white p-3 rounded-full opacity-0 hover:opacity-100 transition-opacity">
<i class="fas fa-play"></i>
</button>
</div>
</div>
<p class="mt-2 text-sm font-medium truncate">Money Heist</p>
</div>
<div class="video-thumbnail cursor-pointer">
<div class="relative pb-[150%] bg-gray-700 rounded-lg overflow-hidden">
<img src="https://image.tmdb.org/t/p/w500/6UH52Fmau8RPsMAbQbjwN3wJSCj.jpg" alt="Squid Game" class="absolute h-full w-full object-cover">
<div class="absolute inset-0 bg-black bg-opacity-0 hover:bg-opacity-30 transition-all duration-300 flex items-center justify-center">
<button class="bg-red-600 hover:bg-red-700 text-white p-3 rounded-full opacity-0 hover:opacity-100 transition-opacity">
<i class="fas fa-play"></i>
</button>
</div>
</div>
<p class="mt-2 text-sm font-medium truncate">Squid Game</p>
</div>
</div>
</div>
</div>
<!-- Sidebar -->
<div class="lg:w-1/3 flex flex-col gap-6">
<!-- Search and Add Video -->
<div id="youtubeSearchSection" class="bg-gray-800 rounded-xl shadow-xl p-4 fade-in">
<h3 class="font-bold text-lg mb-4">
<i class="fab fa-youtube mr-2 text-red-500"></i>
Add YouTube Video
</h3>
<div class="flex">
<input id="videoUrlInput" type="text" placeholder="Paste YouTube URL here..." class="flex-1 bg-gray-700 text-white border border-gray-600 rounded-l-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-red-500">
<button id="addVideoBtn" class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-r-lg transition-colors">
<i class="fas fa-plus"></i>
</button>
</div>
</div>
<!-- Netflix Join Section -->
<div id="netflixJoinSection" class="bg-gray-800 rounded-xl shadow-xl p-4 hidden">
<h3 class="font-bold text-lg mb-4">
<i class="fas fa-film mr-2 text-red-500"></i>
Join Netflix Party
</h3>
<div class="mb-4">
<label class="block text-gray-400 mb-2">Party Code</label>
<input type="text" placeholder="Enter party code" class="w-full bg-gray-700 text-white border border-gray-600 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-red-500">
</div>
<button class="w-full bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg transition-colors">
<i class="fas fa-sign-in-alt mr-2"></i>Join Party
</button>
</div>
<!-- Playlist -->
<div class="bg-gray-800 rounded-xl shadow-xl p-4 flex-1">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-lg">
<i class="fas fa-list-ul mr-2 text-blue-400"></i>
Your Playlist
</h3>
<div class="flex space-x-2">
<button class="text-gray-400 hover:text-white p-2">
<i class="fas fa-random"></i>
</button>
<button class="text-gray-400 hover:text-white p-2">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div id="playlist" class="space-y-3 max-h-96 overflow-y-auto">
<div class="flex items-center p-3 hover:bg-gray-700 rounded-lg cursor-pointer transition-colors video-thumbnail">
<div class="w-16 h-12 bg-gray-600 rounded overflow-hidden flex-shrink-0">
<img src="https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg" alt="Thumbnail" class="w-full h-full object-cover">
</div>
<div class="ml-3 flex-1 min-w-0">
<p class="text-sm font-medium truncate">Rick Astley - Never Gonna Give You Up</p>
<p class="text-xs text-gray-400 truncate">YouTube • 3:33</p>
</div>
<button class="text-gray-400 hover:text-red-500 p-2 transition-colors">
<i class="fas fa-trash"></i>
</button>
</div>
<div class="flex items-center p-3 hover:bg-gray-700 rounded-lg cursor-pointer transition-colors video-thumbnail">
<div class="w-16 h-12 bg-gray-600 rounded overflow-hidden flex-shrink-0">
<img src="https://i.ytimg.com/vi/JGwWNGJdvx8/hqdefault.jpg" alt="Thumbnail" class="w-full h-full object-cover">
</div>
<div class="ml-3 flex-1 min-w-0">
<p class="text-sm font-medium truncate">Ed Sheeran - Shape of You</p>
<p class="text-xs text-gray-400 truncate">YouTube • 4:23</p>
</div>
<button class="text-gray-400 hover:text-red-500 p-2 transition-colors">
<i class="fas fa-trash"></i>
</button>
</div>
<div class="flex items-center p-3 hover:bg-gray-700 rounded-lg cursor-pointer transition-colors video-thumbnail">
<div class="w-16 h-12 bg-gray-600 rounded overflow-hidden flex-shrink-0">
<img src="https://image.tmdb.org/t/p/w200/9yxep7oJdkQ3Hm4K23T0mPuHrzn.jpg" alt="Thumbnail" class="w-full h-full object-cover">
</div>
<div class="ml-3 flex-1 min-w-0">
<p class="text-sm font-medium truncate">Stranger Things S1E1</p>
<p class="text-xs text-gray-400 truncate">Netflix • 48:12</p>
</div>
<button class="text-gray-400 hover:text-red-500 p-2 transition-colors">
<i class="fas fa-trash"></i>
</button>
</div>
</div>
</div>
<!-- Chat -->
<div class="bg-gray-800 rounded-xl shadow-xl p-4 flex-1 flex flex-col">
<div class="flex justify-between items-center mb-4">
<h3 class="font-bold text-lg">
<i class="fas fa-comments mr-2 text-pink-400"></i>
Chat with Your Love
</h3>
<button class="text-gray-400 hover:text-white p-2">
<i class="fas fa-ellipsis-h"></i>
</button>
</div>
<div id="chatMessages" class="flex-1 space-y-3 overflow-y-auto mb-4">
<div class="chat-message received p-3 max-w-xs">
<p>Hey love! What should we watch next?</p>
<p class="text-xs text-gray-500 mt-1">2:45 PM</p>
</div>
<div class="chat-message sent p-3 max-w-xs">
<p>How about some romantic music videos? ❤️</p>
<p class="text-xs text-gray-400 mt-1">2:46 PM</p>
</div>
<div class="chat-message received p-3 max-w-xs">
<p>Or maybe a Netflix show we both like?</p>
<p class="text-xs text-gray-500 mt-1">2:47 PM</p>
</div>
</div>
<div class="flex">
<input id="chatInput" type="text" placeholder="Type a message..." class="flex-1 bg-gray-700 text-white border border-gray-600 rounded-l-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-pink-500">
<button id="sendMessageBtn" class="bg-pink-600 hover:bg-pink-700 text-white px-4 py-2 rounded-r-lg transition-colors">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-gray-800 p-4 text-center">
<p class="text-gray-400">Made with <i class="fas fa-heart text-pink-500"></i> for you and your love</p>
<p class="text-xs text-gray-500 mt-1">© 2023 TogetherFlix - Watch videos together in sync</p>
</footer>
</div>
<script>
// YouTube Player API
let player;
let isPlaying = false;
let currentVideoId = 'dQw4w9WgXcQ';
let currentPlatform = 'youtube'; // 'youtube' or 'netflix'
let videoChatOpen = false;
let webcamEnabled = false;
let micEnabled = false;
let localStream;
// DOM Elements
const youtubePlayerSection = document.getElementById('youtubePlayerSection');
const netflixPlayerSection = document.getElementById('netflixPlayerSection');
const youtubeSearchSection = document.getElementById('youtubeSearchSection');
const netflixJoinSection = document.getElementById('netflixJoinSection');
const netflixContentSection = document.getElementById('netflixContentSection');
const videoChatSection = document.getElementById('videoChatSection');
const youtubeTab = document.getElementById('youtubeTab');
const netflixTab = document.getElementById('netflixTab');
const mobileYoutubeTab = document.getElementById('mobileYoutubeTab');
const mobileNetflixTab = document.getElementById('mobileNetflixTab');
const playPauseBtn = document.getElementById('playPauseBtn');
const seekBar = document.getElementById('seekBar');
const currentTime = document.getElementById('currentTime');
const duration = document.getElementById('duration');
const syncBtn = document.getElementById('syncBtn');
const videoUrlInput = document.getElementById('videoUrlInput');
const addVideoBtn = document.getElementById('addVideoBtn');
const playlist = document.getElementById('playlist');
const chatMessages = document.getElementById('chatMessages');
const chatInput = document.getElementById('chatInput');
const sendMessageBtn = document.getElementById('sendMessageBtn');
const heartBtn = document.getElementById('heartBtn');
const videoChatBtn = document.getElementById('videoChatBtn');
const closeVideoChatBtn = document.getElementById('closeVideoChatBtn');
const toggleWebcamBtn = document.getElementById('toggleWebcamBtn');
const toggleMicBtn = document.getElementById('toggleMicBtn');
const localVideo = document.getElementById('localVideo');
const remoteVideo = document.getElementById('remoteVideo');
const startNetflixBtn = document.getElementById('startNetflixBtn');
// Platform switching
function switchPlatform(platform) {
currentPlatform = platform;
if (platform === 'youtube') {
youtubePlayerSection.classList.remove('hidden');
youtubeSearchSection.classList.remove('hidden');
netflixPlayerSection.classList.add('hidden');
netflixJoinSection.classList.add('hidden');
netflixContentSection.classList.add('hidden');
youtubeTab.classList.remove('inactive');
youtubeTab.classList.add('active');
netflixTab.classList.remove('active');
netflixTab.classList.add('inactive');
mobileYoutubeTab.classList.remove('inactive');
mobileYoutubeTab.classList.add('active');
mobileNetflixTab.classList.remove('active');
mobileNetflixTab.classList.add('inactive');
} else {
youtubePlayerSection.classList.add('hidden');
youtubeSearchSection.classList.add('hidden');
netflixPlayerSection.classList.remove('hidden');
netflixJoinSection.classList.remove('hidden');
netflixContentSection.classList.add('hidden');
youtubeTab.classList.remove('active');
youtubeTab.classList.add('inactive');
netflixTab.classList.remove('inactive');
netflixTab.classList.add('active');
mobileYoutubeTab.classList.remove('active');
mobileYoutubeTab.classList.add('inactive');
mobileNetflixTab.classList.remove('inactive');
mobileNetflixTab.classList.add('active');
}
}
youtubeTab.addEventListener('click', () => switchPlatform('youtube'));
netflixTab.addEventListener('click', () => switchPlatform('netflix'));
mobileYoutubeTab.addEventListener('click', () => switchPlatform('youtube'));
mobileNetflixTab.addEventListener('click', () => switchPlatform('netflix'));
// Start Netflix Party
startNetflixBtn.addEventListener('click', () => {
netflixPlayerSection.querySelector('.video-container > div').classList.add('hidden');
netflixContentSection.classList.remove('hidden');
// Simulate loading Netflix content
setTimeout(() => {
addMessageToChat("I started a Netflix party! Choose something for us to watch together.", 'sent');
// Simulate partner response
setTimeout(() => {
addMessageToChat("Awesome! Let's watch Stranger Things, I've heard it's good.", 'received');
}, 1500);
}, 1000);
});
// Video chat toggle
videoChatBtn.addEventListener('click', () => {
videoChatSection.classList.remove('hidden');
videoChatOpen = true;
});
closeVideoChatBtn.addEventListener('click', () => {
videoChatSection.classList.add('hidden');
videoChatOpen = false;
});
// Heart button animation
heartBtn.addEventListener('click', () => {
const heartIcon = heartBtn.querySelector('i');
heartIcon.classList.toggle('heart-pulse');
heartIcon.classList.toggle('text-pink-300');
// Send love message to chat
const loveMessages = [
"I love you! ❤️",
"You're the best! 💕",
"Thinking of you 😘",
"You make me so happy! 🥰",
"Sending you kisses! 💋",
"Can't wait to watch with you! 🎬",
"You're my favorite person to watch with 💑"
];
const randomMessage = loveMessages[Math.floor(Math.random() * loveMessages.length)];
addMessageToChat(randomMessage, 'sent');
});
// Toggle webcam
toggleWebcamBtn.addEventListener('click', async () => {
if (!webcamEnabled) {
try {
localStream = await navigator.mediaDevices.getUserMedia({
video: true,
audio: micEnabled
});
localVideo.srcObject = localStream;
toggleWebcamBtn.innerHTML = '<i class="fas fa-video-slash mr-2"></i>Disable Camera';
toggleWebcamBtn.classList.remove('bg-blue-600');
toggleWebcamBtn.classList.add('bg-red-600');
webcamEnabled = true;
// Simulate partner enabling webcam after 2 seconds
setTimeout(() => {
// In a real app, this would be from a WebRTC connection
if (videoChatOpen) {
remoteVideo.srcObject = localStream.clone();
document.querySelector('.webcam-container + .mt-3').innerHTML = `
<p class="text-green-400"><i class="fas fa-check-circle mr-1"></i> Connected</p>
`;
// Add chat notification
addMessageToChat("Video chat started! Can you see me?", 'sent');
setTimeout(() => {
addMessageToChat("Yes! You look amazing today 😍", 'received');
}, 1000);
}
}, 2000);
} catch (err) {
console.error("Error accessing webcam:", err);
alert("Could not access webcam. Please check permissions.");
}
} else {
localStream.getVideoTracks().forEach(track => track.stop());
localVideo.srcObject = null;
toggleWebcamBtn.innerHTML = '<i class="fas fa-video mr-2"></i>Enable Camera';
toggleWebcamBtn.classList.remove('bg-red-600');
toggleWebcamBtn.classList.add('bg-blue-600');
webcamEnabled = false;
// Simulate partner disabling webcam
if (remoteVideo.srcObject) {
remoteVideo.srcObject = null;
document.querySelector('.webcam-container + .mt-3').innerHTML = `
<i class="fas fa-user-clock text-xl mb-2"></i>
<p>Waiting for your partner to join...</p>
`;
addMessageToChat("I turned off my camera", 'sent');
}
}
});
// Toggle microphone
toggleMicBtn.addEventListener('click', async () => {
if (!micEnabled) {
try {
if (!localStream) {
localStream = await navigator.mediaDevices.getUserMedia({
audio: true,
video: webcamEnabled
});
localVideo.srcObject = localStream;
} else {
localStream.getAudioTracks().forEach(track => track.enabled = true);
}
toggleMicBtn.innerHTML = '<i class="fas fa-microphone-slash mr-2"></i>Mute';
toggleMicBtn.classList.remove('bg-gray-600');
toggleMicBtn.classList.add('bg-red-600');
micEnabled = true;
// Simulate partner enabling mic
setTimeout(() => {
addMessageToChat("Can you hear me now?", 'sent');
setTimeout(() => {
addMessageToChat("Yes! Your voice is crystal clear 🎙️", 'received');
}, 1000);
}, 500);
} catch (err) {
console.error("Error accessing microphone:", err);
alert("Could not access microphone. Please check permissions.");
}
} else {
if (localStream) {
localStream.getAudioTracks().forEach(track => track.enabled = false);
}
toggleMicBtn.innerHTML = '<i class="fas fa-microphone mr-2"></i>Unmute';
toggleMicBtn.classList.remove('bg-red-600');
toggleMicBtn.classList.add('bg-gray-600');
micEnabled = false;
// Simulate partner noticing mic is off
setTimeout(() => {
addMessageToChat("I think your mic is off", 'received');
}, 1500);
}
});
// Chat functionality
sendMessageBtn.addEventListener('click', sendMessage);
chatInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter') sendMessage();
});
function sendMessage() {
const message = chatInput.value.trim();
if (message) {
addMessageToChat(message, 'sent');
chatInput.value = '';
// Simulate partner reply after 1-3 seconds
setTimeout(() => {
const replies = [
"That's a great idea!",
"I love that!",
"Let's watch that next!",
"You're so cute when you say that 😊",
"I was thinking the same thing!",
"Sounds perfect! ❤️",
"Haha that's funny!",
"I miss you ❤️",
"Can't wait to watch with you!",
"You have the best taste in videos!"
];
const randomReply = replies[Math.floor(Math.random() * replies.length)];
addMessageToChat(randomReply, 'received');
}, 1000 + Math.random() * 2000);
}
}
function addMessageToChat(message, type) {
const now = new Date();
const timeString = now.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
const messageDiv = document.createElement('div');
messageDiv.className = `chat-message ${type} p-3 max-w-xs fade-in`;
messageDiv.innerHTML = `
<p>${message}</p>
<p class="text-xs ${type === 'sent' ? 'text-gray-400' : 'text-gray-500'} mt-1">${timeString}</p>
`;
chatMessages.appendChild(messageDiv);
chatMessages.scrollTop = chatMessages.scrollHeight;
}
// Video controls
playPauseBtn.addEventListener('click', () => {
if (isPlaying) {
// Pause video
playPauseBtn.innerHTML = '<i class="fas fa-play"></i>';
isPlaying = false;
// Add chat notification
if (currentPlatform === 'youtube') {
addMessageToChat("Paused the YouTube video", 'sent');
} else {
addMessageToChat("Paused the Netflix show", 'sent');
}
} else {
// Play video
playPauseBtn.innerHTML = '<i class="fas fa-pause"></i>';
isPlaying = true;
// Add chat notification
if (currentPlatform === 'youtube') {
addMessageToChat("Started playing the YouTube video", 'sent');
} else {
addMessageToChat("Started playing the Netflix show", 'sent');
}
}
});
seekBar.addEventListener('input', () => {
// Update video time based on seek bar
const seekTime = (seekBar.value / 100) * 213; // 3:33 in seconds
const minutes = Math.floor(seekTime / 60);
const seconds = Math.floor(seekTime % 60);
currentTime.textContent = `${minutes}:${seconds < 10 ? '0' + seconds : seconds}`;
});
syncBtn.addEventListener('click', () => {
// Simulate syncing video with partner
const notification = document.createElement('div');
notification.className = 'fixed bottom-4 right-4 bg-green-500 text-white px-4 py-2 rounded-lg shadow-lg flex items-center';
notification.innerHTML = `
<i class="fas fa-check-circle mr-2"></i>
<span>Video synced with your partner!</span>
`;
document.body.appendChild(notification);
setTimeout(() => {
notification.classList.add('opacity-0', 'transition-opacity', 'duration-500');
setTimeout(() => {
notification.remove();
}, 500);
}, 3000);
// Add chat notification
addMessageToChat("Just synced our video!", 'sent');
});
// Add video to playlist
addVideoBtn.addEventListener('click', () => {
const url = videoUrlInput.value.trim();
if (url) {
// Extract video ID from URL (simplified for demo)
let videoId = '';
if (url.includes('youtube.com/watch?v=')) {
videoId = url.split('v=')[1].split('&')[0];
} else if (url.includes('youtu.be/')) {
videoId = url.split('youtu.be/')[1].split('?')[0];
}
if (videoId) {
// In a real app, you would fetch video details from YouTube API
const videoItem = document.createElement('div');
videoItem.className = 'flex items-center p-3 hover:bg-gray-700 rounded-lg cursor-pointer transition-colors video-thumbnail';
videoItem.innerHTML = `
<div class="w-16 h-12 bg-gray-600 rounded overflow-hidden flex-shrink-0">
<img src="https://i.ytimg.com/vi/${videoId}/hqdefault.jpg" alt="Thumbnail" class="w-full h-full object-cover">
</div>
<div class="ml-3 flex-1 min-w-0">
<p class="text-sm font-medium truncate">New YouTube Video Added</p>
<p class="text-xs text-gray-400 truncate">YouTube • 0:00</p>
</div>
<button class="text-gray-400 hover:text-red-500 p-2 transition-colors">
<i class="fas fa-trash"></i>
</button>
`;
playlist.insertBefore(videoItem, playlist.firstChild);
videoUrlInput.value = '';
// Add chat notification
addMessageToChat("Added a new YouTube video to our playlist", 'sent');
// Simulate partner adding a video after 2 seconds
setTimeout(() => {
const partnerVideos = [
{ id: '9bZkp7q19f0', title: 'PSY - GANGNAM STYLE(강남스타일)' },
{ id: 'kJQP7kiw5Fk', title: 'Luis Fonsi - Despacito ft. Daddy Yankee' },
{ id: 'JGwWNGJdvx8', title: 'Ed Sheeran - Shape of You [Official Video]' }
];
const randomVideo = partnerVideos[Math.floor(Math.random() * partnerVideos.length)];
const partnerVideoItem = document.createElement('div');
partnerVideoItem.className = 'flex items-center p-3 hover:bg-gray-700 rounded-lg cursor-pointer transition-colors video-thumbnail';
partnerVideoItem.innerHTML = `
<div class="w-16 h-12 bg-gray-600 rounded overflow-hidden flex-shrink-0">
<img src="https://i.ytimg.com/vi/${randomVideo.id}/hqdefault.jpg" alt="Thumbnail" class="w-full h-full object-cover">
</div>
<div class="ml-3 flex-1 min-w-0">
<p class="text-sm font-medium truncate">${randomVideo.title}</p>
<p class="text-xs text-gray-400 truncate">YouTube • 0:00</p>
</div>
<button class="text-gray-400 hover:text-red-500 p-2 transition-colors">
<i class="fas fa-trash"></i>
</button>
`;
playlist.insertBefore(partnerVideoItem, playlist.firstChild);
// Add chat message
addMessageToChat(`I added "${randomVideo.title}" to our playlist!`, 'received');
}, 2000);
} else {
alert('Please enter a valid YouTube URL');
}
}
});
// Simulate video time updates
setInterval(() => {
if (isPlaying) {
let currentValue = parseInt(seekBar.value);
if (currentValue < 100) {
seekBar.value = currentValue + 1;
// Update time display
const seekTime = (seekBar.value / 100) * 213; // 3:33 in seconds
const minutes = Math.floor(seekTime / 60);
const seconds = Math.floor(seekTime % 60);
currentTime.textContent = `${minutes}:${seconds < 10 ? '0' + seconds : seconds}`;
} else {
isPlaying = false;
playPauseBtn.innerHTML = '<i class="fas fa-play"></i>';
// Add chat notification when video ends
if (currentPlatform === 'youtube') {
addMessageToChat("The YouTube video ended. What should we watch next?", 'sent');
} else {
addMessageToChat("The Netflix episode ended. Continue to next one?", 'sent');
}
}
}
}, 1000);
// Netflix show selection
document.querySelectorAll('.video-thumbnail').forEach(thumbnail => {
thumbnail.addEventListener('click', function() {
const showTitle = this.querySelector('p').textContent;
// Update Netflix player
netflixPlayerSection.querySelector('.video-container > div').classList.add('hidden');
const iframe = document.createElement('iframe');
iframe.src = "https://www.youtube.com/embed/dQw4w9WgXcQ?enablejsapi=1"; // Simulated Netflix player
iframe.className = "absolute top-0 left-0 w-full h-full";
iframe.setAttribute('frameborder', '0');
iframe.setAttribute('allowfullscreen', '');
netflixPlayerSection.querySelector('.video-container').appendChild(iframe);
// Update title
document.getElementById('netflixTitle').textContent = showTitle;
// Add chat notification
addMessageToChat(`Started playing "${showTitle}" on Netflix`, 'sent');
// Simulate partner joining
setTimeout(() => {
addMessageToChat("This show looks amazing! Thanks for choosing it ❤️", 'received');
}, 2000);
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Curlzz/l" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>