#chat-container{height:250px;overflow-y:auto;background:#111;padding:10px;border-radius:6px;margin-top:10px;} #chat-container p{margin:5px 0;} .flex-row{display:flex;align-items:center;gap:10px;} .hidden{display:none;} video{width:100%;max-width:500px;margin:10px 0;border-radius:8px;background:#000;}

Welcome to PlexStream

Featured Streams

Live Channels You Follow

Channel 1
Channel 2
PlexStream

Welcome to PlexStream

Featured Streams

Live Channels You Follow

Channel 1
Channel 2
======= function startBroadcast() { isStreaming = true; document.getElementById('streamContainer').style.display = 'flex'; document.getElementById('streamTitle').innerText = "Live Stream Title"; updateViewerCount(); } document.getElementById('go-live-btn').addEventListener('click',()=>{if(!currentUser)return alert("Login first"); showSection('dashboard');}); const startBtn=document.getElementById('start-stream-btn'); const stopBtn=document.getElementById('stop-stream-btn'); const broadcasterVideo=document.getElementById('broadcasterVideo'); const messagesDiv=document.getElementById('messages'); const chatInputDashboard=document.getElementById('chatInputDashboard'); const chatInput=document.getElementById('chat-input'); const chatSendBtn=document.getElementById('chat-send-btn'); const chatContainer=document.getElementById('chat-container'); let peerConnection; const config={iceServers:[{urls:'stun:stun.l.google.com:19302'}]}; let localChatLog=[]; function renderChat(message){ const p=document.createElement('p'); p.className='chat-msg'; const strong=document.createElement('strong'); const [user,text]=message.split(":"); strong.textContent=user; strong.style.color=userColors[user]||"#fff"; const span=document.createElement('span'); span.textContent=":"+text; p.appendChild(strong); p.appendChild(span); chatContainer.appendChild(p.cloneNode(true)); messagesDiv.appendChild(p.cloneNode(true)); chatContainer.scrollTop=chatContainer.scrollHeight; messagesDiv.scrollTop=messagesDiv.scrollHeight; } function sendMessageDashboard(){ const msg=chatInputDashboard.value.trim(); if(!currentUser){alert("Login first"); return;} if(msg){const fullMsg=currentUser+":"+msg; localChatLog.push(fullMsg); renderChat(fullMsg); chatInputDashboard.value='';} } function sendMessage(){ const msg=chatInput.value.trim(); if(!currentUser){alert("Login first"); return;} if(msg){const fullMsg=currentUser+":"+msg; localChatLog.push(fullMsg); renderChat(fullMsg); chatInput.value='';} } chatSendBtn.addEventListener('click',sendMessage); chatInput.addEventListener('keypress',e=>{if(e.key==='Enter') sendMessage();}); chatInputDashboard.addEventListener('keypress',e=>{if(e.key==='Enter') sendMessageDashboard();}); function toggleFollow(btn){btn.innerText = btn.innerText==='Follow'?'Following':'Follow';} startBtn.addEventListener('click',async ()=>{ if(!currentUser)return alert("Login first"); startBtn.classList.add('hidden'); stopBtn.classList.remove('hidden'); const stream=await navigator.mediaDevices.getUserMedia({video:true,audio:true}); broadcasterVideo.srcObject=stream; peerConnection=new RTCPeerConnection(config); stream.getTracks().forEach(track=>peerConnection.addTrack(track,stream)); peerConnection.onicecandidate=({candidate})=>{}; }); stopBtn.addEventListener('click',()=>{ stopBtn.classList.add('hidden'); startBtn.classList.remove('hidden'); if(peerConnection){peerConnection.getSenders().forEach(s=>peerConnection.removeTrack(s)); peerConnection.close(); peerConnection=null;} if(broadcasterVideo.srcObject){broadcasterVideo.srcObject.getTracks().forEach(t=>t.stop()); broadcasterVideo.srcObject=null;} }); function copyKey(){navigator.clipboard.writeText(document.getElementById('stream-key').innerText); alert('Copied!');} // SEARCH FUNCTION function searchStreams(){ const q=document.getElementById('searchInput').value.trim().toLowerCase(); const resultsDiv=document.getElementById('search-results'); resultsDiv.innerHTML=''; localChatLog.forEach(msg=>{ const [user,text]=msg.split(":"); if(user.toLowerCase().includes(q) || text.toLowerCase().includes(q)){ const div=document.createElement('div'); div.className='result-card'; div.textContent=`${user}: ${text}`; resultsDiv.appendChild(div); } }); } =======