<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Chigozzdev on Medium]]></title>
        <description><![CDATA[Stories by Chigozzdev on Medium]]></description>
        <link>https://medium.com/@chigozzdev?source=rss-2c2a38b18f27------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*QM9mdWR5buz2N8U3</url>
            <title>Stories by Chigozzdev on Medium</title>
            <link>https://medium.com/@chigozzdev?source=rss-2c2a38b18f27------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 07:17:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chigozzdev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Build a Celebrity Dating App like Raya]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-a-celebrity-dating-app-like-raya-ace267f4493b?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/ace267f4493b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Sat, 07 Jun 2025 13:54:37 GMT</pubDate>
            <atom:updated>2025-06-13T09:01:52.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVBlospK4LFeSCbJAmK20A.png" /></figure><p>Building a dating app that celebrities actually use sounds like a dream project. Raya has turned this dream into reality by creating the most exclusive dating platform in the world. This premium app charges $25 monthly and rejects over 90% of applicants, yet millions still desperately want to join.</p><p>Famous actors, musicians, and wealthy entrepreneurs use Raya to find dates within their exclusive circles. The app proves that scarcity creates demand in the dating world.</p><p>In this article, we’ll show you how to build a basic dating app like Raya. You’ll discover what makes Raya special, how its core features work, and the essential components needed to create your own version. We’ll walk through the fundamental building blocks, including user profiles, matching systems, and messaging features that bring people together.</p><h3>What is Raya?</h3><p>Raya is an exclusive dating app that launched in 2015. Unlike regular dating apps that anyone can join for free, Raya requires users to apply for membership and pay $25 each month if accepted.</p><p>The app only works on Apple devices like iPhones and iPads. Android users cannot download or use Raya, which adds to its exclusive appeal.</p><p>Getting accepted to Raya is extremely challenging. The app rejects more than 90% of people who apply. You need referrals from current members to even have a chance at approval. Some applicants wait months or years before getting accepted.</p><p>Raya attracts celebrities, actors, musicians, and wealthy professionals from creative industries. However, regular people can also get accepted if they work in interesting fields or have notable careers.</p><p>The app serves two main purposes. Most people use it for dating and finding relationships. Others use it for professional networking and making business connections within creative communities.</p><p>Raya has strict privacy rules that users must follow. Taking screenshots of profiles or conversations is forbidden. Breaking these rules can result in immediate removal from the platform.</p><p>The app gets its name from a Hebrew word meaning “friend.” This reflects Raya’s goal of building meaningful connections rather than promoting casual encounters. The platform focuses on quality relationships over quantity.</p><h3>How Does Raya Work?</h3><p>Raya operates through a strict application and membership system that sets it apart from regular dating apps. Here’s basically how Raya works:</p><ul><li><strong>Application process:</strong> Getting into Raya requires referrals from existing members. You submit an application with basic personal information, career details, and your Instagram handle. A committee of 500 trusted members reviews each application based on your social media presence, profession, and overall appeal to the community.</li><li><strong>Profile creation:</strong> Once accepted, you create a profile using a slideshow format with up to six photos. You choose a song that plays in the background when others view your profile. Your Instagram account gets linked automatically for verification. You can write a brief bio, though this is optional.</li><li><strong>Matching system:</strong> Raya shows you around 25 profiles at any time, not per day. You receive a few new profiles daily to review. The app connects users globally rather than focusing on local matches only. Both users must show interest to create a match and start messaging. Matches expire after 10 days if neither person initiates contact.</li><li><strong>Key features:</strong> The app includes a map feature for finding nearby users, a directory for searching members by profession or location, and both dating and networking modes. You can also pay to message users before matching.</li><li><strong>Privacy rules:</strong> Screenshots are completely forbidden and detected automatically. Sharing user information outside the platform or mentioning Raya users on social media results in immediate account removal.</li></ul><h3>How to Build a Celebrity Dating App like Raya</h3><p>Creating an exclusive dating platform like Raya requires premium features that attract high-profile users who value privacy and quality connections. Raya’s success stems from its selective membership process, sophisticated matching algorithms, and seamless communication tools that let celebrities and influencers connect safely.</p><p><a href="https://www.zegocloud.com/developers/sdks">ZEGOCLOUD SDKs</a> provide the real-time messaging and <a href="https://www.zegocloud.com/product/video-call">video calling infrastructure</a> you need to build these premium features without developing complex backend systems from scratch.</p><h3>Prerequisites</h3><p>Before building your celebrity dating app, make sure you have:</p><ul><li>A ZEGOCLOUD developer account (sign up at <a href="http://console.zegocloud.com/">console.zegocloud.com</a>).</li><li>AppID and ServerSecret from your ZEGOCLOUD Admin Console.</li><li>Node.js version 16 or higher installed.</li><li>Basic knowledge of React and JavaScript.</li><li>A modern web browser for development testing.</li></ul><p>Ready to start building? Let’s create your exclusive dating platform!</p><h3>1. Initialize Your React Project</h3><p>Start by creating a new React application using Vite for optimal development performance and faster build times:</p><pre>npm create vite@latest raya-dating-app — — template react<br>cd raya-dating-app<br>npm install</pre><p>This command creates a modern React application with all the development tools configured for building interactive dating app features.</p><h3>2. Install ZEGOCLOUD Communication SDKs</h3><p>Install both messaging and video calling SDKs to handle all communication between matched users:</p><pre>npm install zego-zim-web zego-express-engine-webrtc</pre><p>Your project structure should look like this:</p><pre>raya-dating-app/<br>├── public/<br>├── src/<br>│ ├── components/<br>│ │ ├── ProfileCard/<br>│ │ ├── SwipeInterface/<br>│ │ ├── ChatRoom/<br>│ │ └── VideoDate/<br>│ ├── utils/<br>│ │ └── config.js<br>│ ├── App.jsx<br>│ ├── App.css<br>│ └── main.jsx<br>├── package.json<br>└── vite.config.js</pre><h3>3. Configure Your App Settings</h3><p>Create a centralized configuration file that manages your ZEGOCLOUD credentials and app data. Create <strong>src/utils/config.js</strong>:</p><pre>export const DATING_CONFIG = {<br>    appID: your_zegocloud_app_id,<br>    serverSecret: &quot;your_zegocloud_server_secret&quot;<br>};<br><br>export function generateUserToken(userID) {<br>    // Development tokens for testing<br>    // In production, generate these securely on your backend<br>    const testTokens = {<br>        &quot;alexandra_model&quot;: &quot;dev_token_alexandra&quot;,<br>        &quot;james_actor&quot;: &quot;dev_token_james&quot;,<br>        &quot;sophia_artist&quot;: &quot;dev_token_sophia&quot;<br>    };<br>    <br>    return testTokens[userID] || &quot;&quot;;<br>}<br><br>export const DEMO_PROFILES = [<br>    {<br>        userID: &quot;alexandra_model&quot;,<br>        name: &quot;Alexandra&quot;,<br>        age: 28,<br>        profession: &quot;Fashion Model&quot;,<br>        location: &quot;Los Angeles, CA&quot;,<br>        photos: [&quot;/api/placeholder/400/600&quot;, &quot;/api/placeholder/400/600&quot;],<br>        interests: [&quot;Photography&quot;, &quot;Travel&quot;, &quot;Yoga&quot;],<br>        verified: true<br>    },<br>    {<br>        userID: &quot;james_actor&quot;,<br>        name: &quot;James&quot;,<br>        age: 32,<br>        profession: &quot;Film Actor&quot;,<br>        location: &quot;New York, NY&quot;, <br>        photos: [&quot;/api/placeholder/400/600&quot;, &quot;/api/placeholder/400/600&quot;],<br>        interests: [&quot;Theater&quot;, &quot;Fitness&quot;, &quot;Cooking&quot;],<br>        verified: true<br>    },<br>    {<br>        userID: &quot;sophia_artist&quot;,<br>        name: &quot;Sophia&quot;,<br>        age: 26,<br>        profession: &quot;Digital Artist&quot;,<br>        location: &quot;Miami, FL&quot;,<br>        photos: [&quot;/api/placeholder/400/600&quot;, &quot;/api/placeholder/400/600&quot;],<br>        interests: [&quot;Art&quot;, &quot;Music&quot;, &quot;Dancing&quot;],<br>        verified: true<br>    }<br>];</pre><p>This configuration provides everything needed for user authentication, profile management, and ZEGOCLOUD SDK integration.</p><h3>4. Build Your Profile Swipe Component</h3><p>Create the core swiping interface that lets users discover potential matches. Build <strong>src/components/SwipeInterface/SwipeInterface.jsx</strong>:</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br>import { DEMO_PROFILES } from &#39;../../utils/config&#39;;<br><br>const ProfileCard = ({ profile, onSwipe }) =&gt; {<br>  const [currentPhotoIndex, setCurrentPhotoIndex] = useState(0);<br><br>  const nextPhoto = () =&gt; {<br>    setCurrentPhotoIndex((prev) =&gt; <br>      prev &lt; profile.photos.length - 1 ? prev + 1 : 0<br>    );<br>  };<br><br>  const handleCardAction = (action) =&gt; {<br>    onSwipe(profile.userID, action);<br>  };<br><br>  return (<br>    &lt;div className=&quot;profile-card&quot;&gt;<br>      &lt;div className=&quot;photo-container&quot; onClick={nextPhoto}&gt;<br>        &lt;img <br>          src={profile.photos[currentPhotoIndex]} <br>          alt={`${profile.name}&#39;s photo`}<br>          className=&quot;profile-photo&quot;<br>        /&gt;<br>        &lt;div className=&quot;photo-indicators&quot;&gt;<br>          {profile.photos.map((_, index) =&gt; (<br>            &lt;div <br>              key={index}<br>              className={`indicator ${index === currentPhotoIndex ? &#39;active&#39; : &#39;&#39;}`}<br>            /&gt;<br>          ))}<br>        &lt;/div&gt;<br>        {profile.verified &amp;&amp; (<br>          &lt;div className=&quot;verification-badge&quot;&gt;✓ Verified&lt;/div&gt;<br>        )}<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;profile-info&quot;&gt;<br>        &lt;div className=&quot;name-age&quot;&gt;<br>          &lt;h2&gt;{profile.name}, {profile.age}&lt;/h2&gt;<br>        &lt;/div&gt;<br>        &lt;p className=&quot;profession&quot;&gt;{profile.profession}&lt;/p&gt;<br>        &lt;p className=&quot;location&quot;&gt;📍 {profile.location}&lt;/p&gt;<br>        <br>        &lt;div className=&quot;interests&quot;&gt;<br>          {profile.interests.map((interest, index) =&gt; (<br>            &lt;span key={index} className=&quot;interest-tag&quot;&gt;<br>              {interest}<br>            &lt;/span&gt;<br>          ))}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;action-buttons&quot;&gt;<br>        &lt;button <br>          className=&quot;pass-button&quot;<br>          onClick={() =&gt; handleCardAction(&#39;pass&#39;)}<br>        &gt;<br>          ✕<br>        &lt;/button&gt;<br>        &lt;button <br>          className=&quot;like-button&quot;<br>          onClick={() =&gt; handleCardAction(&#39;like&#39;)}<br>        &gt;<br>          ♥<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>const SwipeInterface = ({ currentUser, onMatch }) =&gt; {<br>  const [profiles, setProfiles] = useState([]);<br>  const [currentIndex, setCurrentIndex] = useState(0);<br><br>  useEffect(() =&gt; {<br>    // Filter out current user and load potential matches<br>    const availableProfiles = DEMO_PROFILES.filter(<br>      profile =&gt; profile.userID !== currentUser.userID<br>    );<br>    setProfiles(availableProfiles);<br>  }, [currentUser]);<br><br>  const handleSwipe = (profileID, action) =&gt; {<br>    if (action === &#39;like&#39;) {<br>      // Simulate match (in real app, this would be server logic)<br>      const matchedProfile = profiles.find(p =&gt; p.userID === profileID);<br>      onMatch(matchedProfile);<br>    }<br>    <br>    // Move to next profile<br>    setCurrentIndex(prev =&gt; prev + 1);<br>  };<br><br>  if (currentIndex &gt;= profiles.length) {<br>    return (<br>      &lt;div className=&quot;no-more-profiles&quot;&gt;<br>        &lt;h2&gt;🎯 You&#39;re all caught up!&lt;/h2&gt;<br>        &lt;p&gt;Check back later for new potential matches&lt;/p&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br><br>  return (<br>    &lt;div className=&quot;swipe-interface&quot;&gt;<br>      &lt;div className=&quot;app-header&quot;&gt;<br>        &lt;h1&gt;💎 RayaClone&lt;/h1&gt;<br>        &lt;div className=&quot;user-info&quot;&gt;<br>          Welcome, {currentUser.name}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;cards-container&quot;&gt;<br>        {profiles.slice(currentIndex, currentIndex + 2).map((profile, index) =&gt; (<br>          &lt;div <br>            key={profile.userID}<br>            className={`card-wrapper ${index === 0 ? &#39;current&#39; : &#39;next&#39;}`}<br>            style={{ zIndex: 2 - index }}<br>          &gt;<br>            &lt;ProfileCard profile={profile} onSwipe={handleSwipe} /&gt;<br>          &lt;/div&gt;<br>        ))}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default SwipeInterface;</pre><p>This component creates the signature Raya-style card interface with photo carousels, professional information, and swipe actions for discovering matches.</p><h3>5. Create Your Chat Component</h3><p>Build the messaging interface for matched users to communicate privately. Create <strong>src/components/ChatRoom/ChatRoom.jsx</strong>:</p><pre>import React, { useState, useEffect, useRef } from &#39;react&#39;;<br>import { ZIM } from &#39;zego-zim-web&#39;;<br>import { DATING_CONFIG, generateUserToken } from &#39;../../utils/config&#39;;<br><br>const ChatRoom = ({ currentUser, matchedUser, onVideoCall, onBack }) =&gt; {<br>  const [messages, setMessages] = useState([]);<br>  const [newMessage, setNewMessage] = useState(&#39;&#39;);<br>  const [zimInstance, setZimInstance] = useState(null);<br>  const [connectionStatus, setConnectionStatus] = useState(&#39;connecting&#39;);<br>  const messagesEndRef = useRef(null);<br><br>  useEffect(() =&gt; {<br>    initializeChat();<br>    return () =&gt; {<br>      disconnectChat();<br>    };<br>  }, [currentUser, matchedUser]);<br><br>  useEffect(() =&gt; {<br>    scrollToBottom();<br>  }, [messages]);<br><br>  const initializeChat = async () =&gt; {<br>    try {<br>      setConnectionStatus(&#39;connecting&#39;);<br>      <br>      const zim = ZIM.create({ appID: DATING_CONFIG.appID });<br>      <br>      // Set up message listeners<br>      zim.on(&#39;peerMessageReceived&#39;, handleIncomingMessage);<br>      zim.on(&#39;connectionStateChanged&#39;, handleConnectionChange);<br>      zim.on(&#39;error&#39;, handleError);<br><br>      // Login to ZIM<br>      const userInfo = {<br>        userID: currentUser.userID,<br>        userName: currentUser.name<br>      };<br>      <br>      await zim.login(userInfo, generateUserToken(currentUser.userID));<br>      <br>      setZimInstance(zim);<br>      setConnectionStatus(&#39;connected&#39;);<br>      <br>      // Load initial welcome message<br>      setMessages([{<br>        content: You matched with ${matchedUser.name}! Start the conversation.,<br>        timestamp: Date.now(),<br>        isSystem: true<br>      }]);<br>      <br>    } catch (error) {<br>      console.error(&#39;Chat initialization failed:&#39;, error);<br>      setConnectionStatus(&#39;error&#39;);<br>    }<br>  };<br><br>  const handleIncomingMessage = (zim, { messageList, fromConversationID }) =&gt; {<br>    if (fromConversationID === matchedUser.userID) {<br>      messageList.forEach(message =&gt; {<br>        setMessages(prev =&gt; [...prev, {<br>          content: message.message,<br>          timestamp: message.timestamp,<br>          isOwn: false,<br>          senderName: matchedUser.name<br>        }]);<br>      });<br>    }<br>  };<br><br>  const handleConnectionChange = (zim, { state, event }) =&gt; {<br>    if (state === 1) {<br>      setConnectionStatus(&#39;connected&#39;);<br>    } else if (state === 0) {<br>      setConnectionStatus(&#39;disconnected&#39;);<br>    }<br>  };<br><br>  const handleError = (zim, errorInfo) =&gt; {<br>    console.error(&#39;ZIM Error:&#39;, errorInfo);<br>    setConnectionStatus(&#39;error&#39;);<br>  };<br><br>  const sendMessage = async () =&gt; {<br>    if (!newMessage.trim() || !zimInstance) return;<br><br>    try {<br>      const messageObj = {<br>        type: 1, // Text message<br>        message: newMessage.trim()<br>      };<br><br>      await zimInstance.sendMessage(<br>        messageObj,<br>        matchedUser.userID,<br>        0, // Peer conversation<br>        { priority: 1 }<br>      );<br><br>      // Add to local messages<br>      setMessages(prev =&gt; [...prev, {<br>        content: newMessage.trim(),<br>        timestamp: Date.now(),<br>        isOwn: true<br>      }]);<br><br>      setNewMessage(&#39;&#39;);<br>    } catch (error) {<br>      console.error(&#39;Failed to send message:&#39;, error);<br>    }<br>  };<br><br>  const disconnectChat = async () =&gt; {<br>    if (zimInstance) {<br>      try {<br>        await zimInstance.logout();<br>        zimInstance.destroy();<br>      } catch (error) {<br>        console.error(&#39;Disconnect error:&#39;, error);<br>      }<br>    }<br>  };<br><br>  const scrollToBottom = () =&gt; {<br>    messagesEndRef.current?.scrollIntoView({ behavior: &quot;smooth&quot; });<br>  };<br><br>  const handleKeyPress = (e) =&gt; {<br>    if (e.key === &#39;Enter&#39; &amp;&amp; !e.shiftKey) {<br>      e.preventDefault();<br>      sendMessage();<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;chat-room&quot;&gt;<br>      &lt;div className=&quot;chat-header&quot;&gt;<br>        &lt;button onClick={onBack} className=&quot;back-button&quot;&gt;<br>          ← Back<br>        &lt;/button&gt;<br>        &lt;div className=&quot;match-info&quot;&gt;<br>          &lt;img <br>            src={matchedUser.photos[0]} <br>            alt={matchedUser.name}<br>            className=&quot;header-avatar&quot;<br>          /&gt;<br>          &lt;div className=&quot;match-details&quot;&gt;<br>            &lt;h3&gt;{matchedUser.name}&lt;/h3&gt;<br>            &lt;span className=&quot;status&quot;&gt;<br>              {connectionStatus === &#39;connected&#39; ? &#39;Online&#39; : &#39;Connecting...&#39;}<br>            &lt;/span&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;button onClick={onVideoCall} className=&quot;video-call-button&quot;&gt;<br>          📹 Video Date<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;messages-container&quot;&gt;<br>        {messages.map((message, index) =&gt; (<br>          &lt;div <br>            key={index} <br>            className={`message ${message.isOwn ? &#39;own&#39; : &#39;&#39;} ${message.isSystem ? &#39;system&#39; : &#39;&#39;}`}<br>          &gt;<br>            {!message.isOwn &amp;&amp; !message.isSystem &amp;&amp; (<br>              &lt;div className=&quot;sender-name&quot;&gt;{message.senderName}&lt;/div&gt;<br>            )}<br>            &lt;div className=&quot;message-bubble&quot;&gt;<br>              {message.content}<br>            &lt;/div&gt;<br>            &lt;div className=&quot;message-time&quot;&gt;<br>              {new Date(message.timestamp).toLocaleTimeString([], {<br>                hour: &#39;2-digit&#39;, <br>                minute: &#39;2-digit&#39;<br>              })}<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        ))}<br>        &lt;div ref={messagesEndRef} /&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;message-input-container&quot;&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          value={newMessage}<br>          onChange={(e) =&gt; setNewMessage(e.target.value)}<br>          onKeyPress={handleKeyPress}<br>          placeholder={`Message ${matchedUser.name}...`}<br>          className=&quot;message-input&quot;<br>          maxLength={500}<br>        /&gt;<br>        &lt;button <br>          onClick={sendMessage}<br>          disabled={!newMessage.trim()}<br>          className=&quot;send-button&quot;<br>        &gt;<br>          Send<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default ChatRoom;</pre><p>We used the ZEGOCLOUD’s ZIM SDK to enable real-time messaging between matched users with connection status monitoring and message history.</p><h3>6. Build Your Video Dating Component</h3><p>Create the video calling interface for face-to-face conversations. Build <strong>src/components/VideoDate/VideoDate.jsx</strong>:</p><pre>import React, { useState, useEffect, useRef } from &#39;react&#39;;<br>import { ZegoExpressEngine } from &#39;zego-express-engine-webrtc&#39;;<br>import { DATING_CONFIG } from &#39;../../utils/config&#39;;<br><br>const VideoDate = ({ currentUser, matchedUser, onEndCall }) =&gt; {<br>  const [engineInstance, setEngineInstance] = useState(null);<br>  const [callStatus, setCallStatus] = useState(&#39;connecting&#39;);<br>  const [localStream, setLocalStream] = useState(null);<br>  const [remoteStream, setRemoteStream] = useState(null);<br>  const [micEnabled, setMicEnabled] = useState(true);<br>  const [cameraEnabled, setCameraEnabled] = useState(true);<br>  const localVideoRef = useRef(null);<br>  const remoteVideoRef = useRef(null);<br><br>  useEffect(() =&gt; {<br>    startVideoCall();<br>    return () =&gt; {<br>      endVideoCall();<br>    };<br>  }, []);<br><br>  const startVideoCall = async () =&gt; {<br>    try {<br>      setCallStatus(&#39;connecting&#39;);<br><br>      // Create engine instance<br>      const engine = new ZegoExpressEngine(<br>        DATING_CONFIG.appID,<br>        &quot;wss://webliveroom-api.zego.im/ws&quot;<br>      );<br><br>      // Set up event listeners<br>      engine.on(&#39;roomStateUpdate&#39;, handleRoomStateUpdate);<br>      engine.on(&#39;roomStreamUpdate&#39;, handleStreamUpdate);<br>      engine.on(&#39;publisherStateUpdate&#39;, handlePublisherStateUpdate);<br><br>      setEngineInstance(engine);<br><br>      // Generate unique room ID for this video date<br>      const roomID = date_${currentUser.userID}_${matchedUser.userID}_${Date.now()};<br>      <br>      // Login to room<br>      await engine.loginRoom(roomID, {<br>        userID: currentUser.userID,<br>        userName: currentUser.name<br>      });<br><br>      // Create and publish local stream<br>      const stream = await engine.createStream({<br>        camera: {<br>          audio: true,<br>          video: true,<br>          videoQuality: 4 // High quality for dating<br>        }<br>      });<br><br>      if (localVideoRef.current) {<br>        stream.play(localVideoRef.current);<br>      }<br><br>      await engine.startPublishingStream(currentUser.userID, stream);<br>      setLocalStream(stream);<br>      setCallStatus(&#39;connected&#39;);<br><br>    } catch (error) {<br>      console.error(&#39;Video call failed:&#39;, error);<br>      setCallStatus(&#39;error&#39;);<br>    }<br>  };<br><br>  const handleRoomStateUpdate = (roomID, state, errorCode) =&gt; {<br>    if (state === &#39;CONNECTED&#39;) {<br>      setCallStatus(&#39;connected&#39;);<br>    } else if (state === &#39;DISCONNECTED&#39;) {<br>      setCallStatus(&#39;disconnected&#39;);<br>    }<br>  };<br><br>  const handleStreamUpdate = async (roomID, updateType, streamList) =&gt; {<br>    if (updateType === &#39;ADD&#39; &amp;&amp; streamList.length &gt; 0) {<br>      try {<br>        // Play remote user&#39;s stream<br>        const remoteStreamObj = await engineInstance.startPlayingStream(<br>          streamList[0].streamID<br>        );<br>        <br>        if (remoteVideoRef.current) {<br>          remoteStreamObj.play(remoteVideoRef.current);<br>        }<br>        <br>        setRemoteStream(remoteStreamObj);<br>        setCallStatus(&#39;active&#39;);<br>      } catch (error) {<br>        console.error(&#39;Failed to play remote stream:&#39;, error);<br>      }<br>    } else if (updateType === &#39;DELETE&#39;) {<br>      setRemoteStream(null);<br>      // Other user left, end call after short delay<br>      setTimeout(() =&gt; onEndCall(), 2000);<br>    }<br>  };<br><br>  const handlePublisherStateUpdate = (result) =&gt; {<br>    if (result.state === &#39;PUBLISHING&#39;) {<br>      console.log(&#39;Successfully publishing stream&#39;);<br>    }<br>  };<br><br>  const toggleMicrophone = async () =&gt; {<br>    if (engineInstance &amp;&amp; localStream) {<br>      try {<br>        await engineInstance.mutePublishStreamAudio(localStream, !micEnabled);<br>        setMicEnabled(!micEnabled);<br>      } catch (error) {<br>        console.error(&#39;Failed to toggle microphone:&#39;, error);<br>      }<br>    }<br>  };<br><br>  const toggleCamera = async () =&gt; {<br>    if (engineInstance &amp;&amp; localStream) {<br>      try {<br>        await engineInstance.mutePublishStreamVideo(localStream, !cameraEnabled);<br>        setCameraEnabled(!cameraEnabled);<br>      } catch (error) {<br>        console.error(&#39;Failed to toggle camera:&#39;, error);<br>      }<br>    }<br>  };<br><br>  const endVideoCall = async () =&gt; {<br>    try {<br>      if (engineInstance) {<br>        if (localStream) {<br>          await engineInstance.stopPublishingStream(currentUser.userID);<br>          engineInstance.destroyStream(localStream);<br>        }<br>        if (remoteStream) {<br>          await engineInstance.stopPlayingStream(remoteStream.streamID);<br>        }<br>        await engineInstance.logoutRoom();<br>        engineInstance.destroyEngine();<br>      }<br>      onEndCall();<br>    } catch (error) {<br>      console.error(&#39;Error ending call:&#39;, error);<br>      onEndCall();<br>    }<br>  };<br><br>  const getStatusMessage = () =&gt; {<br>    switch (callStatus) {<br>      case &#39;connecting&#39;:<br>        return Connecting to ${matchedUser.name}...;<br>      case &#39;connected&#39;:<br>        return Waiting for ${matchedUser.name} to join...;<br>      case &#39;active&#39;:<br>        return Video date with ${matchedUser.name};<br>      case &#39;error&#39;:<br>        return &#39;Connection failed&#39;;<br>      case &#39;disconnected&#39;:<br>        return &#39;Call ended&#39;;<br>      default:<br>        return &#39;&#39;;<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;video-date&quot;&gt;<br>      &lt;div className=&quot;video-container&quot;&gt;<br>        &lt;div className=&quot;remote-video-wrapper&quot;&gt;<br>          &lt;video <br>            ref={remoteVideoRef}<br>            className=&quot;remote-video&quot;<br>            autoPlay<br>            playsInline<br>            muted={false}<br>          /&gt;<br>          {!remoteStream &amp;&amp; (<br>            &lt;div className=&quot;video-placeholder&quot;&gt;<br>              &lt;div className=&quot;placeholder-avatar&quot;&gt;<br>                &lt;img src={matchedUser.photos[0]} alt={matchedUser.name} /&gt;<br>              &lt;/div&gt;<br>              &lt;div className=&quot;status-text&quot;&gt;{getStatusMessage()}&lt;/div&gt;<br>            &lt;/div&gt;<br>          )}<br>        &lt;/div&gt;<br>        <br>        &lt;div className=&quot;local-video-wrapper&quot;&gt;<br>          &lt;video <br>            ref={localVideoRef}<br>            className=&quot;local-video&quot;<br>            autoPlay<br>            playsInline<br>            muted={true}<br>          /&gt;<br>          {!cameraEnabled &amp;&amp; (<br>            &lt;div className=&quot;video-off-indicator&quot;&gt;Camera Off&lt;/div&gt;<br>          )}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;call-controls&quot;&gt;<br>        &lt;button <br>          onClick={toggleMicrophone}<br>          className={`control-button ${micEnabled ? &#39;active&#39; : &#39;inactive&#39;}`}<br>        &gt;<br>          {micEnabled ? &#39;🎤&#39; : &#39;🔇&#39;}<br>        &lt;/button&gt;<br>        <br>        &lt;button <br>          onClick={toggleCamera}<br>          className={`control-button ${cameraEnabled ? &#39;active&#39; : &#39;inactive&#39;}`}<br>        &gt;<br>          {cameraEnabled ? &#39;📹&#39; : &#39;📵&#39;}<br>        &lt;/button&gt;<br>        <br>        &lt;button <br>          onClick={endVideoCall}<br>          className=&quot;control-button end-call&quot;<br>        &gt;<br>          📞 End Date<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br><br>      &lt;div className=&quot;call-info&quot;&gt;<br>        &lt;h3&gt;Video Date&lt;/h3&gt;<br>        &lt;p&gt;{getStatusMessage()}&lt;/p&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default VideoDate;</pre><p>The video dating component uses the ZEGOCLOUD’s Express SDK to create high-quality video calls between matched users with professional controls and status monitoring.</p><h3>7. Integrate Your Main App Logic</h3><p>Bring all components together in your main application file. Replace <strong>src/App.jsx</strong>:</p><pre>import React, { useState } from &#39;react&#39;;<br>import SwipeInterface from &#39;./components/SwipeInterface/SwipeInterface&#39;;<br>import ChatRoom from &#39;./components/ChatRoom/ChatRoom&#39;;<br>import VideoDate from &#39;./components/VideoDate/VideoDate&#39;;<br>import { DEMO_PROFILES } from &#39;./utils/config&#39;;<br>import &#39;./App.css&#39;;<br><br>const LoginScreen = ({ onLogin }) =&gt; {<br>  const [selectedUser, setSelectedUser] = useState(&#39;&#39;);<br><br>  const handleLogin = () =&gt; {<br>    if (selectedUser) {<br>      const user = DEMO_PROFILES.find(p =&gt; p.userID === selectedUser);<br>      onLogin(user);<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;login-screen&quot;&gt;<br>      &lt;div className=&quot;login-container&quot;&gt;<br>        &lt;h1&gt;💎 RayaClone&lt;/h1&gt;<br>        &lt;p&gt;Exclusive dating for verified professionals&lt;/p&gt;<br>        <br>        &lt;div className=&quot;demo-login&quot;&gt;<br>          &lt;h3&gt;Demo Login&lt;/h3&gt;<br>          &lt;p&gt;Choose a profile to experience the app:&lt;/p&gt;<br>          <br>          &lt;div className=&quot;profile-selector&quot;&gt;<br>            {DEMO_PROFILES.map(profile =&gt; (<br>              &lt;div <br>                key={profile.userID}<br>                className={`profile-option ${selectedUser === profile.userID ? &#39;selected&#39; : &#39;&#39;}`}<br>                onClick={() =&gt; setSelectedUser(profile.userID)}<br>              &gt;<br>                &lt;img src={profile.photos[0]} alt={profile.name} /&gt;<br>                &lt;div className=&quot;profile-details&quot;&gt;<br>                  &lt;h4&gt;{profile.name}&lt;/h4&gt;<br>                  &lt;p&gt;{profile.profession}&lt;/p&gt;<br>                &lt;/div&gt;<br>              &lt;/div&gt;<br>            ))}<br>          &lt;/div&gt;<br>          <br>          &lt;button <br>            onClick={handleLogin}<br>            disabled={!selectedUser}<br>            className=&quot;login-button&quot;<br>          &gt;<br>            Enter RayaClone<br>          &lt;/button&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>const MatchNotification = ({ match, onStartChat, onClose }) =&gt; {<br>  return (<br>    &lt;div className=&quot;match-overlay&quot;&gt;<br>      &lt;div className=&quot;match-notification&quot;&gt;<br>        &lt;h2&gt;✨ It&#39;s a Match!&lt;/h2&gt;<br>        &lt;div className=&quot;matched-users&quot;&gt;<br>          &lt;img src={match.photos[0]} alt={match.name} /&gt;<br>        &lt;/div&gt;<br>        &lt;p&gt;You and {match.name} liked each other&lt;/p&gt;<br>        &lt;div className=&quot;match-actions&quot;&gt;<br>          &lt;button onClick={onStartChat} className=&quot;start-chat-button&quot;&gt;<br>            💬 Start Conversation<br>          &lt;/button&gt;<br>          &lt;button onClick={onClose} className=&quot;continue-button&quot;&gt;<br>            Keep Swiping<br>          &lt;/button&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>function App() {<br>  const [currentUser, setCurrentUser] = useState(null);<br>  const [currentScreen, setCurrentScreen] = useState(&#39;login&#39;);<br>  const [activeMatch, setActiveMatch] = useState(null);<br>  const [showMatchNotification, setShowMatchNotification] = useState(false);<br>  const [matches, setMatches] = useState([]);<br><br>  const handleLogin = (user) =&gt; {<br>    setCurrentUser(user);<br>    setCurrentScreen(&#39;swipe&#39;);<br>  };<br><br>  const handleMatch = (matchedProfile) =&gt; {<br>    setActiveMatch(matchedProfile);<br>    setMatches(prev =&gt; [...prev, matchedProfile]);<br>    setShowMatchNotification(true);<br>  };<br><br>  const startChatWithMatch = () =&gt; {<br>    setShowMatchNotification(false);<br>    setCurrentScreen(&#39;chat&#39;);<br>  };<br><br>  const startVideoDate = () =&gt; {<br>    setCurrentScreen(&#39;video&#39;);<br>  };<br><br>  const endVideoDate = () =&gt; {<br>    setCurrentScreen(&#39;chat&#39;);<br>  };<br><br>  const goBackToSwipe = () =&gt; {<br>    setCurrentScreen(&#39;swipe&#39;);<br>    setActiveMatch(null);<br>  };<br><br>  const renderCurrentScreen = () =&gt; {<br>    switch (currentScreen) {<br>      case &#39;login&#39;:<br>        return &lt;LoginScreen onLogin={handleLogin} /&gt;;<br>        <br>      case &#39;swipe&#39;:<br>        return (<br>          &lt;SwipeInterface <br>            currentUser={currentUser}<br>            onMatch={handleMatch}<br>          /&gt;<br>        );<br>        <br>      case &#39;chat&#39;:<br>        return (<br>          &lt;ChatRoom<br>            currentUser={currentUser}<br>            matchedUser={activeMatch}<br>            onVideoCall={startVideoDate}<br>            onBack={goBackToSwipe}<br>          /&gt;<br>        );<br>        <br>      case &#39;video&#39;:<br>        return (<br>          &lt;VideoDate<br>            currentUser={currentUser}<br>            matchedUser={activeMatch}<br>            onEndCall={endVideoDate}<br>          /&gt;<br>        );<br>        <br>      default:<br>        return &lt;LoginScreen onLogin={handleLogin} /&gt;;<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;app&quot;&gt;<br>      {renderCurrentScreen()}<br>      <br>      {showMatchNotification &amp;&amp; activeMatch &amp;&amp; (<br>        &lt;MatchNotification<br>          match={activeMatch}<br>          onStartChat={startChatWithMatch}<br>          onClose={() =&gt; setShowMatchNotification(false)}<br>        /&gt;<br>      )}<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>Your main app coordinates between swiping, matching, chatting, and video dating while maintaining clean state management across all user interactions.</p><h3>8. Style Your Dating App</h3><p>Create an elegant design that appeals to exclusive users. Replace <strong>src/App.css</strong>:</p><pre> *{<br>  margin: 0;<br>  padding: 0;<br>  box-sizing: border-box;<br>}<br><br>body {<br>  font-family: -apple-system, BlinkMacSystemFont, &#39;Segoe UI&#39;, &#39;Inter&#39;, sans-serif;<br>  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);<br>  color: #333;<br>  overflow-x: hidden;<br>}<br><br>.app {<br>  min-height: 100vh;<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  padding: 1rem;<br>  width: 100vw;<br>}<br><br>/ Login Screen /<br>.login-screen {<br>  width: 100%;<br>  max-width: 500px;<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>}<br><br>.login-container {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  padding: 3rem;<br>  border-radius: 24px;<br>  text-align: center;<br>  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);<br>  border: 1px solid rgba(255, 255, 255, 0.2);<br>}<br><br>.login-container h1 {<br>  font-size: 3rem;<br>  margin-bottom: 1rem;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  -webkit-background-clip: text;<br>  -webkit-text-fill-color: transparent;<br>  font-weight: 700;<br>}<br><br>.login-container p {<br>  color: #666;<br>  margin-bottom: 2rem;<br>  font-size: 1.1rem;<br>}<br><br>.demo-login {<br>  display: flex;<br>  flex-direction: column;<br>  align-items: center;<br>  width: 100%;<br>}<br><br>.demo-login h3 {<br>  margin-bottom: 1rem;<br>  color: #333;<br>  font-weight: 600;<br>  text-align: center;<br>}<br><br>.demo-login p {<br>  text-align: center;<br>  margin-bottom: 2rem;<br>}<br><br>.profile-selector {<br>  display: flex;<br>  flex-direction: column;<br>  gap: 1rem;<br>  margin: 2rem 0;<br>  width: 100%;<br>  max-width: 350px;<br>}<br><br>.profile-option {<br>  display: flex;<br>  align-items: center;<br>  justify-content: flex-start;<br>  gap: 1rem;<br>  padding: 1rem;<br>  border: 2px solid #e5e7eb;<br>  border-radius: 16px;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>  background: rgba(255, 255, 255, 0.8);<br>  width: 100%;<br>}<br><br>.profile-option:hover {<br>  border-color: #667eea;<br>  transform: translateY(-2px);<br>  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);<br>}<br><br>.profile-option.selected {<br>  border-color: #667eea;<br>  background: rgba(102, 126, 234, 0.1);<br>}<br><br>.profile-option img {<br>  width: 60px;<br>  height: 60px;<br>  border-radius: 12px;<br>  object-fit: cover;<br>}<br><br>.profile-details {<br>  text-align: left;<br>  flex: 1;<br>}<br><br>.profile-details h4 {<br>  margin-bottom: 0.25rem;<br>  font-weight: 600;<br>}<br><br>.profile-details p {<br>  color: #666;<br>  font-size: 0.9rem;<br>  margin: 0;<br>}<br><br>.login-button {<br>  width: 100%;<br>  max-width: 350px;<br>  padding: 16px;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  border: none;<br>  border-radius: 16px;<br>  font-size: 16px;<br>  font-weight: 600;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);<br>  margin: 0 auto;<br>}<br><br>.login-button:hover:not(:disabled) {<br>  transform: translateY(-2px);<br>  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);<br>}<br><br>.login-button:disabled {<br>  opacity: 0.5;<br>  cursor: not-allowed;<br>  transform: none;<br>}<br><br>/ Swipe Interface /<br>.swipe-interface {<br>  width: 100%;<br>  max-width: 400px;<br>  height: 90vh;<br>  max-height: 700px;<br>  display: flex;<br>  flex-direction: column;<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  border-radius: 24px;<br>  overflow: hidden;<br>  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);<br>}<br><br>.app-header {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  padding: 1.5rem 2rem;<br>  text-align: center;<br>}<br><br>.app-header h1 {<br>  font-size: 1.8rem;<br>  font-weight: 700;<br>  margin-bottom: 0.5rem;<br>}<br><br>.user-info {<br>  opacity: 0.9;<br>  font-size: 0.9rem;<br>}<br><br>.cards-container {<br>  flex: 1;<br>  position: relative;<br>  padding: 2rem;<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>}<br><br>.card-wrapper {<br>  position: absolute;<br>  width: 100%;<br>  max-width: 320px;<br>  height: 500px;<br>}<br><br>.card-wrapper.next {<br>  transform: scale(0.95) translateY(10px);<br>  opacity: 0.7;<br>}<br><br>.profile-card {<br>  width: 100%;<br>  height: 100%;<br>  background: white;<br>  border-radius: 20px;<br>  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);<br>  overflow: hidden;<br>  position: relative;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>}<br><br>.profile-card:hover {<br>  transform: translateY(-5px);<br>  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);<br>}<br><br>.photo-container {<br>  position: relative;<br>  height: 65%;<br>  overflow: hidden;<br>}<br><br>.profile-photo {<br>  width: 100%;<br>  height: 100%;<br>  object-fit: cover;<br>}<br><br>.photo-indicators {<br>  position: absolute;<br>  top: 1rem;<br>  left: 50%;<br>  transform: translateX(-50%);<br>  display: flex;<br>  gap: 0.5rem;<br>}<br><br>.indicator {<br>  width: 8px;<br>  height: 8px;<br>  border-radius: 50%;<br>  background: rgba(255, 255, 255, 0.5);<br>  transition: all 0.3s ease;<br>}<br><br>.indicator.active {<br>  background: white;<br>  transform: scale(1.2);<br>}<br><br>.verification-badge {<br>  position: absolute;<br>  top: 1rem;<br>  right: 1rem;<br>  background: rgba(34, 197, 94, 0.9);<br>  color: white;<br>  padding: 0.5rem 1rem;<br>  border-radius: 20px;<br>  font-size: 0.8rem;<br>  font-weight: 600;<br>  backdrop-filter: blur(10px);<br>}<br><br>.profile-info {<br>  padding: 1.5rem;<br>  height: 35%;<br>  display: flex;<br>  flex-direction: column;<br>  justify-content: space-between;<br>}<br><br>.name-age h2 {<br>  font-size: 1.5rem;<br>  font-weight: 700;<br>  margin-bottom: 0.5rem;<br>  color: #333;<br>}<br><br>.profession {<br>  color: #666;<br>  font-weight: 500;<br>  margin-bottom: 0.25rem;<br>}<br><br>.location {<br>  color: #888;<br>  font-size: 0.9rem;<br>  margin-bottom: 1rem;<br>}<br><br>.interests {<br>  display: flex;<br>  flex-wrap: wrap;<br>  gap: 0.5rem;<br>}<br><br>.interest-tag {<br>  background: rgba(102, 126, 234, 0.1);<br>  color: #667eea;<br>  padding: 0.25rem 0.75rem;<br>  border-radius: 20px;<br>  font-size: 0.8rem;<br>  font-weight: 500;<br>}<br><br>.action-buttons {<br>  position: absolute;<br>  bottom: 1rem;<br>  right: 1rem;<br>  display: flex;<br>  gap: 1rem;<br>}<br><br>.pass-button,<br>.like-button {<br>  width: 50px;<br>  height: 50px;<br>  border-radius: 50%;<br>  border: none;<br>  font-size: 1.5rem;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);<br>}<br><br>.pass-button {<br>  background: linear-gradient(135deg, #f87171, #ef4444);<br>  color: white;<br>}<br><br>.like-button {<br>  background: linear-gradient(135deg, #10b981, #059669);<br>  color: white;<br>}<br><br>.pass-button:hover,<br>.like-button:hover {<br>  transform: translateY(-2px) scale(1.1);<br>  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);<br>}<br><br>.no-more-profiles {<br>  text-align: center;<br>  padding: 3rem;<br>  color: #666;<br>}<br><br>.no-more-profiles h2 {<br>  font-size: 2rem;<br>  margin-bottom: 1rem;<br>  color: #333;<br>}<br><br>/ Match Notification /<br>.match-overlay {<br>  position: fixed;<br>  top: 0;<br>  left: 0;<br>  width: 100vw;<br>  height: 100vh;<br>  background: rgba(0, 0, 0, 0.8);<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  z-index: 1000;<br>  backdrop-filter: blur(10px);<br>}<br><br>.match-notification {<br>  background: white;<br>  padding: 3rem;<br>  border-radius: 24px;<br>  text-align: center;<br>  max-width: 400px;<br>  margin: 2rem;<br>  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);<br>}<br><br>.match-notification h2 {<br>  font-size: 2.5rem;<br>  margin-bottom: 2rem;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  -webkit-background-clip: text;<br>  -webkit-text-fill-color: transparent;<br>  font-weight: 700;<br>}<br><br>.matched-users img {<br>  width: 120px;<br>  height: 120px;<br>  border-radius: 50%;<br>  object-fit: cover;<br>  border: 4px solid #667eea;<br>  margin-bottom: 1.5rem;<br>}<br><br>.match-notification p {<br>  font-size: 1.2rem;<br>  color: #666;<br>  margin-bottom: 2rem;<br>}<br><br>.match-actions {<br>  display: flex;<br>  flex-direction: column;<br>  gap: 1rem;<br>}<br><br>.start-chat-button,<br>.continue-button {<br>  padding: 16px 24px;<br>  border: none;<br>  border-radius: 16px;<br>  font-size: 16px;<br>  font-weight: 600;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>}<br><br>.start-chat-button {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);<br>}<br><br>.continue-button {<br>  background: rgba(102, 126, 234, 0.1);<br>  color: #667eea;<br>  border: 1px solid #667eea;<br>}<br><br>.start-chat-button:hover,<br>.continue-button:hover {<br>  transform: translateY(-2px);<br>}<br><br>/ Chat Room /<br>.chat-room {<br>  width: 100%;<br>  max-width: 450px;<br>  height: 90vh;<br>  max-height: 700px;<br>  display: flex;<br>  flex-direction: column;<br>  background: white;<br>  border-radius: 24px;<br>  overflow: hidden;<br>  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);<br>}<br><br>.chat-header {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  padding: 1.5rem 2rem;<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>}<br><br>.back-button {<br>  background: rgba(255, 255, 255, 0.2);<br>  color: white;<br>  border: none;<br>  padding: 8px 12px;<br>  border-radius: 8px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>}<br><br>.back-button:hover {<br>  background: rgba(255, 255, 255, 0.3);<br>}<br><br>.match-info {<br>  display: flex;<br>  align-items: center;<br>  gap: 1rem;<br>  flex: 1;<br>  justify-content: center;<br>}<br><br>.header-avatar {<br>  width: 40px;<br>  height: 40px;<br>  border-radius: 50%;<br>  object-fit: cover;<br>  border: 2px solid rgba(255, 255, 255, 0.3);<br>}<br><br>.match-details h3 {<br>  font-weight: 700;<br>  margin-bottom: 0.25rem;<br>}<br><br>.status {<br>  font-size: 0.8rem;<br>  opacity: 0.8;<br>}<br><br>.video-call-button {<br>  background: rgba(255, 255, 255, 0.2);<br>  color: white;<br>  border: none;<br>  padding: 8px 12px;<br>  border-radius: 8px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>}<br><br>.video-call-button:hover {<br>  background: rgba(255, 255, 255, 0.3);<br>}<br><br>.messages-container {<br>  flex: 1;<br>  padding: 2rem;<br>  overflow-y: auto;<br>  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);<br>}<br><br>.message {<br>  margin-bottom: 1.5rem;<br>  display: flex;<br>  flex-direction: column;<br>}<br><br>.message.own {<br>  align-items: flex-end;<br>}<br><br>.message.system {<br>  align-items: center;<br>}<br><br>.sender-name {<br>  font-size: 0.8rem;<br>  color: #666;<br>  margin-bottom: 0.25rem;<br>  font-weight: 500;<br>}<br><br>.message-bubble {<br>  max-width: 75%;<br>  padding: 12px 16px;<br>  border-radius: 20px;<br>  word-wrap: break-word;<br>  line-height: 1.5;<br>  font-size: 0.95rem;<br>}<br><br>.message.own .message-bubble {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  border-bottom-right-radius: 6px;<br>}<br><br>.message:not(.own):not(.system) .message-bubble {<br>  background: white;<br>  color: #333;<br>  border: 1px solid #e5e7eb;<br>  border-bottom-left-radius: 6px;<br>  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);<br>}<br><br>.message.system .message-bubble {<br>  background: rgba(102, 126, 234, 0.1);<br>  color: #667eea;<br>  font-style: italic;<br>  border-radius: 16px;<br>  text-align: center;<br>}<br><br>.message-time {<br>  font-size: 0.75rem;<br>  color: #999;<br>  margin-top: 0.25rem;<br>}<br><br>.message-input-container {<br>  padding: 1.5rem 2rem;<br>  background: white;<br>  border-top: 1px solid #e5e7eb;<br>  display: flex;<br>  gap: 1rem;<br>  align-items: center;<br>}<br><br>.message-input {<br>  flex: 1;<br>  padding: 12px 16px;<br>  border: 2px solid #e5e7eb;<br>  border-radius: 20px;<br>  outline: none;<br>  font-size: 16px;<br>  transition: all 0.3s ease;<br>}<br><br>.message-input:focus {<br>  border-color: #667eea;<br>  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);<br>}<br><br>.send-button {<br>  padding: 12px 20px;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  border: none;<br>  border-radius: 20px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>}<br><br>.send-button:hover:not(:disabled) {<br>  transform: translateY(-1px);<br>  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);<br>}<br><br>.send-button:disabled {<br>  opacity: 0.5;<br>  cursor: not-allowed;<br>}<br><br>/ Video Date /<br>.video-date {<br>  width: 100%;<br>  max-width: 450px;<br>  height: 90vh;<br>  max-height: 700px;<br>  background: #000;<br>  border-radius: 24px;<br>  overflow: hidden;<br>  position: relative;<br>  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);<br>}<br><br>.video-container {<br>  width: 100%;<br>  height: 100%;<br>  position: relative;<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>}<br><br>.remote-video-wrapper {<br>  width: 100%;<br>  height: 100%;<br>  position: relative;<br>}<br><br>.remote-video {<br>  width: 100%;<br>  height: 100%;<br>  object-fit: cover;<br>}<br><br>.video-placeholder {<br>  position: absolute;<br>  top: 0;<br>  left: 0;<br>  width: 100%;<br>  height: 100%;<br>  background: linear-gradient(135deg, #1f2937, #374151);<br>  display: flex;<br>  flex-direction: column;<br>  align-items: center;<br>  justify-content: center;<br>  color: white;<br>}<br><br>.placeholder-avatar img {<br>  width: 120px;<br>  height: 120px;<br>  border-radius: 50%;<br>  object-fit: cover;<br>  border: 3px solid rgba(255, 255, 255, 0.3);<br>  margin-bottom: 2rem;<br>}<br><br>.status-text {<br>  font-size: 1.2rem;<br>  font-weight: 600;<br>  text-align: center;<br>  color: rgba(255, 255, 255, 0.9);<br>}<br><br>.local-video-wrapper {<br>  position: absolute;<br>  top: 20px;<br>  right: 20px;<br>  width: 120px;<br>  height: 160px;<br>  border-radius: 16px;<br>  overflow: hidden;<br>  border: 2px solid rgba(255, 255, 255, 0.3);<br>  background: #333;<br>}<br><br>.local-video {<br>  width: 100%;<br>  height: 100%;<br>  object-fit: cover;<br>}<br><br>.video-off-indicator {<br>  position: absolute;<br>  top: 0;<br>  left: 0;<br>  width: 100%;<br>  height: 100%;<br>  background: rgba(0, 0, 0, 0.8);<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>  color: white;<br>  font-size: 0.8rem;<br>  font-weight: 600;<br>}<br><br>.call-controls {<br>  position: absolute;<br>  bottom: 30px;<br>  left: 50%;<br>  transform: translateX(-50%);<br>  display: flex;<br>  gap: 1rem;<br>  background: rgba(0, 0, 0, 0.6);<br>  padding: 1rem 1.5rem;<br>  border-radius: 20px;<br>  backdrop-filter: blur(10px);<br>}<br><br>.control-button {<br>  width: 50px;<br>  height: 50px;<br>  border-radius: 50%;<br>  border: none;<br>  font-size: 1.2rem;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>  background: rgba(255, 255, 255, 0.2);<br>  color: white;<br>  backdrop-filter: blur(10px);<br>}<br><br>.control-button:hover {<br>  background: rgba(255, 255, 255, 0.3);<br>  transform: translateY(-2px);<br>}<br><br>.control-button.active {<br>  background: rgba(34, 197, 94, 0.8);<br>}<br><br>.control-button.inactive {<br>  background: rgba(239, 68, 68, 0.8);<br>}<br><br>.control-button.end-call {<br>  background: linear-gradient(135deg, #dc2626, #ef4444);<br>  width: auto;<br>  padding: 0 1rem;<br>  font-size: 0.9rem;<br>  font-weight: 600;<br>}<br><br>.call-info {<br>  position: absolute;<br>  top: 20px;<br>  left: 20px;<br>  color: white;<br>  background: rgba(0, 0, 0, 0.6);<br>  padding: 1rem 1.5rem;<br>  border-radius: 16px;<br>  backdrop-filter: blur(10px);<br>}<br><br>.call-info h3 {<br>  font-size: 1.1rem;<br>  font-weight: 700;<br>  margin-bottom: 0.25rem;<br>}<br><br>.call-info p {<br>  font-size: 0.9rem;<br>  opacity: 0.9;<br>}<br><br>/ Responsive Design */<br>@media (max-width: 768px) {<br>  .app {<br>    padding: 0;<br>    align-items: stretch;<br>  }<br>  <br>  .swipe-interface,<br>  .chat-room,<br>  .video-date {<br>    height: 100vh;<br>    max-height: none;<br>    border-radius: 0;<br>    max-width: 100%;<br>  }<br>  <br>  .login-container {<br>    margin: 1rem;<br>    padding: 2rem;<br>  }<br>  <br>  .profile-selector {<br>    gap: 0.75rem;<br>  }<br>  <br>  .profile-option {<br>    padding: 0.75rem;<br>  }<br>  <br>  .profile-option img {<br>    width: 50px;<br>    height: 50px;<br>  }<br>  <br>  .cards-container {<br>    padding: 1rem;<br>  }<br>  <br>  .card-wrapper {<br>    max-width: 100%;<br>  }<br>  <br>  .profile-card {<br>    height: 450px;<br>  }<br>  <br>  .local-video-wrapper {<br>    width: 100px;<br>    height: 130px;<br>    top: 15px;<br>    right: 15px;<br>  }<br>  <br>  .call-controls {<br>    gap: 0.75rem;<br>    padding: 0.75rem 1rem;<br>  }<br>  <br>  .control-button {<br>    width: 45px;<br>    height: 45px;<br>    font-size: 1rem;<br>  }<br>}<br><br>.messages-container::-webkit-scrollbar {<br>  width: 6px;<br>}<br><br>.messages-container::-webkit-scrollbar-track {<br>  background: rgba(0, 0, 0, 0.05);<br>}<br><br>.messages-container::-webkit-scrollbar-thumb {<br>  background: rgba(102, 126, 234, 0.3);<br>  border-radius: 3px;<br>}<br><br>.messages-container::-webkit-scrollbar-thumb:hover {<br>  background: rgba(102, 126, 234, 0.5);<br>}</pre><h3>9. Test Your Dating App</h3><p>Launch your development server to experience your celebrity dating platform:</p><pre>npm run dev</pre><p>Open <a href="http://localhost:5173/">http:<em>//localhost:5173</em></a> and test these key features:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TE2pbHSMZCnfM7T7" /></figure><ul><li><strong>Profile selection:</strong> Choose a demo user to experience different perspectives</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HGZiYdtqM7RvbIy_" /></figure><ul><li><strong>Swiping interface:</strong> Browse potential matches with photo carousels and professional details.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OzePnN96wntFxfWC" /></figure><ul><li><strong>Matching system:</strong> Like profiles to trigger match notifications.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hjbb5RFSkn7j3o1K" /></figure><ul><li><strong>Real-time chat:</strong> Send messages between matched users using ZEGOCLOUD’s messaging.</li><li><strong>Video dating:</strong> Start face-to-face conversations with high-quality video calls.</li><li><strong>Responsive design:</strong> Test on mobile devices for complete user experience.</li></ul><p>Download the complete <a href="https://github.com/chigozzdevv/raya-dating-app">source code</a> from GitHub to customize the matching system, add moderation features, or update the design. This sample shows the basics — ZEGOCLOUD’s SDKs can power much more advanced communication features as your app grows.</p><h3>Conclusion</h3><p>Building a dating app like Raya demonstrates how the right tools can transform complex ideas into reality. ZEGOCLOUD’s SDKs eliminated months of backend development, letting you focus on creating engaging user experiences instead of wrestling with video protocols and messaging infrastructure.</p><p>Your exclusive dating platform now connects users through sophisticated matching, private conversations, and face-to-face video dates. The app handles everything from profile discovery to real-time communication with professional-grade quality that celebrity users expect.</p><p>Whether you’re launching the next premium dating platform or adding social features to existing apps, you’ve proven that powerful communication tools are within reach. Start building, iterate based on user feedback, and create connections that matter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ace267f4493b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build Sites like StreamEast]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-sites-like-streameast-3479e87c52ab?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/3479e87c52ab</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[hobby]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Sat, 07 Jun 2025 12:44:10 GMT</pubDate>
            <atom:updated>2025-06-07T12:44:10.646Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*IBHFc7iUGzYSMe6z3VQ0ZQ.png" /></figure><p>StreamEast has become one of the most popular free sports streaming platforms online. Millions of people use it daily to watch live games without paying subscription fees or creating accounts. The site attracts users because it offers instant access to major sports like the NFL, NBA, and UFC through a clean, simple interface.</p><p>You may want to build a similar streaming application to serve sports fans who prefer free alternatives to expensive cable packages. Creating your own streaming app requires understanding how video players work, building user-friendly navigation, and handling live content delivery.</p><p>This guide shows you step-by-step how to develop a streaming application with the same core features that make StreamEast successful with its massive user base.</p><h3>How to Develop Websites Like StreamEast</h3><p>Building a sports streaming platform similar to StreamEast requires robust <a href="https://www.zegocloud.com/product/video-call">real-time video technology</a> and seamless <a href="https://www.zegocloud.com/developers/uikits">user experience</a>. StreamEast’s success comes from delivering live sports content instantly without complex registration processes, supporting thousands of concurrent viewers across multiple sports categories.</p><p><a href="https://www.zegocloud.com/product/live-streaming">ZEGOCLOUD’s live streaming SDK</a> provides the infrastructure you need to build this functionality without wrestling with complex video streaming protocols.</p><h3>Prerequisites</h3><p>To follow along with this tutorial, you’ll need the following prerequisites ready or available to set up during development:</p><ul><li>A ZEGOCLOUD developer account — <a href="http://console.zegocloud.com/">sign up</a></li><li><strong>AppID</strong> and <strong>ServerSecret</strong> from ZEGOCLOUD Admin Console.</li><li>Knowledge of React and JavaScript.</li><li>Node.js installed (version 16 or higher).</li><li>A modern web browser for testing.</li></ul><p>If you’re ready with these, let’s start building!</p><h3>1. Setting Up Your Development Environment</h3><p>Begin by creating a fresh React application optimized for fast development. Vite offers superior performance compared to traditional create-react-app, making it perfect for media-heavy applications like streaming platforms.</p><pre>npm create vite@latest streameast-clone — — template react<br>cd streameast-clone<br>npm install</pre><h3>2. Integrating Live Streaming Capabilities</h3><p>Your streaming platform needs ZEGOCLOUD’s Express SDK to handle live video transmission. Install the web SDK that provides WebRTC functionality for browser-based streaming.</p><pre>npm install zego-express-engine-webrtc</pre><p>After installation, organize your project structure to support streaming components and video management:</p><pre>sports-streaming-site/<br>├── public/<br>├── src/<br>│ ├── components/<br>│ │ ├── VideoPlayer/<br>│ │ │ └── VideoPlayer.jsx<br>│ │ ├── SportsList/<br>│ │ │ └── SportsList.jsx<br>│ │ └── StreamBrowser/<br>│ │ └── StreamBrowser.jsx<br>│ ├── utils/<br>│ │ └── config.js<br>│ ├── App.jsx<br>│ ├── App.css<br>│ └── main.jsx<br>├── package.json<br>└── vite.config.js</pre><h3>3. Building Your Configuration Foundation</h3><p>Create a centralized configuration system that manages your ZEGOCLOUD credentials and application data. Keeping sensitive information organized while providing mock data for development testing makes the development process smoother. We’ll be doing this in the <strong>src/utils/config.js</strong> file:</p><pre>export const STREAMING_CONFIG = {<br>    appID: your_zegocloud_app_id,<br>    serverSecret: &quot;your_zegocloud_server_secret&quot;,<br>    serverURL: &quot;wss://webliveroom-api.zego.im/ws&quot;<br>};<br><br>export function createUserToken(userID, roomID) {<br>    const testTokens = {<br>        &quot;sports_viewer_1&quot;: &quot;development_token_here&quot;,<br>        &quot;sports_viewer_2&quot;: &quot;development_token_here&quot;, <br>        &quot;broadcaster_main&quot;: &quot;development_token_here&quot;<br>    };<br>    <br>    return testTokens[userID] || &quot;&quot;;<br>}<br><br>export const SPORTS_DATA = [<br>    { id: &#39;football&#39;, displayName: &#39;NFL Football&#39;, emoji: &#39;🏈&#39;, color: &#39;#1a472a&#39; },<br>    { id: &#39;basketball&#39;, displayName: &#39;NBA Basketball&#39;, emoji: &#39;🏀&#39;, color: &#39;#7c2d12&#39; },<br>    { id: &#39;fighting&#39;, displayName: &#39;UFC &amp; Boxing&#39;, emoji: &#39;🥊&#39;, color: &#39;#7c1d24&#39; },<br>    { id: &#39;baseball&#39;, displayName: &#39;MLB Baseball&#39;, emoji: &#39;⚾&#39;, color: &#39;#1e3a8a&#39; },<br>    { id: &#39;hockey&#39;, displayName: &#39;NHL Hockey&#39;, emoji: &#39;🏒&#39;, color: &#39;#374151&#39; },<br>    { id: &#39;soccer&#39;, displayName: &#39;World Soccer&#39;, emoji: &#39;⚽&#39;, color: &#39;#166534&#39; }<br>];<br><br>export const DEMO_STREAMS = [<br>    {<br>        streamID: &#39;nfl_chiefs_bills&#39;,<br>        eventTitle: &#39;Kansas City Chiefs vs Buffalo Bills - AFC Championship&#39;,<br>        sport: &#39;football&#39;,<br>        currentViewers: 127543,<br>        status: &#39;live&#39;,<br>        quality: &#39;1080p&#39;<br>    },<br>    {<br>        streamID: &#39;nba_lakers_celtics&#39;, <br>        eventTitle: &#39;Los Angeles Lakers vs Boston Celtics - Finals Game 7&#39;,<br>        sport: &#39;basketball&#39;,<br>        currentViewers: 89234,<br>        status: &#39;live&#39;,<br>        quality: &#39;1080p&#39;<br>    },<br>    {<br>        streamID: &#39;ufc_main_event&#39;,<br>        eventTitle: &#39;UFC 301 Championship Fight - Main Event&#39;,<br>        sport: &#39;fighting&#39;, <br>        currentViewers: 156789,<br>        status: &#39;live&#39;,<br>        quality: &#39;4K&#39;<br>    }<br>];</pre><h3>4. Creating Your Sports Navigation Component</h3><p>Build the navigation header that handles sports category filtering. Navigation becomes the gateway for users to discover different types of live sports content. Create or update <strong>src/components/SportsList/SportsList.jsx</strong>:</p><pre>import React from &#39;react&#39;;<br>import { SPORTS_DATA } from &#39;../../utils/config&#39;;<br><br>const SportsList = ({ selectedSport, onSportSelect }) =&gt; {<br>  return (<br>    &lt;nav className=&quot;main-navigation&quot;&gt;<br>      &lt;div className=&quot;nav-container&quot;&gt;<br>        &lt;div className=&quot;brand-section&quot;&gt;<br>          &lt;h1&gt;🎯 LiveSports&lt;/h1&gt;<br>          &lt;span&gt;Watch Live Sports Free&lt;/span&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;div className=&quot;sports-menu&quot;&gt;<br>          &lt;button <br>            className={`sport-button ${!selectedSport ? &#39;selected&#39; : &#39;&#39;}`}<br>            onClick={() =&gt; onSportSelect(null)}<br>          &gt;<br>            All Games<br>          &lt;/button&gt;<br>          {SPORTS_DATA.map(sport =&gt; (<br>            &lt;button<br>              key={sport.id}<br>              className={`sport-button ${selectedSport === sport.id ? &#39;selected&#39; : &#39;&#39;}`}<br>              onClick={() =&gt; onSportSelect(sport.id)}<br>              style={{ &#39;--accent-color&#39;: sport.color }}<br>            &gt;<br>              {sport.emoji} {sport.displayName}<br>            &lt;/button&gt;<br>          ))}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/nav&gt;<br>  );<br>};<br><br>export default SportsList;</pre><p>The sports navigation component above provides intuitive filtering while maintaining visual consistency through dynamic styling. Each sport category gets its own unique color accent that creates visual hierarchy and helps users quickly identify their preferred content type.</p><h3>5. Developing Your Stream Browser Component</h3><p>Build the stream discovery interface that displays available live sports content. Users need to quickly browse and select streams based on their interests. Create <strong>src/components/StreamBrowser/StreamBrowser.jsx:</strong></p><pre>import React from &#39;react&#39;;<br>import { SPORTS_DATA } from &#39;../../utils/config&#39;;<br><br>const StreamPreview = ({ streamData, onWatchStream }) =&gt; {<br>  const sportInfo = SPORTS_DATA.find(sport =&gt; sport.id === streamData.sport);<br>  <br>  return (<br>    &lt;article className=&quot;stream-preview&quot; onClick={() =&gt; onWatchStream(streamData)}&gt;<br>      &lt;div className=&quot;preview-video&quot;&gt;<br>        &lt;div className=&quot;sport-icon&quot; style={{ backgroundColor: sportInfo?.color }}&gt;<br>          {sportInfo?.emoji}<br>        &lt;/div&gt;<br>        {streamData.status === &#39;live&#39; &amp;&amp; (<br>          &lt;div className=&quot;live-indicator&quot;&gt;🔴 LIVE&lt;/div&gt;<br>        )}<br>        &lt;div className=&quot;viewer-badge&quot;&gt;<br>          👀 {streamData.currentViewers.toLocaleString()}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;stream-details&quot;&gt;<br>        &lt;h3&gt;{streamData.eventTitle}&lt;/h3&gt;<br>        &lt;div className=&quot;stream-meta&quot;&gt;<br>          &lt;span className=&quot;sport-name&quot;&gt;{sportInfo?.displayName}&lt;/span&gt;<br>          &lt;span className=&quot;quality-badge&quot;&gt;{streamData.quality}&lt;/span&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/article&gt;<br>  );<br>};<br><br>const StreamBrowser = ({ availableStreams, onStreamWatch }) =&gt; {<br>  return (<br>    &lt;section className=&quot;stream-gallery&quot;&gt;<br>      {availableStreams.length === 0 ? (<br>        &lt;div className=&quot;empty-gallery&quot;&gt;<br>          &lt;h2&gt;No Live Streams Available&lt;/h2&gt;<br>          &lt;p&gt;Check back soon for upcoming sports events and live games.&lt;/p&gt;<br>        &lt;/div&gt;<br>      ) : (<br>        &lt;div className=&quot;streams-grid&quot;&gt;<br>          {availableStreams.map(stream =&gt; (<br>            &lt;StreamPreview<br>              key={stream.streamID}<br>              streamData={stream}<br>              onWatchStream={onStreamWatch}<br>            /&gt;<br>          ))}<br>        &lt;/div&gt;<br>      )}<br>    &lt;/section&gt;<br>  );<br>};<br><br>export default StreamBrowser;</pre><p>Each stream preview card showcases essential information like live status, viewer count, and video quality. The component structure separates individual stream cards from the overall gallery layout, making the code more maintainable and reusable across different parts of your application.</p><h3>6. Building Your Video Player Component</h3><p>Here, we’ll build the core video player that integrates with ZEGOCLOUD’s streaming technology. Your video player needs to handle connection states, stream quality, and user controls seamlessly.</p><p>Create or update your <strong>src/components/VideoPlayer/VideoPlayer.jsx</strong> file if you haven’t created that yet:</p><pre>import React, { useState, useEffect, useRef } from &#39;react&#39;;<br>import { ZegoExpressEngine } from &#39;zego-express-engine-webrtc&#39;;<br>import { STREAMING_CONFIG, SPORTS_DATA } from &#39;../../utils/config&#39;;<br><br>const VideoPlayer = ({ streamInfo, onReturnHome }) =&gt; {<br>  const videoContainerRef = useRef(null);<br>  const [streamEngine, setStreamEngine] = useState(null);<br>  const [connectionState, setConnectionState] = useState(&#39;initializing&#39;);<br>  const [playbackError, setPlaybackError] = useState(null);<br><br>  useEffect(() =&gt; {<br>    establishStreamConnection();<br>    return () =&gt; {<br>      disconnectStream();<br>    };<br>  }, [streamInfo]);<br><br>  const establishStreamConnection = async () =&gt; {<br>    try {<br>      setConnectionState(&#39;connecting&#39;);<br>      setPlaybackError(null);<br>      <br>      const engine = new ZegoExpressEngine(<br>        STREAMING_CONFIG.appID, <br>        STREAMING_CONFIG.serverURL<br>      );<br>      <br>      engine.on(&#39;roomStateUpdate&#39;, (roomID, state, errorCode) =&gt; {<br>        if (state === &#39;CONNECTED&#39;) {<br>          setConnectionState(&#39;connected&#39;);<br>        } else if (state === &#39;DISCONNECTED&#39;) {<br>          setConnectionState(&#39;disconnected&#39;);<br>        }<br>      });<br><br>      engine.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>        if (updateType === &#39;ADD&#39; &amp;&amp; streamList.length &gt; 0) {<br>          try {<br>            const incomingStream = await engine.startPlayingStream(streamList[0].streamID);<br>            if (videoContainerRef.current) {<br>              incomingStream.play(videoContainerRef.current);<br>              setConnectionState(&#39;streaming&#39;);<br>            }<br>          } catch (streamError) {<br>            setPlaybackError(&#39;Unable to start video playback&#39;);<br>          }<br>        } else if (updateType === &#39;DELETE&#39;) {<br>          setPlaybackError(&#39;Stream has ended&#39;);<br>        }<br>      });<br><br>      const viewerID = viewer_${Date.now()};<br>      const roomIdentifier = streamInfo.streamID;<br>      <br>      await engine.loginRoom(roomIdentifier, {<br>        userID: viewerID,<br>        userName: SportsFan${viewerID.slice(-4)}<br>      });<br>      <br>      setStreamEngine(engine);<br>      <br>      setTimeout(() =&gt; {<br>        if (connectionState === &#39;connecting&#39;) {<br>          setConnectionState(&#39;demo&#39;);<br>        }<br>      }, 4000);<br>      <br>    } catch (connectionError) {<br>      setPlaybackError(&#39;Connection to stream failed&#39;);<br>      setConnectionState(&#39;error&#39;);<br>    }<br>  };<br><br>  const disconnectStream = async () =&gt; {<br>    if (streamEngine) {<br>      try {<br>        await streamEngine.logoutRoom();<br>        streamEngine.destroyEngine();<br>      } catch (disconnectError) {<br>        console.error(&#39;Clean disconnect failed:&#39;, disconnectError);<br>      }<br>    }<br>  };<br><br>  const renderStreamStatus = () =&gt; {<br>    if (connectionState === &#39;connecting&#39;) {<br>      return (<br>        &lt;div className=&quot;stream-status connecting&quot;&gt;<br>          &lt;div className=&quot;connection-spinner&quot;&gt;&lt;/div&gt;<br>          &lt;h3&gt;Connecting to Live Stream&lt;/h3&gt;<br>          &lt;p&gt;Establishing connection to {streamInfo.eventTitle}&lt;/p&gt;<br>        &lt;/div&gt;<br>      );<br>    }<br>    <br>    if (playbackError) {<br>      return (<br>        &lt;div className=&quot;stream-status error&quot;&gt;<br>          &lt;h3&gt;⚠️ Stream Unavailable&lt;/h3&gt;<br>          &lt;p&gt;{playbackError}&lt;/p&gt;<br>          &lt;p className=&quot;demo-note&quot;&gt;In production, live video would stream here&lt;/p&gt;<br>        &lt;/div&gt;<br>      );<br>    }<br>    <br>    if (connectionState === &#39;demo&#39;) {<br>      return (<br>        &lt;div className=&quot;stream-status demo&quot;&gt;<br>          &lt;h3&gt;🎬 Demo Stream Interface&lt;/h3&gt;<br>          &lt;p&gt;Live {streamInfo.sport.toUpperCase()} stream would play here&lt;/p&gt;<br>          &lt;p&gt;Connected to room: {streamInfo.streamID}&lt;/p&gt;<br>          &lt;p className=&quot;technical-info&quot;&gt;Resolution: {streamInfo.quality} | Viewers: {streamInfo.currentViewers.toLocaleString()}&lt;/p&gt;<br>        &lt;/div&gt;<br>      );<br>    }<br>    <br>    return null;<br>  };<br><br>  const sportDetails = SPORTS_DATA.find(sport =&gt; sport.id === streamInfo.sport);<br><br>  return (<br>    &lt;div className=&quot;stream-player-page&quot;&gt;<br>      &lt;header className=&quot;player-navigation&quot;&gt;<br>        &lt;button onClick={onReturnHome} className=&quot;return-button&quot;&gt;<br>          ← Back to Streams<br>        &lt;/button&gt;<br>        &lt;div className=&quot;current-stream-info&quot;&gt;<br>          &lt;h2&gt;{streamInfo.eventTitle}&lt;/h2&gt;<br>          &lt;div className=&quot;live-stats&quot;&gt;<br>            🔴 LIVE • {streamInfo.currentViewers.toLocaleString()} watching<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>      &lt;/header&gt;<br>      <br>      &lt;main className=&quot;video-player-section&quot;&gt;<br>        &lt;div className=&quot;player-frame&quot;&gt;<br>          &lt;div className=&quot;video-display&quot; ref={videoContainerRef}&gt;<br>            {renderStreamStatus()}<br>          &lt;/div&gt;<br>          <br>          &lt;div className=&quot;playback-controls&quot;&gt;<br>            &lt;div className=&quot;stream-options&quot;&gt;<br>              &lt;label htmlFor=&quot;quality-select&quot;&gt;Video Quality:&lt;/label&gt;<br>              &lt;select id=&quot;quality-select&quot; defaultValue={streamInfo.quality}&gt;<br>                &lt;option value=&quot;4K&quot;&gt;4K Ultra HD&lt;/option&gt;<br>                &lt;option value=&quot;1080p&quot;&gt;1080p Full HD&lt;/option&gt;<br>                &lt;option value=&quot;720p&quot;&gt;720p HD&lt;/option&gt;<br>                &lt;option value=&quot;480p&quot;&gt;480p Standard&lt;/option&gt;<br>              &lt;/select&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div className=&quot;connection-info&quot;&gt;<br>              &lt;span&gt;📊 Status: {connectionState}&lt;/span&gt;<br>              &lt;span&gt;👥 {streamInfo.currentViewers.toLocaleString()} viewers&lt;/span&gt;<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;aside className=&quot;event-information&quot;&gt;<br>          &lt;h3&gt;Event Details&lt;/h3&gt;<br>          &lt;dl className=&quot;event-details&quot;&gt;<br>            &lt;dt&gt;Match:&lt;/dt&gt;<br>            &lt;dd&gt;{streamInfo.eventTitle}&lt;/dd&gt;<br>            <br>            &lt;dt&gt;Sport:&lt;/dt&gt;<br>            &lt;dd&gt;{sportDetails?.displayName}&lt;/dd&gt;<br>            <br>            &lt;dt&gt;Status:&lt;/dt&gt;<br>            &lt;dd className=&quot;live-status&quot;&gt;<br>              {streamInfo.status === &#39;live&#39; ? &#39;🔴 Broadcasting Live&#39; : &#39;⏸️ Stream Offline&#39;}<br>            &lt;/dd&gt;<br>            <br>            &lt;dt&gt;Quality:&lt;/dt&gt;<br>            &lt;dd&gt;{streamInfo.quality} Resolution&lt;/dd&gt;<br>            <br>            &lt;dt&gt;Viewers:&lt;/dt&gt;<br>            &lt;dd&gt;{streamInfo.currentViewers.toLocaleString()} currently watching&lt;/dd&gt;<br>          &lt;/dl&gt;<br>        &lt;/aside&gt;<br>      &lt;/main&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default VideoPlayer;</pre><p>Your video player component handles the complete streaming lifecycle from initial connection through active playback and graceful disconnection. The ZEGOCLOUD SDK integration manages the complex WebRTC protocols while your React component provides user-friendly status updates and controls.</p><h3>7. Assembling Your Main Application</h3><p>Bring together all your components in the main application file that orchestrates navigation and state management between different views. Replace the contents of <strong>src/App.jsx</strong>:</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br>import VideoPlayer from &#39;./components/VideoPlayer/VideoPlayer&#39;;<br>import StreamBrowser from &#39;./components/StreamBrowser/StreamBrowser&#39;;<br>import SportsList from &#39;./components/SportsList/SportsList&#39;;<br>import { SPORTS_DATA, DEMO_STREAMS } from &#39;./utils/config&#39;;<br>import &#39;./App.css&#39;;<br><br>const StreamHomepage = ({ activeSport, onStreamSelect }) =&gt; {<br>  const [visibleStreams, setVisibleStreams] = useState(DEMO_STREAMS);<br><br>  useEffect(() =&gt; {<br>    if (activeSport) {<br>      setVisibleStreams(DEMO_STREAMS.filter(stream =&gt; stream.sport === activeSport));<br>    } else {<br>      setVisibleStreams(DEMO_STREAMS);<br>    }<br>  }, [activeSport]);<br><br>  const currentSportInfo = SPORTS_DATA.find(sport =&gt; sport.id === activeSport);<br><br>  return (<br>    &lt;div className=&quot;homepage-content&quot;&gt;<br>      &lt;section className=&quot;hero-banner&quot;&gt;<br>        &lt;h1&gt;🔴 Live Sports Streaming Hub&lt;/h1&gt;<br>        &lt;p&gt;Experience live sports action without registration. Watch your favorite teams compete in real-time.&lt;/p&gt;<br>        {currentSportInfo &amp;&amp; (<br>          &lt;div className=&quot;active-filter&quot;&gt;<br>            Now showing: {currentSportInfo.emoji} {currentSportInfo.displayName}<br>          &lt;/div&gt;<br>        )}<br>      &lt;/section&gt;<br>      <br>      &lt;StreamBrowser <br>        availableStreams={visibleStreams} <br>        onStreamWatch={onStreamSelect} <br>      /&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>function App() {<br>  const [currentView, setCurrentView] = useState(&#39;home&#39;);<br>  const [selectedSport, setSelectedSport] = useState(null);<br>  const [activeStream, setActiveStream] = useState(null);<br><br>  const handleSportSelection = (sportID) =&gt; {<br>    setSelectedSport(sportID);<br>    setCurrentView(&#39;home&#39;);<br>  };<br><br>  const handleStreamSelection = (streamData) =&gt; {<br>    setActiveStream(streamData);<br>    setCurrentView(&#39;player&#39;);<br>  };<br><br>  const handleReturnToHome = () =&gt; {<br>    setCurrentView(&#39;home&#39;);<br>    setActiveStream(null);<br>  };<br><br>  const renderCurrentView = () =&gt; {<br>    switch (currentView) {<br>      case &#39;home&#39;:<br>        return (<br>          &lt;StreamHomepage<br>            activeSport={selectedSport}<br>            onStreamSelect={handleStreamSelection}<br>          /&gt;<br>        );<br>      case &#39;player&#39;:<br>        return (<br>          &lt;VideoPlayer<br>            streamInfo={activeStream}<br>            onReturnHome={handleReturnToHome}<br>          /&gt;<br>        );<br>      default:<br>        return (<br>          &lt;StreamHomepage<br>            activeSport={selectedSport}<br>            onStreamSelect={handleStreamSelection}<br>          /&gt;<br>        );<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;sports-streaming-app&quot;&gt;<br>      &lt;SportsList<br>        selectedSport={selectedSport}<br>        onSportSelect={handleSportSelection}<br>      /&gt;<br>      &lt;main className=&quot;app-content&quot;&gt;<br>        {renderCurrentView()}<br>      &lt;/main&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>Your main application coordinates between different views while maintaining clean state management. The component architecture allows each piece to focus on its specific responsibility while communicating through well-defined props and callbacks.</p><h3>8. Designing Your UI</h3><p>Create an engaging visual design that captures the excitement of live sports while maintaining professional usability. Replace <strong>src/App.css</strong> with comprehensive styling:</p><pre>root {<br>  --primary-bg: #0a0e1a;<br>  --secondary-bg: #151925;<br>  --accent-red: #dc2626;<br>  --accent-orange: #ea580c;<br>  --text-primary: #f8fafc;<br>  --text-secondary: #94a3b8;<br>  --border-color: rgba(148, 163, 184, 0.2);<br>  --success-green: #059669;<br>}<br><br>* {<br>  margin: 0;<br>  padding: 0;<br>  box-sizing: border-box;<br>}<br><br>body {<br>  font-family: &#39;Inter&#39;, -apple-system, BlinkMacSystemFont, sans-serif;<br>  background: var(--primary-bg);<br>  color: var(--text-primary);<br>  line-height: 1.6;<br>}<br><br>.sports-streaming-app {<br>  min-height: 100vh;<br>  background: linear-gradient(145deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);<br>}<br><br>.main-navigation {<br>  background: rgba(10, 14, 26, 0.95);<br>  backdrop-filter: blur(20px);<br>  border-bottom: 1px solid var(--border-color);<br>  position: sticky;<br>  top: 0;<br>  z-index: 50;<br>}<br><br>.nav-container {<br>  max-width: 1200px;<br>  margin: 0 auto;<br>  padding: 1rem 2rem;<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>  gap: 2rem;<br>}<br><br>.brand-section h1 {<br>  font-size: 1.8rem;<br>  font-weight: 800;<br>  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));<br>  background-clip: text;<br>  -webkit-background-clip: text;<br>  -webkit-text-fill-color: transparent;<br>  margin-bottom: 0.25rem;<br>}<br><br>.brand-section span {<br>  font-size: 0.875rem;<br>  color: var(--text-secondary);<br>  font-weight: 500;<br>}<br><br>.sports-menu {<br>  display: flex;<br>  gap: 0.75rem;<br>  flex-wrap: wrap;<br>}<br><br>.sport-button {<br>  padding: 0.75rem 1.25rem;<br>  background: rgba(255, 255, 255, 0.08);<br>  border: 1px solid var(--border-color);<br>  border-radius: 0.75rem;<br>  color: var(--text-primary);<br>  font-weight: 600;<br>  font-size: 0.875rem;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>  position: relative;<br>  overflow: hidden;<br>}<br><br>.sport-button::before {<br>  content: &#39;&#39;;<br>  position: absolute;<br>  top: 0;<br>  left: -100%;<br>  width: 100%;<br>  height: 100%;<br>  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);<br>  transition: left 0.5s ease;<br>}<br><br>.sport-button:hover::before {<br>  left: 100%;<br>}<br><br>.sport-button:hover {<br>  background: rgba(255, 255, 255, 0.15);<br>  transform: translateY(-2px);<br>  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);<br>}<br><br>.sport-button.selected {<br>  background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));<br>  border-color: transparent;<br>  color: white;<br>  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);<br>}<br><br>.app-content {<br>  max-width: 1200px;<br>  margin: 0 auto;<br>  padding: 2rem;<br>}<br><br>.homepage-content {<br>  space-y: 3rem;<br>}<br><br>.hero-banner {<br>  text-align: center;<br>  padding: 3rem 0;<br>  margin-bottom: 3rem;<br>}<br><br>.hero-banner h1 {<br>  font-size: 3rem;<br>  font-weight: 900;<br>  margin-bottom: 1rem;<br>  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));<br>  background-clip: text;<br>  -webkit-background-clip: text;<br>  -webkit-text-fill-color: transparent;<br>}<br><br>.hero-banner p {<br>  font-size: 1.125rem;<br>  color: var(--text-secondary);<br>  max-width: 600px;<br>  margin: 0 auto 2rem;<br>}<br><br>.active-filter {<br>  display: inline-block;<br>  padding: 0.75rem 1.5rem;<br>  background: rgba(220, 38, 38, 0.15);<br>  border: 1px solid rgba(220, 38, 38, 0.3);<br>  border-radius: 0.75rem;<br>  color: #fca5a5;<br>  font-weight: 600;<br>  font-size: 0.875rem;<br>}<br><br>.stream-gallery {<br>  margin-bottom: 4rem;<br>}<br><br>.streams-grid {<br>  display: grid;<br>  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));<br>  gap: 2rem;<br>  margin-top: 2rem;<br>}<br><br>.empty-gallery {<br>  grid-column: 1 / -1;<br>  text-align: center;<br>  padding: 4rem 2rem;<br>  background: rgba(255, 255, 255, 0.05);<br>  border-radius: 1rem;<br>  border: 1px solid var(--border-color);<br>}<br><br>.empty-gallery h2 {<br>  font-size: 1.5rem;<br>  margin-bottom: 0.5rem;<br>  color: var(--text-primary);<br>}<br><br>.empty-gallery p {<br>  color: var(--text-secondary);<br>}<br><br>.stream-preview {<br>  background: rgba(255, 255, 255, 0.05);<br>  border-radius: 1rem;<br>  overflow: hidden;<br>  cursor: pointer;<br>  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);<br>  border: 1px solid var(--border-color);<br>  position: relative;<br>}<br><br>.stream-preview:hover {<br>  background: rgba(255, 255, 255, 0.1);<br>  transform: translateY(-8px) scale(1.02);<br>  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);<br>}<br><br>.preview-video {<br>  position: relative;<br>  height: 200px;<br>  background: linear-gradient(135deg, #1e293b, #334155);<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>  overflow: hidden;<br>}<br><br>.sport-icon {<br>  font-size: 3rem;<br>  width: 80px;<br>  height: 80px;<br>  border-radius: 50%;<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>  color: white;<br>  font-weight: bold;<br>}<br><br>.live-indicator {<br>  position: absolute;<br>  top: 1rem;<br>  left: 1rem;<br>  background: var(--accent-red);<br>  color: white;<br>  padding: 0.5rem 1rem;<br>  border-radius: 0.5rem;<br>  font-size: 0.75rem;<br>  font-weight: 700;<br>  text-transform: uppercase;<br>  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);<br>  animation: pulse-live 2s infinite;<br>}<br><br>@keyframes pulse-live {<br>  0%, 100% { opacity: 1; }<br>  50% { opacity: 0.8; }<br>}<br><br>.viewer-badge {<br>  position: absolute;<br>  bottom: 1rem;<br>  right: 1rem;<br>  background: rgba(0, 0, 0, 0.8);<br>  color: white;<br>  padding: 0.5rem 1rem;<br>  border-radius: 0.5rem;<br>  font-size: 0.75rem;<br>  font-weight: 600;<br>  backdrop-filter: blur(10px);<br>}<br><br>.stream-details {<br>  padding: 1.5rem;<br>}<br><br>.stream-details h3 {<br>  font-size: 1.125rem;<br>  font-weight: 700;<br>  margin-bottom: 0.75rem;<br>  color: var(--text-primary);<br>  line-height: 1.4;<br>}<br><br>.stream-meta {<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>}<br><br>.sport-name {<br>  color: var(--text-secondary);<br>  font-size: 0.875rem;<br>  font-weight: 500;<br>}<br><br>.quality-badge {<br>  background: var(--success-green);<br>  color: white;<br>  padding: 0.25rem 0.75rem;<br>  border-radius: 0.375rem;<br>  font-size: 0.75rem;<br>  font-weight: 600;<br>  text-transform: uppercase;<br>}<br><br>.stream-player-page {<br>  max-width: 1400px;<br>  margin: 0 auto;<br>}<br><br>.player-navigation {<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>  margin-bottom: 2rem;<br>  flex-wrap: wrap;<br>  gap: 1rem;<br>}<br><br>.return-button {<br>  padding: 0.75rem 1.5rem;<br>  background: rgba(255, 255, 255, 0.1);<br>  border: 1px solid var(--border-color);<br>  border-radius: 0.75rem;<br>  color: var(--text-primary);<br>  font-weight: 600;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>}<br><br>.return-button:hover {<br>  background: rgba(255, 255, 255, 0.2);<br>  transform: translateY(-2px);<br>}<br><br>.current-stream-info h2 {<br>  font-size: 1.5rem;<br>  font-weight: 700;<br>  margin-bottom: 0.5rem;<br>  color: var(--text-primary);<br>}<br><br>.live-stats {<br>  color: var(--accent-red);<br>  font-size: 0.875rem;<br>  font-weight: 600;<br>}<br><br>.video-player-section {<br>  display: grid;<br>  grid-template-columns: 1fr 300px;<br>  gap: 2rem;<br>  margin-bottom: 2rem;<br>}<br><br>.player-frame {<br>  background: rgba(0, 0, 0, 0.9);<br>  border-radius: 1rem;<br>  overflow: hidden;<br>  border: 1px solid var(--border-color);<br>}<br><br>.video-display {<br>  position: relative;<br>  width: 100%;<br>  padding-bottom: 56.25%;<br>  background: #000;<br>}<br><br>.stream-status {<br>  position: absolute;<br>  top: 0;<br>  left: 0;<br>  width: 100%;<br>  height: 100%;<br>  display: flex;<br>  flex-direction: column;<br>  align-items: center;<br>  justify-content: center;<br>  text-align: center;<br>  padding: 2rem;<br>}<br><br>.stream-status.connecting {<br>  background: linear-gradient(135deg, #1e293b, #334155);<br>}<br><br>.stream-status.demo {<br>  background: linear-gradient(135deg, #1e293b, #0f172a);<br>}<br><br>.stream-status.error {<br>  background: linear-gradient(135deg, #7f1d1d, #991b1b);<br>}<br><br>.connection-spinner {<br>  width: 48px;<br>  height: 48px;<br>  border: 4px solid rgba(255, 255, 255, 0.3);<br>  border-left-color: var(--accent-orange);<br>  border-radius: 50%;<br>  animation: spin 1s linear infinite;<br>  margin-bottom: 1rem;<br>}<br><br>@keyframes spin {<br>  to { transform: rotate(360deg); }<br>}<br><br>.stream-status h3 {<br>  font-size: 1.5rem;<br>  margin-bottom: 1rem;<br>  color: var(--text-primary);<br>}<br><br>.stream-status p {<br>  color: var(--text-secondary);<br>  margin-bottom: 0.5rem;<br>}<br><br>.demo-note {<br>  color: #fca5a5 !important;<br>  font-weight: 600;<br>}<br><br>.technical-info {<br>  font-family: &#39;Monaco&#39;, &#39;Menlo&#39;, monospace;<br>  font-size: 0.75rem;<br>  color: #a78bfa;<br>  margin-top: 1rem;<br>}<br><br>.playback-controls {<br>  padding: 1.5rem;<br>  background: rgba(0, 0, 0, 0.95);<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>  flex-wrap: wrap;<br>  gap: 1rem;<br>}<br><br>.stream-options {<br>  display: flex;<br>  align-items: center;<br>  gap: 0.75rem;<br>}<br><br>.stream-options label {<br>  color: var(--text-secondary);<br>  font-weight: 600;<br>  font-size: 0.875rem;<br>}<br><br>.stream-options select {<br>  padding: 0.5rem 1rem;<br>  background: rgba(255, 255, 255, 0.1);<br>  border: 1px solid var(--border-color);<br>  border-radius: 0.5rem;<br>  color: var(--text-primary);<br>  font-weight: 600;<br>  font-size: 0.875rem;<br>}<br><br>.connection-info {<br>  display: flex;<br>  gap: 1.5rem;<br>  color: var(--text-secondary);<br>  font-weight: 600;<br>  font-size: 0.875rem;<br>}<br><br>.event-information {<br>  background: rgba(255, 255, 255, 0.05);<br>  border-radius: 1rem;<br>  padding: 2rem;<br>  border: 1px solid var(--border-color);<br>  height: fit-content;<br>}<br><br>.event-information h3 {<br>  font-size: 1.25rem;<br>  font-weight: 700;<br>  margin-bottom: 1.5rem;<br>  color: var(--text-primary);<br>}<br><br>.event-details {<br>  display: grid;<br>  gap: 1rem;<br>}<br><br>.event-details dt {<br>  color: var(--text-secondary);<br>  font-weight: 600;<br>  font-size: 0.875rem;<br>  text-transform: uppercase;<br>  letter-spacing: 0.05em;<br>}<br><br>.event-details dd {<br>  color: var(--text-primary);<br>  font-weight: 600;<br>  margin-bottom: 1rem;<br>  padding-bottom: 1rem;<br>  border-bottom: 1px solid var(--border-color);<br>}<br><br>.event-details dd:last-child {<br>  border-bottom: none;<br>  margin-bottom: 0;<br>  padding-bottom: 0;<br>}<br><br>.live-status {<br>  color: var(--accent-red) !important;<br>}<br><br>@media (max-width: 1024px) {<br>  .video-player-section {<br>    grid-template-columns: 1fr;<br>  }<br>  <br>  .nav-container {<br>    flex-direction: column;<br>    gap: 1rem;<br>  }<br>  <br>  .sports-menu {<br>    justify-content: center;<br>  }<br>}<br><br>@media (max-width: 768px) {<br>  .app-content {<br>    padding: 1rem;<br>  }<br>  <br>  .hero-banner h1 {<br>    font-size: 2rem;<br>  }<br>  <br>  .streams-grid {<br>    grid-template-columns: 1fr;<br>    gap: 1rem;<br>  }<br>  <br>  .player-navigation {<br>    flex-direction: column;<br>    text-align: center;<br>  }<br>  <br>  .playback-controls {<br>    flex-direction: column;<br>    gap: 1rem;<br>  }<br>  <br>  .connection-info {<br>    justify-content: center;<br>  }<br>}<br><br>@media (max-width: 480px) {<br>  .sports-menu {<br>    gap: 0.5rem;<br>  }<br>  <br>  .sport-button {<br>    padding: 0.5rem 1rem;<br>    font-size: 0.75rem;<br>  }<br>  <br>  .event-information {<br>    padding: 1.5rem;<br>  }<br>}</pre><h3>9. Testing Your Sports Streaming Platform</h3><p>Launch your development environment to see your streaming platform in action:</p><pre>npm run dev</pre><p>Navigate to <a href="http://localhost:5173/"><strong>http:<em>//localhost:5173</em></strong></a> where you can explore all functionality and verify that everything works as expected.</p><p>Verify that your homepage displays sports categories correctly and shows available streams in an organized grid layout.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/0*DeeBVhFcrOqv-kGr" /></figure><p>Test the navigation by switching between different sports categories and confirming that the stream list updates appropriately. Click on individual stream cards to access the video player interface and examine how the ZEGOCLOUD SDK initializes connection attempts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/0*Y0DFnQRRs_mg_Yx2" /></figure><p>Get the full source code by cloning the <a href="https://github.com/chigozzdevv/streameast-clone">GitHub repository</a>, then add your ZEGOCLOUD AppID and credentials to see the streaming platform in action.</p><h3>Conclusion</h3><p>Your sports streaming website is now complete and ready to be used by sports lovers. The app loads fast, looks great on phones and computers, and can handle lots of viewers watching games at the same time.</p><p>ZEGOCLOUD takes care of all the hard video stuff, so you don’t have to worry about streaming problems. You can add more sports, improve the design, or even add features like chat rooms for fans. The best part is that your code is clean and easy to update when you want to make changes later.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3479e87c52ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create Your Own Messaging App Like Kik]]></title>
            <link>https://medium.com/@chigozzdev/how-to-create-your-own-messaging-app-like-kik-bc7fd39e35e8?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc7fd39e35e8</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Sat, 07 Jun 2025 08:31:01 GMT</pubDate>
            <atom:updated>2025-06-07T08:31:01.293Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6uWrmm_wREGoarPbpkPFgA.png" /></figure><p>Building your own messaging app like Kik might sound hard, but this guide makes it simple. We will walk you through each step to create a chat app with all the key features users expect.</p><p>First, you will learn how to set up basic user registration using usernames instead of phone numbers. Then we show you how to add messaging functions, group chats, and private conversations.</p><p>The guide also covers video chat options and media sharing for photos and videos. We explain how to design a simple user interface that people find easy to use. By the end, you will understand all the main parts needed to build your own messaging app like Kik.</p><h3>Must-Have Features of Messaging Apps</h3><p>Modern messaging apps need essential features that make communication easy and enjoyable. These five features are what users expect from any good messaging platform today.</p><ul><li><strong>Message privacy protection:</strong> Good messaging apps keep your messages safe and private. This means only you and the person you are texting can see what you wrote. Other people cannot read your personal conversations. This protection keeps your private talks secure from strangers.</li><li><strong>Group chat functions:</strong> Group messaging lets people talk with multiple friends, family members, or coworkers at once. Users can create groups, add or remove members, and share updates with everyone quickly. Good group features include naming groups and setting different permissions for members.</li><li><strong>Media sharing options:</strong> People want to share photos, videos, documents, and voice messages easily. The best apps allow users to send large files without losing quality. Quick photo editing tools and the ability to share files from cloud storage make this feature even better.</li><li><strong>Message read receipts:</strong> Read receipts show when someone has seen your message. This feature helps users know if their message was delivered and read. Some apps let people turn this feature on or off based on their privacy needs.</li><li><strong>Works on all your devices:</strong> Users want their messages on all their devices. Good apps let people start chatting on their phone and continue on their computer. All message history, contacts, and settings should update on every device at the same time.</li></ul><p>These features make messaging apps useful and reliable for daily communication.</p><h3>Create Your Own Messaging App Like Kik with ZEGOCLOUD</h3><p>Creating a messaging app like Kik is much easier when you use <a href="https://www.zegocloud.com/developers/sdks">ZEGOCLOUD’s ready-made SDKs</a>. Kik became popular because it lets people chat without phone numbers and includes features like group chats and video calls. With ZEGOCLOUD, you get all the complex real-time communication technology built for you.</p><p>In this section, we’ll build a complete messaging <a href="https://www.zegocloud.com/product/in-app-chat">app with chat</a>, video calls, and group messaging. The app will work across different devices and have a clean, modern interface.</p><h3>Prerequisites</h3><ul><li>A ZEGOCLOUD account — sign up at <a href="http://console.zegocloud.com/">console.zegocloud.com</a>.</li><li>Your AppID and ServerSecret from ZEGOCLOUD Admin Console.</li><li>Node.js installed (version 16 or higher).</li><li>Basic knowledge of React and JavaScript.</li><li>A modern web browser for testing.</li></ul><p>If you’re ready with these, let’s start building!</p><h3>1. Create Your React Project</h3><p>First, create a new React project using Vite (the modern, fast build tool):</p><pre>npm create vite@latest messaging-app - - template react<br>cd messaging-app<br>npm install</pre><p>This creates a modern React app with all the necessary development tools configured.</p><h3>2. Install ZEGOCLOUD SDKs</h3><p>Now install the required ZEGOCLOUD SDKs for messaging and video calling:</p><pre>npm install zego-zim-web zego-express-engine-webrtc</pre><p>Your project structure will look like this:</p><pre>messaging-app/<br>├── public/<br>├── src/<br>│ ├── components/<br>│ ├── App.jsx<br>│ ├── App.css<br>│ ├── main.jsx<br>│ └── index.css<br>├── package.json<br>└── vite.config.js</pre><h3>3. Set Up Your App Configuration</h3><p>Create a configuration file for your ZEGOCLOUD credentials. Create <strong>src/config.js</strong>:</p><pre>export const CONFIG = {<br>    appID:your_app_id,<br>    serverSecret: &quot;your_server_secret&quot;,<br>    server: &quot;your_server_address&quot;<br>};<br><br>export function generateToken(userID) {<br><br>    // DEVELOPMENT ONLY: Pre-generated tokens for testing<br>    // In production, generate tokens on your backend server for security<br><br>    const devTokens = {<br>        &quot;samuel&quot;: &quot;token_from_zegocloud_console&quot;,<br>        &quot;alice&quot;: &quot;token_from_zegocloud_console&quot;<br>    };<br>    <br>    return devTokens[userID] || &quot;&quot;;<br>}</pre><p>The configuration above handles your ZEGOCLOUD credentials and provides a simple token generation function for authentication.</p><h3>4. Create Your App Components</h3><p>Now let’s build the main App component. Replace the contents of <strong>src/App.jsx</strong>:</p><pre>import React, { useState, useEffect, useRef } from &#39;react&#39;;<br>import { ZIM } from &#39;zego-zim-web&#39;;<br>import { ZegoExpressEngine } from &#39;zego-express-engine-webrtc&#39;;<br>import { CONFIG, generateToken } from &#39;./config&#39;;<br>import &#39;./App.css&#39;;<br><br>const LoginScreen = ({ onLogin }) =&gt; {<br>  const [username, setUsername] = useState(&#39;&#39;);<br>  const [loading, setLoading] = useState(false);<br><br>  const handleLogin = async (e) =&gt; {<br>    e.preventDefault();<br>    if (!username.trim()) {<br>      alert(&#39;Please enter a username&#39;);<br>      return;<br>    }<br>    if (username.length &lt; 3 || username.length &gt; 20) {<br>      alert(&#39;Username must be between 3 and 20 characters&#39;);<br>      return;<br>    }<br>    <br>    setLoading(true);<br>    try {<br>      await onLogin(username.trim());<br>    } catch (error) {<br>      alert(&#39;Login failed. Please try again.&#39;);<br>    } finally {<br>      setLoading(false);<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;login-screen&quot;&gt;<br>      &lt;div className=&quot;login-box&quot;&gt;<br>        &lt;h1&gt;💬 ChatApp&lt;/h1&gt;<br>        &lt;p&gt;Connect with friends instantly&lt;/p&gt;<br>        &lt;form onSubmit={handleLogin}&gt;<br>          &lt;input<br>            type=&quot;text&quot;<br>            placeholder=&quot;Enter your username (samuel or alice)&quot;<br>            value={username}<br>            onChange={(e) =&gt; setUsername(e.target.value)}<br>            maxLength={20}<br>            disabled={loading}<br>          /&gt;<br>          &lt;button type=&quot;submit&quot; disabled={loading}&gt;<br>            {loading ? &#39;Connecting...&#39; : &#39;Start Chatting&#39;}<br>          &lt;/button&gt;<br>        &lt;/form&gt;<br>        &lt;div className=&quot;info&quot;&gt;Try: samuel or alice&lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>const MainScreen = ({ currentUser, conversations, onStartChat, onOpenChat, onLogout }) =&gt; {<br>  const [friendUsername, setFriendUsername] = useState(&#39;&#39;);<br><br>  const handleStartChat = (e) =&gt; {<br>    e.preventDefault();<br>    if (!friendUsername.trim()) {<br>      alert(&#39;Please enter a username&#39;);<br>      return;<br>    }<br>    if (friendUsername === currentUser.userID) {<br>      alert(&#39;You cannot chat with yourself&#39;);<br>      return;<br>    }<br>    onStartChat(friendUsername.trim());<br>    setFriendUsername(&#39;&#39;);<br>  };<br><br>  return (<br>    &lt;div className=&quot;main-screen&quot;&gt;<br>      &lt;div className=&quot;header&quot;&gt;<br>        &lt;h2&gt;💬 ChatApp&lt;/h2&gt;<br>        &lt;div className=&quot;user-info&quot;&gt;<br>          &lt;span&gt;Online as {currentUser.userName}&lt;/span&gt;<br>          &lt;button onClick={onLogout}&gt;Logout&lt;/button&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;new-chat-section&quot;&gt;<br>        &lt;h3&gt;Start New Chat&lt;/h3&gt;<br>        &lt;form onSubmit={handleStartChat} className=&quot;search-box&quot;&gt;<br>          &lt;input<br>            type=&quot;text&quot;<br>            placeholder=&quot;Enter username to chat with&quot;<br>            value={friendUsername}<br>            onChange={(e) =&gt; setFriendUsername(e.target.value)}<br>          /&gt;<br>          &lt;button type=&quot;submit&quot;&gt;Chat&lt;/button&gt;<br>        &lt;/form&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;conversations&quot;&gt;<br>        &lt;h3&gt;Your Conversations&lt;/h3&gt;<br>        &lt;div className=&quot;chat-list&quot;&gt;<br>          {conversations.length === 0 ? (<br>            &lt;div className=&quot;empty-message&quot;&gt;No conversations yet. Start a new chat above!&lt;/div&gt;<br>          ) : (<br>            conversations.map((conversation) =&gt; (<br>              &lt;div<br>                key={conversation.id}<br>                className=&quot;chat-item&quot;<br>                onClick={() =&gt; onOpenChat(conversation)}<br>              &gt;<br>                &lt;div className=&quot;avatar&quot;&gt;<br>                  {conversation.name.charAt(0).toUpperCase()}<br>                &lt;/div&gt;<br>                &lt;div className=&quot;chat-info&quot;&gt;<br>                  &lt;h4&gt;{conversation.name}&lt;/h4&gt;<br>                  &lt;p&gt;{conversation.lastMessage}&lt;/p&gt;<br>                &lt;/div&gt;<br>              &lt;/div&gt;<br>            ))<br>          )}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>const ChatScreen = ({ currentChat, messages, onBack, onSendMessage, onVideoCall }) =&gt; {<br>  const [messageText, setMessageText] = useState(&#39;&#39;);<br>  const messagesEndRef = useRef(null);<br><br>  const scrollToBottom = () =&gt; {<br>    messagesEndRef.current?.scrollIntoView({ behavior: &quot;smooth&quot; });<br>  };<br><br>  useEffect(() =&gt; {<br>    scrollToBottom();<br>  }, [messages]);<br><br>  const handleSendMessage = (e) =&gt; {<br>    e.preventDefault();<br>    if (!messageText.trim()) return;<br>    onSendMessage(messageText.trim());<br>    setMessageText(&#39;&#39;);<br>  };<br><br>  return (<br>    &lt;div className=&quot;chat-screen&quot;&gt;<br>      &lt;div className=&quot;chat-header&quot;&gt;<br>        &lt;button onClick={onBack}&gt;← Back&lt;/button&gt;<br>        &lt;div className=&quot;chat-info&quot;&gt;<br>          &lt;h3&gt;{currentChat.name}&lt;/h3&gt;<br>          &lt;span&gt;Online&lt;/span&gt;<br>        &lt;/div&gt;<br>        &lt;button onClick={onVideoCall}&gt;📹 Video&lt;/button&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;div className=&quot;messages-area&quot;&gt;<br>        {messages.map((message, index) =&gt; (<br>          &lt;div key={index} className={`message ${message.isOwn ? &#39;own&#39; : &#39;&#39;}`}&gt;<br>            &lt;div className=&quot;message-bubble&quot;&gt;<br>              {message.content}<br>            &lt;/div&gt;<br>            &lt;div className=&quot;message-time&quot;&gt;<br>              {new Date(message.timestamp).toLocaleTimeString([], {hour: &#39;2-digit&#39;, minute:&#39;2-digit&#39;})}<br>            &lt;/div&gt;<br>          &lt;/div&gt;<br>        ))}<br>        &lt;div ref={messagesEndRef} /&gt;<br>      &lt;/div&gt;<br>      <br>      &lt;form onSubmit={handleSendMessage} className=&quot;message-input&quot;&gt;<br>        &lt;input<br>          type=&quot;text&quot;<br>          placeholder=&quot;Type your message...&quot;<br>          value={messageText}<br>          onChange={(e) =&gt; setMessageText(e.target.value)}<br>          maxLength={500}<br>        /&gt;<br>        &lt;button type=&quot;submit&quot;&gt;Send&lt;/button&gt;<br>      &lt;/form&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>const VideoScreen = ({ currentChat, onEndCall }) =&gt; {<br>  const localVideoRef = useRef(null);<br>  const remoteVideoRef = useRef(null);<br><br>  return (<br>    &lt;div className=&quot;video-screen&quot;&gt;<br>      &lt;div className=&quot;video-container&quot;&gt;<br>        &lt;div className=&quot;remote-video&quot; ref={remoteVideoRef}&gt;<br>          &lt;div className=&quot;status&quot;&gt;Connecting...&lt;/div&gt;<br>        &lt;/div&gt;<br>        &lt;div className=&quot;local-video&quot; ref={localVideoRef}&gt;&lt;/div&gt;<br>        &lt;div className=&quot;call-controls&quot;&gt;<br>          &lt;button&gt;🎤&lt;/button&gt;<br>          &lt;button&gt;📹&lt;/button&gt;<br>          &lt;button onClick={onEndCall}&gt;📞 End&lt;/button&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>function App() {<br>  const [currentScreen, setCurrentScreen] = useState(&#39;login&#39;);<br>  const [currentUser, setCurrentUser] = useState(null);<br>  const [currentChat, setCurrentChat] = useState(null);<br>  const [conversations, setConversations] = useState([]);<br>  const [messages, setMessages] = useState([]);<br>  const [zim, setZim] = useState(null);<br>  const [zg, setZg] = useState(null);<br>  const [localStream, setLocalStream] = useState(null);<br><br>  const handleLogin = async (username) =&gt; {<br>    try {<br>      console.log(&#39;Logging in user:&#39;, username);<br>      <br>      const zimInstance = ZIM.create({ appID: CONFIG.appID });<br>      <br>      if (!zimInstance) {<br>        throw new Error(&#39;Failed to create ZIM instance&#39;);<br>      }<br>      <br>      zimInstance.on(&#39;peerMessageReceived&#39;, handleIncomingMessage);<br>      zimInstance.on(&#39;roomMessageReceived&#39;, handleIncomingMessage); // Add room message listener<br>      zimInstance.on(&#39;connectionStateChanged&#39;, handleConnectionChange);<br>      zimInstance.on(&#39;error&#39;, (zim, errorInfo) =&gt; {<br>        console.error(&#39;ZIM Error:&#39;, errorInfo);<br>      });<br>      <br>      const loginConfig = {<br>        userName: username,<br>        token: generateToken(username)<br>      };<br>      <br>      console.log(&#39;Logging in with token authentication...&#39;);<br>      await zimInstance.login(username, loginConfig);<br>      <br>      const zgInstance = new ZegoExpressEngine(CONFIG.appID, CONFIG.server);<br>      zgInstance.on(&#39;roomStreamUpdate&#39;, handleStreamUpdate);<br>      zgInstance.on(&#39;roomStateUpdate&#39;, (roomID, state, errorCode, extendedData) =&gt; {<br>        console.log(&#39;Room state update:&#39;, state, errorCode);<br>      });<br>      <br>      setZim(zimInstance);<br>      setZg(zgInstance);<br>      setCurrentUser({ userID: username, userName: username });<br>      setCurrentScreen(&#39;main&#39;);<br>      <br>      console.log(&#39;Login successful&#39;);<br>    } catch (error) {<br>      console.error(&#39;Login failed:&#39;, error);<br>      throw error;<br>    }<br>  };<br><br>  const handleIncomingMessage = (zim, data) =&gt; {<br>    // Handle both peer and room messages<br>    const messageList = data.messageList || data;<br>    const fromID = data.fromConversationID || data.fromRoomID || data.fromUserID;<br>    <br>    console.log(&#39;Received messages from:&#39;, fromID);<br>    <br>    if (!messageList || !Array.isArray(messageList)) return;<br>    <br>    messageList.forEach(message =&gt; {<br>      // Handle both text messages (type 1) and command messages (type 2)<br>      const messageContent = message.message || message.data || &#39;&#39;;<br>      <br>      setConversations(prev =&gt; {<br>        const exists = prev.find(conv =&gt; conv.id === fromID);<br>        if (!exists) {<br>          return [...prev, {<br>            id: fromID,<br>            name: fromID,<br>            lastMessage: messageContent,<br>            timestamp: Date.now()<br>          }];<br>        }<br>        return prev.map(conv =&gt; <br>          conv.id === fromID <br>            ? { ...conv, lastMessage: messageContent, timestamp: Date.now() }<br>            : conv<br>        );<br>      });<br>      <br>      if (currentChat &amp;&amp; currentChat.id === fromID) {<br>        setMessages(prev =&gt; [...prev, {<br>          content: messageContent,<br>          timestamp: Date.now(),<br>          isOwn: false<br>        }]);<br>      }<br>    });<br>  };<br><br>  const handleConnectionChange = (zim, { state, event }) =&gt; {<br>    console.log(&#39;Connection state:&#39;, state, event);<br>    if (state === 0 &amp;&amp; event === 3) {<br>      console.log(&#39;Connection lost, may need to reconnect...&#39;);<br>    }<br>  };<br><br>  const handleStartChat = (friendUsername) =&gt; {<br>    const newConversation = {<br>      id: friendUsername,<br>      name: friendUsername,<br>      lastMessage: &#39;No messages yet&#39;,<br>      timestamp: Date.now()<br>    };<br>    <br>    setConversations(prev =&gt; {<br>      const exists = prev.find(conv =&gt; conv.id === friendUsername);<br>      if (!exists) {<br>        return [...prev, newConversation];<br>      }<br>      return prev;<br>    });<br>    <br>    setCurrentChat(newConversation);<br>    setMessages([]);<br>    <br>    // Join room for Signaling plan messaging<br>    if (zim) {<br>      const roomID = chat_${currentUser.userID}_${friendUsername};<br>      zim.enterRoom({ roomID: roomID, roomName: Chat with ${friendUsername} })<br>        .then(() =&gt; {<br>          console.log(&#39;Joined room:&#39;, roomID);<br>        })<br>        .catch((error) =&gt; {<br>          console.log(&#39;Room join failed, continuing anyway:&#39;, error);<br>        });<br>    }<br>    <br>    setCurrentScreen(&#39;chat&#39;);<br>  };<br><br>  const handleOpenChat = (conversation) =&gt; {<br>    setCurrentChat(conversation);<br>    setMessages([]);<br>    setCurrentScreen(&#39;chat&#39;);<br>  };<br><br>  const handleSendMessage = async (messageText) =&gt; {<br>    if (!currentChat || !zim) return;<br>    <br>    try {<br>      // Use Command message (type: 2) for Signaling plan instead of Text message (type: 1). Choose other choice depending on your plan.<br>      const messageObj = {<br>        type: 2, // ZIMCommandMessage for signaling plan<br>        message: messageText,<br>        extendedData: &#39;&#39;<br>      };<br>      <br>      const config = {<br>        priority: 1<br>      };<br>      <br>      const notification = {<br>        onMessageAttached: function(message) {<br>          console.log(&#39;Message attached:&#39;, message);<br>        }<br>      };<br>      <br>      // Use room messages for Signaling plan<br>      const roomID = chat_${currentUser.userID}_${currentChat.id};<br>      await zim.sendMessage(messageObj, roomID, 1, config, notification);<br>      <br>      setMessages(prev =&gt; [...prev, {<br>        content: messageText,<br>        timestamp: Date.now(),<br>        isOwn: true<br>      }]);<br>      <br>      setConversations(prev =&gt; <br>        prev.map(conv =&gt; <br>          conv.id === currentChat.id <br>            ? { ...conv, lastMessage: messageText, timestamp: Date.now() }<br>            : conv<br>        )<br>      );<br>      <br>      console.log(&#39;Message sent successfully&#39;);<br>    } catch (error) {<br>      console.error(&#39;Failed to send message:&#39;, error);<br>      alert(&#39;Failed to send message&#39;);<br>    }<br>  };<br><br>  const handleVideoCall = async () =&gt; {<br>    if (!currentChat || !zg) {<br>      alert(&#39;No active chat&#39;);<br>      return;<br>    }<br>    <br>    try {<br>      const roomID = call_${currentUser.userID}_${currentChat.id}_${Date.now()};<br>      <br>      console.log(&#39;Starting video call in room:&#39;, roomID);<br>      <br>      await zg.loginRoom(roomID, {<br>        userID: currentUser.userID,<br>        userName: currentUser.userName<br>      });<br>      <br>      const stream = await zg.createStream({<br>        camera: { audio: true, video: true }<br>      });<br>      <br>      stream.play(&quot;local-video&quot;);<br>      <br>      await zg.startPublishingStream(currentUser.userID, stream);<br>      <br>      setLocalStream(stream);<br>      setCurrentScreen(&#39;video&#39;);<br>      <br>      console.log(&#39;Video call started&#39;);<br>    } catch (error) {<br>      console.error(&#39;Failed to start video call:&#39;, error);<br>      alert(&#39;Failed to start video call&#39;);<br>    }<br>  };<br><br>  const handleStreamUpdate = async (roomID, updateType, streamList) =&gt; {<br>    if (updateType === &#39;ADD&#39; &amp;&amp; streamList.length &gt; 0) {<br>      console.log(&#39;Remote stream added&#39;);<br>      <br>      const remoteStream = await zg.startPlayingStream(streamList[0].streamID);<br>      remoteStream.play(&quot;remote-video&quot;);<br>    } else if (updateType === &#39;DELETE&#39;) {<br>      console.log(&#39;Remote stream removed&#39;);<br>      setTimeout(() =&gt; handleEndCall(), 2000);<br>    }<br>  };<br><br>  const handleEndCall = async () =&gt; {<br>    try {<br>      if (localStream &amp;&amp; zg) {<br>        await zg.stopPublishingStream(currentUser.userID);<br>        zg.destroyStream(localStream);<br>        setLocalStream(null);<br>      }<br>      <br>      if (zg) {<br>        await zg.logoutRoom();<br>      }<br>      <br>      setCurrentScreen(&#39;chat&#39;);<br>      console.log(&#39;Video call ended&#39;);<br>    } catch (error) {<br>      console.error(&#39;Error ending call:&#39;, error);<br>    }<br>  };<br><br>  const handleLogout = () =&gt; {<br>    if (confirm(&#39;Are you sure you want to logout?&#39;)) {<br>      if (zim) {<br>        zim.logout();<br>        zim.destroy();<br>      }<br>      if (zg) {<br>        zg.destroyEngine();<br>      }<br>      <br>      setCurrentUser(null);<br>      setCurrentChat(null);<br>      setConversations([]);<br>      setMessages([]);<br>      setZim(null);<br>      setZg(null);<br>      setCurrentScreen(&#39;login&#39;);<br>    }<br>  };<br><br>  const renderScreen = () =&gt; {<br>    switch (currentScreen) {<br>      case &#39;login&#39;:<br>        return &lt;LoginScreen onLogin={handleLogin} /&gt;;<br>      case &#39;main&#39;:<br>        return (<br>          &lt;MainScreen<br>            currentUser={currentUser}<br>            conversations={conversations}<br>            onStartChat={handleStartChat}<br>            onOpenChat={handleOpenChat}<br>            onLogout={handleLogout}<br>          /&gt;<br>        );<br>      case &#39;chat&#39;:<br>        return (<br>          &lt;ChatScreen<br>            currentChat={currentChat}<br>            messages={messages}<br>            onBack={() =&gt; setCurrentScreen(&#39;main&#39;)}<br>            onSendMessage={handleSendMessage}<br>            onVideoCall={handleVideoCall}<br>          /&gt;<br>        );<br>      case &#39;video&#39;:<br>        return (<br>          &lt;VideoScreen<br>            currentChat={currentChat}<br>            onEndCall={handleEndCall}<br>          /&gt;<br>        );<br>      default:<br>        return &lt;LoginScreen onLogin={handleLogin} /&gt;;<br>    }<br>  };<br><br>  return (<br>    &lt;div className=&quot;app&quot;&gt;<br>      {renderScreen()}<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>This React component structure provides:</p><ul><li><strong>LoginScreen</strong>: Handles user authentication with username.</li><li><strong>MainScreen</strong>: Shows conversations and allows starting new chats.</li><li><strong>ChatScreen</strong>: Individual messaging interface with video call option.</li><li><strong>VideoScreen</strong>: Full-screen video calling experience.</li><li><strong>App</strong>: Main component managing state and screen navigation.</li></ul><h3>5. Style Your React App</h3><p>Replace the contents of <strong>src/App.css</strong> with modern, clean styling:</p><pre>/* src/App.css /<br> {<br>  margin: 0;<br>  padding: 0;<br>  box-sizing: border-box;<br>  font-family: -apple-system, BlinkMacSystemFont, &#39;Segoe UI&#39;, Roboto, &#39;Inter&#39;, sans-serif;<br>}<br><br>.app {<br>  height: 100vh;<br>  width: 100vw;<br>  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #8b5cf6 100%);<br>  overflow: hidden;<br>  position: relative;<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  padding: 1rem; /* Add some padding for better spacing /<br>}<br><br>.app::before {<br>  content: &#39;&#39;;<br>  position: absolute;<br>  top: 0;<br>  left: 0;<br>  right: 0;<br>  bottom: 0;<br>  background: radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),<br>              radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);<br>  pointer-events: none;<br>}<br><br>/ Login Screen /<br>.login-screen {<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>  height: 100%;<br>  width: 100%;<br>  padding: 2rem;<br>}<br><br>.login-box {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  padding: 3rem;<br>  border-radius: 24px;<br>  text-align: center;<br>  box-shadow: 0 20px 60px rgba(0,0,0,0.15), <br>              0 0 0 1px rgba(255,255,255,0.2);<br>  min-width: 380px;<br>  max-width: 450px;<br>  width: 100%;<br>  transform: translateY(0);<br>  transition: all 0.3s ease;<br>  border: 1px solid rgba(255,255,255,0.2);<br>}<br><br>.login-box:hover {<br>  transform: translateY(-5px);<br>  box-shadow: 0 30px 80px rgba(0,0,0,0.2);<br>}<br><br>.login-box h1 {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  -webkit-background-clip: text;<br>  background-clip: text;<br>  -webkit-text-fill-color: transparent;<br>  margin-bottom: 0.5rem;<br>  font-size: 3rem;<br>  font-weight: 700;<br>}<br><br>.login-box p {<br>  color: #6b7280;<br>  margin-bottom: 2.5rem;<br>  font-size: 1.1rem;<br>}<br><br>.login-box form {<br>  display: flex;<br>  flex-direction: column;<br>  gap: 1.5rem;<br>}<br><br>.login-box input {<br>  padding: 18px 20px;<br>  border: 2px solid #e5e7eb;<br>  border-radius: 16px;<br>  font-size: 16px;<br>  transition: all 0.3s ease;<br>  background: rgba(255,255,255,0.8);<br>}<br><br>.login-box input:focus {<br>  outline: none;<br>  border-color: #667eea;<br>  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);<br>  background: rgba(255,255,255,1);<br>  transform: translateY(-1px);<br>}<br><br>.login-box button {<br>  padding: 18px;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  border: none;<br>  border-radius: 16px;<br>  font-size: 16px;<br>  font-weight: 600;<br>  cursor: pointer;<br>  transition: all 0.3s ease;<br>  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);<br>}<br><br>.login-box button:hover:not(:disabled) {<br>  transform: translateY(-2px);<br>  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);<br>}<br><br>.login-box button:disabled {<br>  opacity: 0.7;<br>  cursor: not-allowed;<br>  transform: none;<br>}<br><br>.info {<br>  font-size: 0.9rem;<br>  color: #9ca3af;<br>  margin-top: 1.5rem;<br>  font-weight: 500;<br>}<br><br>/ Main Screen /<br>.main-screen {<br>  background: rgba(248, 250, 252, 0.95);<br>  backdrop-filter: blur(20px);<br>  height: 95vh;<br>  max-height: 800px; / Add max height /<br>  display: flex;<br>  flex-direction: column;<br>  border-radius: 24px;<br>  overflow: hidden;<br>  border: 1px solid rgba(255,255,255,0.2);<br>  width: 100%;<br>  max-width: 450px;<br>  box-shadow: 0 20px 60px rgba(0,0,0,0.15);<br>  margin: 0 auto; / Center the container /<br>}<br><br>.header {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  padding: 1.5rem 2rem;<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>  box-shadow: 0 4px 20px rgba(0,0,0,0.08);<br>  border-bottom: 1px solid rgba(229, 231, 235, 0.8);<br>}<br><br>.header h2 {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  -webkit-background-clip: text;<br>  background-clip: text;<br>  -webkit-text-fill-color: transparent;<br>  font-weight: 700;<br>  font-size: 1.8rem;<br>}<br><br>.user-info {<br>  display: flex;<br>  align-items: center;<br>  gap: 1.5rem;<br>}<br><br>.user-info span {<br>  font-weight: 600;<br>  color: #374151;<br>}<br><br>.user-info button {<br>  padding: 10px 20px;<br>  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);<br>  color: #374151;<br>  border: none;<br>  border-radius: 12px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>  box-shadow: 0 2px 8px rgba(0,0,0,0.1);<br>}<br><br>.user-info button:hover {<br>  background: linear-gradient(135deg, #e5e7eb, #d1d5db);<br>  transform: translateY(-1px);<br>  box-shadow: 0 4px 12px rgba(0,0,0,0.15);<br>}<br><br>.new-chat-section {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  margin: 1.5rem;<br>  padding: 2rem;<br>  border-radius: 20px;<br>  box-shadow: 0 8px 25px rgba(0,0,0,0.08);<br>  border: 1px solid rgba(255,255,255,0.5);<br>}<br><br>.new-chat-section h3 {<br>  margin-bottom: 1.5rem;<br>  color: #374151;<br>  font-weight: 700;<br>  font-size: 1.2rem;<br>}<br><br>.search-box {<br>  display: flex;<br>  gap: 1rem;<br>}<br><br>.search-box input {<br>  flex: 1;<br>  padding: 16px 20px;<br>  border: 2px solid #e5e7eb;<br>  border-radius: 16px;<br>  font-size: 16px;<br>  transition: all 0.3s ease;<br>  background: rgba(255,255,255,0.8);<br>}<br><br>.search-box input:focus {<br>  outline: none;<br>  border-color: #667eea;<br>  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);<br>  background: rgba(255,255,255,1);<br>}<br><br>.search-box button {<br>  padding: 16px 24px;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  border: none;<br>  border-radius: 16px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);<br>}<br><br>.search-box button:hover {<br>  transform: translateY(-1px);<br>  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);<br>}<br><br>.conversations {<br>  flex: 1;<br>  padding: 0 1.5rem 1.5rem;<br>  overflow-y: auto;<br>}<br><br>.conversations h3 {<br>  margin-bottom: 1.5rem;<br>  color: #374151;<br>  font-weight: 700;<br>  font-size: 1.2rem;<br>}<br><br>.chat-list {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  border-radius: 20px;<br>  box-shadow: 0 8px 25px rgba(0,0,0,0.08);<br>  min-height: 200px;<br>  border: 1px solid rgba(255,255,255,0.5);<br>  overflow: hidden;<br>}<br><br>.empty-message {<br>  padding: 3rem 2rem;<br>  text-align: center;<br>  color: #9ca3af;<br>  font-size: 1.1rem;<br>  font-weight: 500;<br>}<br><br>.chat-item {<br>  padding: 1.5rem 2rem;<br>  border-bottom: 1px solid rgba(229, 231, 235, 0.5);<br>  cursor: pointer;<br>  display: flex;<br>  align-items: center;<br>  gap: 1.5rem;<br>  transition: all 0.3s ease;<br>  position: relative;<br>}<br><br>.chat-item:hover {<br>  background: rgba(102, 126, 234, 0.05);<br>  transform: translateX(4px);<br>}<br><br>.chat-item:last-child {<br>  border-bottom: none;<br>}<br><br>.avatar {<br>  width: 52px;<br>  height: 52px;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  border-radius: 16px;<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>  color: white;<br>  font-weight: 700;<br>  font-size: 1.3rem;<br>  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);<br>}<br><br>.chat-info h4 {<br>  margin-bottom: 0.3rem;<br>  color: #374151;<br>  font-weight: 600;<br>  font-size: 1.1rem;<br>}<br><br>.chat-info p {<br>  color: #9ca3af;<br>  font-size: 0.95rem;<br>  line-height: 1.4;<br>}<br><br>/ Chat Screen /<br>.chat-screen {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  height: 95vh;<br>  max-height: 800px; / Add max height /<br>  display: flex;<br>  flex-direction: column;<br>  border-radius: 24px;<br>  overflow: hidden;<br>  border: 1px solid rgba(255,255,255,0.2);<br>  width: 100%;<br>  max-width: 450px;<br>  box-shadow: 0 20px 60px rgba(0,0,0,0.15);<br>  margin: 0 auto; / Center the container /<br>}<br><br>.chat-header {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  padding: 1.5rem 2rem;<br>  display: flex;<br>  justify-content: space-between;<br>  align-items: center;<br>  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);<br>}<br><br>.chat-header button {<br>  background: rgba(255,255,255,0.2);<br>  color: white;<br>  border: none;<br>  padding: 12px 16px;<br>  border-radius: 12px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>  backdrop-filter: blur(10px);<br>  border: 1px solid rgba(255,255,255,0.3);<br>}<br><br>.chat-header button:hover {<br>  background: rgba(255,255,255,0.3);<br>  transform: translateY(-1px);<br>}<br><br>.chat-info h3 {<br>  margin-bottom: 0.3rem;<br>  font-weight: 700;<br>  font-size: 1.3rem;<br>}<br><br>.chat-info span {<br>  font-size: 0.9rem;<br>  opacity: 0.9;<br>  font-weight: 500;<br>}<br><br>.messages-area {<br>  flex: 1;<br>  padding: 2rem;<br>  overflow-y: auto;<br>  background: linear-gradient(180deg, rgba(248, 250, 252, 0.8) 0%, rgba(241, 245, 249, 0.8) 100%);<br>}<br><br>.message {<br>  margin-bottom: 1.5rem;<br>  display: flex;<br>  flex-direction: column;<br>  align-items: flex-start;<br>  animation: messageSlideIn 0.3s ease;<br>}<br><br>@keyframes messageSlideIn {<br>  from {<br>    opacity: 0;<br>    transform: translateY(10px);<br>  }<br>  to {<br>    opacity: 1;<br>    transform: translateY(0);<br>  }<br>}<br><br>.message.own {<br>  align-items: flex-end;<br>}<br><br>.message-bubble {<br>  max-width: 75%;<br>  padding: 16px 20px;<br>  border-radius: 24px;<br>  word-wrap: break-word;<br>  position: relative;<br>  transition: all 0.3s ease;<br>  line-height: 1.5;<br>  font-size: 0.95rem;<br>}<br><br>.message.own .message-bubble {<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);<br>  border-bottom-right-radius: 8px;<br>}<br><br>.message:not(.own) .message-bubble {<br>  background: rgba(255, 255, 255, 0.95);<br>  color: #374151;<br>  border: 1px solid rgba(229, 231, 235, 0.8);<br>  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);<br>  border-bottom-left-radius: 8px;<br>  backdrop-filter: blur(10px);<br>}<br><br>.message-bubble:hover {<br>  transform: translateY(-1px);<br>  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);<br>}<br><br>.message.own .message-bubble:hover {<br>  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);<br>}<br><br>.message-time {<br>  font-size: 0.75rem;<br>  opacity: 0.7;<br>  margin-top: 0.5rem;<br>  font-weight: 500;<br>  color: #9ca3af;<br>}<br><br>.message-input {<br>  background: rgba(255, 255, 255, 0.95);<br>  backdrop-filter: blur(20px);<br>  padding: 1.5rem 2rem;<br>  display: flex;<br>  gap: 1rem;<br>  border-top: 1px solid rgba(229, 231, 235, 0.8);<br>  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);<br>}<br><br>.message-input input {<br>  flex: 1;<br>  padding: 16px 24px;<br>  border: 2px solid #e5e7eb;<br>  border-radius: 24px;<br>  outline: none;<br>  font-size: 16px;<br>  transition: all 0.3s ease;<br>  background: rgba(255,255,255,0.8);<br>}<br><br>.message-input input:focus {<br>  border-color: #667eea;<br>  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);<br>  background: rgba(255,255,255,1);<br>}<br><br>.message-input button {<br>  padding: 16px 24px;<br>  background: linear-gradient(135deg, #667eea, #764ba2);<br>  color: white;<br>  border: none;<br>  border-radius: 24px;<br>  cursor: pointer;<br>  font-weight: 600;<br>  transition: all 0.3s ease;<br>  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);<br>}<br><br>.message-input button:hover {<br>  transform: translateY(-1px);<br>  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);<br>}<br><br>/ Video Call Screen /<br>.video-screen {<br>  background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);<br>  height: 95vh;<br>  max-height: 800px; / Add max height /<br>  position: relative;<br>  border-radius: 24px;<br>  overflow: hidden;<br>  width: 100%;<br>  max-width: 450px;<br>  box-shadow: 0 20px 60px rgba(0,0,0,0.3);<br>  margin: 0 auto; / Center the container /<br>}<br><br>.video-container {<br>  width: 100%;<br>  height: 100%;<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>}<br><br>.remote-video {<br>  width: 100%;<br>  height: 100%;<br>  background: linear-gradient(135deg, #1f2937, #374151);<br>  display: flex;<br>  align-items: center;<br>  justify-content: center;<br>  color: white;<br>  font-size: 1.3rem;<br>  font-weight: 600;<br>}<br><br>.local-video {<br>  position: absolute;<br>  top: 24px;<br>  right: 24px;<br>  width: 220px;<br>  height: 165px;<br>  background: linear-gradient(135deg, #374151, #4b5563);<br>  border-radius: 16px;<br>  border: 3px solid rgba(255,255,255,0.2);<br>  backdrop-filter: blur(10px);<br>  box-shadow: 0 8px 25px rgba(0,0,0,0.3);<br>}<br><br>.call-controls {<br>  position: absolute;<br>  bottom: 40px;<br>  left: 50%;<br>  transform: translateX(-50%);<br>  display: flex;<br>  gap: 1.5rem;<br>  background: rgba(0,0,0,0.4);<br>  padding: 1rem 1.5rem;<br>  border-radius: 20px;<br>  backdrop-filter: blur(20px);<br>  border: 1px solid rgba(255,255,255,0.1);<br>}<br><br>.call-controls button {<br>  width: 56px;<br>  height: 56px;<br>  border-radius: 50%;<br>  border: none;<br>  color: white;<br>  font-size: 1.3rem;<br>  cursor: pointer;<br>  background: rgba(255,255,255,0.2);<br>  transition: all 0.3s ease;<br>  backdrop-filter: blur(10px);<br>  border: 1px solid rgba(255,255,255,0.3);<br>}<br><br>.call-controls button:hover {<br>  background: rgba(255,255,255,0.3);<br>  transform: translateY(-2px);<br>  box-shadow: 0 4px 15px rgba(255,255,255,0.2);<br>}<br><br>.call-controls button:last-child {<br>  background: linear-gradient(135deg, #dc2626, #ef4444);<br>  border: 1px solid rgba(220, 38, 38, 0.5);<br>}<br><br>.call-controls button:last-child:hover {<br>  background: linear-gradient(135deg, #b91c1c, #dc2626);<br>  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);<br>}<br><br>/ Scrollbar Styling /<br>.conversations::-webkit-scrollbar,<br>.messages-area::-webkit-scrollbar {<br>  width: 8px;<br>}<br><br>.conversations::-webkit-scrollbar-track,<br>.messages-area::-webkit-scrollbar-track {<br>  background: rgba(0,0,0,0.05);<br>  border-radius: 4px;<br>}<br><br>.conversations::-webkit-scrollbar-thumb,<br>.messages-area::-webkit-scrollbar-thumb {<br>  background: rgba(102, 126, 234, 0.3);<br>  border-radius: 4px;<br>  transition: all 0.3s ease;<br>}<br><br>.conversations::-webkit-scrollbar-thumb:hover,<br>.messages-area::-webkit-scrollbar-thumb:hover {<br>  background: rgba(102, 126, 234, 0.5);<br>}<br><br>/ Responsive Design /<br>@media (min-width: 1200px) {<br>  .main-screen,<br>  .chat-screen,<br>  .video-screen {<br>    max-width: 500px;<br>  }<br>}<br><br>@media (max-width: 768px) {<br>  .app {<br>    align-items: stretch;<br>    padding: 0; / Remove padding on mobile /<br>  }<br>  <br>  .main-screen,<br>  .chat-screen,<br>  .video-screen {<br>    height: 100vh;<br>    max-width: 100%;<br>    border-radius: 0;<br>    box-shadow: none;<br>    margin: 0; / Remove margin on mobile */<br>  }<br>  <br>  .video-container {<br>    height: 100vh;<br>  }<br>  <br>  .login-box {<br>    margin: 1rem;<br>    min-width: auto;<br>    padding: 2rem;<br>  }<br>  <br>  .header {<br>    padding: 1rem 1.5rem;<br>  }<br>  <br>  .user-info {<br>    flex-direction: column;<br>    gap: 0.5rem;<br>  }<br>  <br>  .new-chat-section {<br>    margin: 1rem;<br>    padding: 1.5rem;<br>  }<br>  <br>  .local-video {<br>    width: 140px;<br>    height: 105px;<br>    top: 16px;<br>    right: 16px;<br>  }<br>  <br>  .call-controls {<br>    gap: 1rem;<br>    padding: 0.75rem 1rem;<br>  }<br>  <br>  .call-controls button {<br>    width: 48px;<br>    height: 48px;<br>    font-size: 1.1rem;<br>  }<br>  <br>  .search-box {<br>    flex-direction: column;<br>    gap: 1rem;<br>  }<br>  <br>  .message-bubble {<br>    max-width: 85%;<br>  }<br>  <br>  .messages-area {<br>    padding: 1.5rem;<br>  }<br>  <br>  .message-input {<br>    padding: 1rem 1.5rem;<br>  }<br>}<br><br>@media (max-width: 480px) {<br>  .login-box h1 {<br>    font-size: 2.5rem;<br>  }<br>  <br>  .header h2 {<br>    font-size: 1.5rem;<br>  }<br>  <br>  .avatar {<br>    width: 44px;<br>    height: 44px;<br>    font-size: 1.1rem;<br>  }<br>  <br>  .chat-item {<br>    padding: 1rem 1.5rem;<br>  }<br>}</pre><p>This CSS provides:</p><ul><li>Modern React-friendly styling with component-based organization.</li><li>Clean, professional design with blue/purple gradients.</li><li>Responsive layout that works on phones and computers.</li><li>Smooth animations and hover effects.</li><li>Optimized for React’s component structure.</li></ul><h3>6. Run Your React Messaging App</h3><p>Now start your development server:</p><p>npm run dev</p><p>This will start Vite’s development server and open your app at <a href="http://localhost:5173/">http:<em>//localhost:5173</em></a> (or another port if 5173 is busy).</p><p><strong>Testing Your App:</strong></p><ul><li>Login Test: Enter a username and click “Start Chatting”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rOknfonEK6p98Tx5" /></figure><p><strong>Messaging Test:</strong></p><ol><li>Open another browser window/tab to the same URL.</li><li>Login with a different username.</li><li>Start a chat between the two users.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*B6j0Wuf3ep2uhLo5" /></figure><ol><li>Send messages back and forth.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UfJwZ9QQc4eyCjlW" /></figure><p><strong>Video Call Test:</strong></p><ul><li>Click the video button in a chat to start a video call</li></ul><p>Curious how everything comes together? Get the full <a href="https://github.com/chigozzdevv/kik-messaging-app">demo code here</a> to test it yourself:</p><h3>Conclusion</h3><p>You’ve successfully built a complete messaging app with real-time chat and video calling features! Using ZEGOCLOUD’s powerful SDKs, you created an app that rivals popular messaging platforms like Kik — all without requiring phone numbers or complex backend infrastructure. Your users can now chat instantly, share messages in real-time, and connect face-to-face through video calls.</p><p>This foundation gives you endless possibilities for growth. Consider adding group chats, file sharing, push notifications, or custom themes to make your app unique. With ZEGOCLOUD handling the heavy technical lifting, you can focus on building features that matter to your users. Deploy your app, gather feedback, and watch your messaging platform come to life!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc7fd39e35e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Random Video Chat Platform Like Cammatch]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-a-random-video-chat-platform-like-cammatch-d2268757b167?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2268757b167</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 03:55:19 GMT</pubDate>
            <atom:updated>2025-04-15T03:55:19.177Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_iMZzenQr98sK_ej.jpg" /></figure><p>Building your own random video chat platform like Cammatch is now easier than ever. This guide shows you the simple steps to create a service where strangers can meet through video. We’ll show you how to use <a href="https://www.zegocloud.com/">ZEGOCLOUD</a> for handling all the video streaming parts, so you don’t need to worry about complex technical setup.</p><p>You’ll learn how to create user matching, add basic safety features, and design a clean interface that people can use right away. Perfect for beginners who want to start their own video chat platform without needing advanced technical skills or knowledge.</p><h3>How to Build a Random Video Chat Platform Like Cammatch</h3><p>Random video chat platforms like Cammatch have become very popular for meeting new people online. ZEGOCLOUD is a service that provides ready-to-use video streaming technology, handling all the complex parts of <a href="https://www.zegocloud.com/docs/video-call/overview?platform=web&amp;language=javascript">video calls</a> and other real-time interactive features, so you don’t have to build them yourself.</p><p>With ZEGOCLOUD, you only need to focus on designing your platform’s look and features.</p><h3>Prerequisites</h3><ul><li>A ZEGOCLOUD account (<a href="https://console.zegocloud.com/account/signup">sign up</a> here)</li><li>Your AppID from the ZEGOCLOUD dashboard.</li><li>Basic knowledge of HTML, CSS, and JavaScript.</li><li>A code editor (like Visual Studio Code).</li><li>A web browser for testing.</li></ul><p>If you’re good with the requirements, then let’s jump right into it!</p><h3>1. Create Your Project Files</h3><p>Start by making these three basic files:</p><pre>index.html<br>styles.css<br>app.js</pre><h3>2. Set Up Your HTML Structure</h3><p>Your HTML file should include:</p><ul><li>A welcome screen with a start button.</li><li>A chat screen with video areas for both users.</li><li>Simple buttons for finding a new person, muting, and ending chats.</li><li>A text chat option for typing messages.</li></ul><p>Here’s a simple example:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Random Video Chat&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;header&gt;<br>        &lt;h1&gt;Random Video Chat&lt;/h1&gt;<br>        &lt;p&gt;Meet new people instantly!&lt;/p&gt;<br>    &lt;/header&gt;<br>    <br>    &lt;main&gt;<br>        &lt;!-- Welcome Screen --&gt;<br>        &lt;div id=&quot;welcome-screen&quot; class=&quot;screen active&quot;&gt;<br>            &lt;h2&gt;Welcome!&lt;/h2&gt;<br>            &lt;p&gt;Click below to start meeting new people.&lt;/p&gt;<br>            &lt;div class=&quot;terms&quot;&gt;<br>                &lt;p&gt;By clicking &quot;Start&quot; you confirm you&#39;re 18+ and agree to our Terms.&lt;/p&gt;<br>            &lt;/div&gt;<br>            &lt;button id=&quot;start-chat&quot;&gt;Start&lt;/button&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- Video Chat Screen --&gt;<br>        &lt;div id=&quot;chat-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;div id=&quot;video-container&quot;&gt;<br>                &lt;div id=&quot;local-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;local-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;You&lt;/p&gt;<br>                &lt;/div&gt;<br>                &lt;div id=&quot;remote-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;remote-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;Stranger&lt;/p&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;chat-controls&quot;&gt;<br>                &lt;button id=&quot;next-chat&quot;&gt;Next Person&lt;/button&gt;<br>                &lt;button id=&quot;toggle-audio&quot;&gt;Mute&lt;/button&gt;<br>                &lt;button id=&quot;toggle-video&quot;&gt;Hide Video&lt;/button&gt;<br>                &lt;button id=&quot;end-chat&quot;&gt;End Chat&lt;/button&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;text-chat&quot;&gt;<br>                &lt;div id=&quot;chat-messages&quot;&gt;&lt;/div&gt;<br>                &lt;div id=&quot;chat-input-area&quot;&gt;<br>                    &lt;input type=&quot;text&quot; id=&quot;chat-input&quot; placeholder=&quot;Type a message...&quot;&gt;<br>                    &lt;button id=&quot;send-message&quot;&gt;Send&lt;/button&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- End Screen --&gt;<br>        &lt;div id=&quot;ending-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;h2&gt;Chat Ended&lt;/h2&gt;<br>            &lt;p&gt;Want to meet someone new?&lt;/p&gt;<br>            &lt;button id=&quot;new-chat&quot;&gt;Start New Chat&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/main&gt;<br>    <br>    &lt;!-- ZEGOCLOUD SDK --&gt;<br>    &lt;script src=&quot;ZegoExpressWebRTC.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>3. Style Your App</h3><p>Create a simple, clean design with CSS. Focus on making the video areas large and clear, with easy-to-use buttons.</p><pre>* {<br>    margin: 0;<br>    padding: 0;<br>    box-sizing: border-box;<br>    font-family: Arial, sans-serif;<br>}<br><br>body {<br>    background-color: #f5f5f5;<br>}<br><br>header {<br>    background-color: #3498db;<br>    color: white;<br>    text-align: center;<br>    padding: 1rem;<br>}<br><br>main {<br>    max-width: 900px;<br>    margin: 0 auto;<br>    padding: 1rem;<br>}<br><br>.screen {<br>    display: none;<br>    padding: 1.5rem;<br>    background: white;<br>    border-radius: 8px;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);<br>    margin-top: 1.5rem;<br>    text-align: center;<br>}<br><br>.screen.active {<br>    display: block;<br>}<br><br>.terms {<br>    background-color: #f8f8f8;<br>    border-radius: 8px;<br>    padding: 10px;<br>    margin: 15px 0;<br>    font-size: 0.85rem;<br>    color: #666;<br>}<br><br>button {<br>    background-color: #3498db;<br>    color: white;<br>    border: none;<br>    padding: 10px 20px;<br>    margin: 10px 5px;<br>    border-radius: 4px;<br>    cursor: pointer;<br>    font-size: 16px;<br>}<br><br>button:hover {<br>    background-color: #2980b9;<br>}<br><br>#next-chat {<br>    background-color: #e74c3c;<br>}<br><br>#next-chat:hover {<br>    background-color: #c0392b;<br>}<br><br>#video-container {<br>    display: flex;<br>    justify-content: space-between;<br>    margin-bottom: 20px;<br>}<br><br>#local-video-wrapper, #remote-video-wrapper {<br>    width: 48%;<br>    text-align: center;<br>    border-radius: 8px;<br>    overflow: hidden;<br>    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);<br>}<br><br>#local-video, #remote-video {<br>    background-color: #222;<br>    height: 300px;<br>    width: 100%;<br>}<br><br>#chat-controls {<br>    margin: 15px 0;<br>    display: flex;<br>    flex-wrap: wrap;<br>    justify-content: center;<br>}<br><br>#text-chat {<br>    border: 1px solid #ddd;<br>    border-radius: 8px;<br>    height: 250px;<br>    display: flex;<br>    flex-direction: column;<br>}<br><br>#chat-messages {<br>    flex-grow: 1;<br>    padding: 10px;<br>    overflow-y: auto;<br>    background-color: #f9f9f9;<br>}<br><br>#chat-input-area {<br>    display: flex;<br>    padding: 10px;<br>    border-top: 1px solid #ddd;<br>}<br><br>#chat-input {<br>    flex-grow: 1;<br>    padding: 8px;<br>    border: 1px solid #ddd;<br>    border-radius: 4px;<br>    margin-right: 10px;<br>}<br><br>.message {<br>    margin-bottom: 8px;<br>    padding: 8px 12px;<br>    border-radius: 8px;<br>    max-width: 75%;<br>}<br><br>.user-message {<br>    background-color: #3498db;<br>    color: white;<br>    margin-left: auto;<br>}<br><br>.stranger-message {<br>    background-color: #eee;<br>    color: #333;<br>}</pre><h3>4. Add the ZEGOCLOUD SDK to Your Project</h3><p>The main part of your platform is the video chat functionality. Here’s how to add the ZEGOCLOUD SDK:</p><ol><li><a href="https://www.zegocloud.com/docs/video-call/download-sdk?platform=web&amp;language=javascript">Download the ZEGOCLOUD SDK</a> from the downloads page.</li><li>After downloading, extract the ZIP file to your computer.</li><li>Look for a file named “ZegoExpressWebRTC-X.X.X.js” in the extracted folder (the X.X.X will be version numbers).</li><li>Copy this file to your project folder (the same folder where your index.html is)</li><li>Make sure the script tag in your index.html matches the exact filename:</li></ol><pre>&lt;script src=”ZegoExpressWebRTC-X.X.X.js”&gt;&lt;/script&gt;<br>(Replace X.X.X with the actual version numbers in your file)</pre><p>Now add this code to your app.js file:</p><pre>// Get HTML elements<br>const welcomeScreen = document.getElementById(&#39;welcome-screen&#39;);<br>const chatScreen = document.getElementById(&#39;chat-screen&#39;);<br>const endingScreen = document.getElementById(&#39;ending-screen&#39;);<br>const startButton = document.getElementById(&#39;start-chat&#39;);<br>const nextButton = document.getElementById(&#39;next-chat&#39;);<br>const audioButton = document.getElementById(&#39;toggle-audio&#39;);<br>const videoButton = document.getElementById(&#39;toggle-video&#39;);<br>const endButton = document.getElementById(&#39;end-chat&#39;);<br>const newChatButton = document.getElementById(&#39;new-chat&#39;);<br>const sendButton = document.getElementById(&#39;send-message&#39;);<br>const chatInput = document.getElementById(&#39;chat-input&#39;);<br>const messagesArea = document.getElementById(&#39;chat-messages&#39;);<br><br>// Create status display<br>const statusDisplay = document.createElement(&#39;div&#39;);<br>statusDisplay.id = &#39;status&#39;;<br>statusDisplay.textContent = &#39;Ready to connect&#39;;<br>chatScreen.insertBefore(statusDisplay, chatScreen.firstChild);<br><br>// ZEGOCLOUD setup<br>const appID = 123456789;  // Replace with your ZEGOCLOUD AppID<br>const server = &#39;wss://webliveroom-test.zego.im/ws&#39;;  // ZEGOCLOUD server<br><br>// Start ZEGOCLOUD<br>const zg = new ZegoExpressEngine(appID, server);<br><br>// Setup tracking variables<br>let myStream = null;<br>let strangerStream = null;<br>let roomID = null;<br>let userID = null;<br>let audioMuted = false;<br>let videoOff = false;<br>let connectedToStranger = false;<br><br>// Create random room ID<br>function makeRoomID() {<br>    return room_${Math.random().toString(36).substring(2, 10)};<br>}<br><br>// Create user ID<br>function makeUserID() {<br>    return user_${Math.random().toString(36).substring(2, 8)};<br>}<br><br>// Update connection status<br>function updateStatus(status) {<br>    const statusBox = document.getElementById(&#39;status&#39;);<br>    statusBox.textContent = status;<br>}<br><br>// Show specific screen<br>function showScreen(screen) {<br>    welcomeScreen.classList.remove(&#39;active&#39;);<br>    chatScreen.classList.remove(&#39;active&#39;);<br>    endingScreen.classList.remove(&#39;active&#39;);<br>    <br>    screen.classList.add(&#39;active&#39;);<br>}<br><br>// Start new chat<br>async function startChat() {<br>    try {<br>        updateStatus(&#39;Connecting...&#39;);<br>        <br>        // Create new IDs<br>        roomID = makeRoomID();<br>        userID = makeUserID();<br>        <br>        // Join room<br>        await zg.loginRoom(roomID, &quot;&quot;, {<br>            userID: userID,<br>            userName: userID<br>        });<br>        <br>        // Start your camera and mic<br>        myStream = await zg.createStream({<br>            camera: {<br>                audio: true,<br>                video: true<br>            }<br>        });<br>        <br>        // Show your video<br>        const myVideo = zg.createLocalStreamView(myStream);<br>        myVideo.play(&quot;local-video&quot;);<br>        <br>        // Start sending your video<br>        await zg.startPublishingStream(userID, myStream);<br>        <br>        // Listen for other people&#39;s videos<br>        zg.on(&#39;roomStreamUpdate&#39;, async (roomID, type, streams) =&gt; {<br>            if (type === &#39;ADD&#39;) {<br>                // New person joined<br>                connectedToStranger = true;<br>                updateStatus(&#39;Connected to stranger&#39;);<br>                <br>                const strangerStreamID = streams[0].streamID;<br>                strangerStream = await zg.startPlayingStream(strangerStreamID);<br>                <br>                const strangerVideo = zg.createRemoteStreamView(strangerStream);<br>                strangerVideo.play(&quot;remote-video&quot;);<br>                <br>                // Show welcome message<br>                addMessage(&quot;System&quot;, &quot;Connected! Say hello!&quot;, false, true);<br>            } else if (type === &#39;DELETE&#39;) {<br>                // Person left<br>                connectedToStranger = false;<br>                updateStatus(&#39;Stranger disconnected&#39;);<br>                addMessage(&quot;System&quot;, &quot;Stranger disconnected. Click &#39;Next Person&#39; to continue.&quot;, false, true);<br>            }<br>        });<br>        <br>        // Show chat screen<br>        showScreen(chatScreen);<br>        <br>        // First message<br>        addMessage(&quot;System&quot;, &quot;Looking for someone to chat with...&quot;, false, true);<br>    } catch (error) {<br>        console.error(&quot;Error:&quot;, error);<br>        updateStatus(&#39;Connection Failed&#39;);<br>        alert(&quot;Could not start chat. Please check your camera and microphone permissions.&quot;);<br>    }<br>}<br><br>// End current chat<br>async function endChat() {<br>    try {<br>        updateStatus(&#39;Disconnecting...&#39;);<br>        <br>        if (myStream) {<br>            await zg.stopPublishingStream(userID);<br>            zg.destroyStream(myStream);<br>            myStream = null;<br>        }<br>        <br>        if (strangerStream) {<br>            await zg.stopPlayingStream(strangerStream.streamID);<br>            strangerStream = null;<br>        }<br>        <br>        if (roomID) {<br>            await zg.logoutRoom(roomID);<br>            roomID = null;<br>        }<br>        <br>        connectedToStranger = false;<br>        <br>        // Clear messages<br>        messagesArea.innerHTML = &#39;&#39;;<br>        <br>        // Reset buttons<br>        audioMuted = false;<br>        videoOff = false;<br>        audioButton.textContent = &quot;Mute&quot;;<br>        videoButton.textContent = &quot;Hide Video&quot;;<br>        <br>        updateStatus(&#39;Disconnected&#39;);<br>        <br>        // Show end screen<br>        showScreen(endingScreen);<br>    } catch (error) {<br>        console.error(&quot;Error ending chat:&quot;, error);<br>    }<br>}<br><br>// Find new chat partner<br>async function findNewPerson() {<br>    addMessage(&quot;System&quot;, &quot;Looking for a new person...&quot;, false, true);<br>    await endChat();<br>    await startChat();<br>}<br><br>// Toggle audio<br>async function toggleAudio() {<br>    if (myStream) {<br>        audioMuted = !audioMuted;<br>        await zg.mutePublishStreamAudio(myStream, audioMuted);<br>        audioButton.textContent = audioMuted ? &quot;Unmute&quot; : &quot;Mute&quot;;<br>        <br>        if (audioMuted) {<br>            addMessage(&quot;System&quot;, &quot;You muted your microphone&quot;, false, true);<br>        } else {<br>            addMessage(&quot;System&quot;, &quot;Your microphone is now on&quot;, false, true);<br>        }<br>    }<br>}<br><br>// Toggle video<br>async function toggleVideo() {<br>    if (myStream) {<br>        videoOff = !videoOff;<br>        await zg.mutePublishStreamVideo(myStream, videoOff);<br>        videoButton.textContent = videoOff ? &quot;Show Video&quot; : &quot;Hide Video&quot;;<br>        <br>        if (videoOff) {<br>            addMessage(&quot;System&quot;, &quot;You turned off your camera&quot;, false, true);<br>        } else {<br>            addMessage(&quot;System&quot;, &quot;Your camera is now on&quot;, false, true);<br>        }<br>    }<br>}<br><br>// Send message<br>function sendMessage() {<br>    const text = chatInput.value.trim();<br>    if (text &amp;&amp; connectedToStranger) {<br>        // Show message<br>        addMessage(&quot;You&quot;, text, true);<br>        <br>        // Clear input<br>        chatInput.value = &#39;&#39;;<br>    } else if (!connectedToStranger &amp;&amp; text) {<br>        addMessage(&quot;System&quot;, &quot;Wait for someone to connect before sending messages&quot;, false, true);<br>        chatInput.value = &#39;&#39;;<br>    }<br>}<br><br>// Add message to chat<br>function addMessage(sender, text, isUser = false, isSystem = false) {<br>    const message = document.createElement(&#39;div&#39;);<br>    message.classList.add(&#39;message&#39;);<br>    <br>    if (isUser) {<br>        message.classList.add(&#39;user-message&#39;);<br>        message.textContent = text;<br>    } else if (isSystem) {<br>        message.style.textAlign = &#39;center&#39;;<br>        message.style.fontStyle = &#39;italic&#39;;<br>        message.style.color = &#39;#666&#39;;<br>        message.style.backgroundColor = &#39;#f0f0f0&#39;;<br>        message.textContent = text;<br>    } else {<br>        message.classList.add(&#39;stranger-message&#39;);<br>        message.textContent = text;<br>    }<br>    <br>    messagesArea.appendChild(message);<br>    messagesArea.scrollTop = messagesArea.scrollHeight;<br>}<br><br>// Set up buttons<br>startButton.addEventListener(&#39;click&#39;, startChat);<br>nextButton.addEventListener(&#39;click&#39;, findNewPerson);<br>audioButton.addEventListener(&#39;click&#39;, toggleAudio);<br>videoButton.addEventListener(&#39;click&#39;, toggleVideo);<br>endButton.addEventListener(&#39;click&#39;, endChat);<br>newChatButton.addEventListener(&#39;click&#39;, startChat);<br>sendButton.addEventListener(&#39;click&#39;, sendMessage);<br><br>// Send with Enter key<br>chatInput.addEventListener(&#39;keypress&#39;, (e) =&gt; {<br>    if (e.key === &#39;Enter&#39;) {<br>        sendMessage();<br>    }<br>});<br><br>// Start when page loads<br>window.onload = async () =&gt; {<br>    try {<br>        // Check browser support<br>        const result = await zg.checkSystemRequirements();<br>        <br>        if (!result.webRTC) {<br>            alert(&quot;Your browser doesn&#39;t support video chat. Please try Chrome, Firefox, or Edge.&quot;);<br>            return;<br>        }<br>        <br>        // Set up ZEGOCLOUD<br>        zg.setLogConfig({<br>            logLevel: &#39;error&#39;<br>        });<br>        <br>        console.log(&#39;Ready to chat!&#39;);<br>    } catch (error) {<br>        console.error(&#39;Setup failed:&#39;, error);<br>        alert(&#39;Could not set up video chat. Please refresh or try another browser.&#39;);<br>    }<br>};</pre><h3>5. Test Your Platform</h3><ol><li>Open your website on one browser.</li><li>Click “<strong>Start</strong>” to begin.</li><li>Open the site in another browser or incognito window.</li><li>Click “<strong>Start</strong>” there too.</li><li>The two browsers should connect and you’ll see both videos.</li></ol><h3>6. Troubleshooting SDK Installation</h3><p>If you have problems with the SDK, check these common issues:</p><ul><li><strong>Wrong File Path:</strong> Make sure the path to the SDK file in your HTML is correct.</li><li><strong>File Not Found:</strong> Check that you copied the SDK file to your project folder.</li><li><strong>Version Mismatch:</strong> Some code might need updating if using a newer SDK version.</li><li><strong>Loading Error:</strong> Try refreshing your page or check browser console for specific errors.</li><li><strong>Permission Issues:</strong> Make sure your browser has permission to access your camera and microphone.</li></ul><h3>7. Add More Features</h3><p>Once your basic platform is working, you can add more features:</p><ul><li>User profiles.</li><li>Interests matching.</li><li>Gender filters.</li><li>Report system for inappropriate behavior.</li><li>Better mobile support.</li></ul><h3>Conclusion</h3><p>Building your own random video chat platform like Cammatch is now within reach. With ZEGOCLOUD handling the complex video streaming parts, you can focus on creating a great user experience. Start small with the basic features, test thoroughly, and add more options as you grow.</p><p>Remember to keep user safety in mind by adding simple reporting tools and clear rules. The steps in this guide give you all you need to start your own video chat service where people can meet and talk instantly. With some time and effort, your platform could become the next popular way to connect online.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2268757b167" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Gay Video Chat Platform Like Gydoo]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-a-gay-video-chat-platform-like-gydoo-fc664efcfd6a?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc664efcfd6a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 03:22:29 GMT</pubDate>
            <atom:updated>2025-04-15T03:22:29.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xXOfQpeAbzM26ndcgNxDYA.png" /></figure><p>The LGBTQ+ community needs safe online spaces to connect. Gay video chat platforms like Gydoo fill this need by helping users find friends and dates through video calls. Building your own platform requires specific tools and features.</p><p>This guide shows you the exact steps to create a gay-friendly video chat service from scratch. We focus on the unique needs of LGBTQ+ users — from privacy controls to matching preferences that matter to this community. Learn the technical requirements, security measures, and design elements that make these platforms successful without needing advanced programming knowledge.</p><h3>How to Build a Gay Video Chat Platform Like Gydoo</h3><p>Video chat platforms catering to specific communities have seen tremendous growth in recent years. Gydoo is a popular platform for the LGBTQ+ community, particularly gay men, to connect through spontaneous video conversations. In this section, we’ll use ZEGOCLOUD to add real-time communication to a gay dating app like Gydoo.</p><p>ZEGOCLOUD provides real-time communication <a href="https://www.zegocloud.com/docs">APIs and SDKs</a> that simplify adding interactive to your applications. For a community-focused platform like Gydoo, ZEGOCLOUD offers several advantages:</p><ul><li>Ready-to-use SDKs for web, iOS, Android, and other platforms.</li><li>Robust infrastructure handling complex video/audio connections.</li><li>Adaptive streaming quality that works across varying network conditions.</li><li>Low latency connections essential for natural conversations.</li><li>Scalable architecture to support growing user communities.</li></ul><p>By using ZEGOCLOUD’s technology, you can focus on creating an engaging, inclusive experience for your users rather than building complex video communication infrastructure from scratch.</p><h3>Prerequisites</h3><p>Before starting your Gydoo-like platform, ensure you have:</p><ul><li>A ZEGOCLOUD developer account (sign up <a href="https://console.zegocloud.com/account/signup">here</a>).</li><li>Your unique AppID and ServerSecret from the ZEGOCLOUD Admin Console.</li><li>A code editor or IDE (Visual Studio Code recommended).</li><li>Basic knowledge of HTML, CSS, and JavaScript.</li><li>A web server for testing (local or online).</li></ul><p>Let’s build our Gydoo gay chat alternative step by step!</p><h3>1. Setting Up the Project Structure</h3><p>First, we’ll create our project files and basic folder structure:</p><pre>mkdir gydoo-clone<br>cd gydoo-clone<br>touch index.html<br>touch styles.css<br>touch app.js</pre><p>This simple structure will keep our project organized and maintainable.</p><h3>2. Downloading and Integrating the ZEGOCLOUD SDK</h3><p>We’ll use the ZEGOCLOUD SDK to power our real-time communication features. Follow these steps to set it up:</p><ol><li><a href="https://www.zegocloud.com/docs/video-call/download-sdk?platform=web&amp;language=javascript">Get the SDK</a> from the official ZEGOCLOUD website.</li><li>Extract the downloaded ZIP file.</li><li>Inside the dist_js/ folder, find the file named ZegoExpressWebRTC-xxx.js.</li><li>Copy this file into your project directory.</li><li>Add a reference to it in your HTML file.</li></ol><p>Next, let’s build the HTML structure for our video chat platform:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Gydoo Clone - Gay Video Chat&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;header&gt;<br>        &lt;h1&gt;Gydoo Clone&lt;/h1&gt;<br>        &lt;p&gt;Connect with guys from around the world!&lt;/p&gt;<br>    &lt;/header&gt;<br>    <br>    &lt;main&gt;<br>        &lt;!-- Welcome Screen --&gt;<br>        &lt;div id=&quot;welcome-screen&quot; class=&quot;screen active&quot;&gt;<br>            &lt;h2&gt;Welcome to Gydoo Clone&lt;/h2&gt;<br>            &lt;p&gt;Meet and chat with guys in a safe, friendly environment.&lt;/p&gt;<br>            &lt;div class=&quot;terms-notice&quot;&gt;<br>                &lt;p&gt;By clicking &quot;Start Chatting&quot; you confirm you&#39;re 18+ and agree to our Terms of Service.&lt;/p&gt;<br>            &lt;/div&gt;<br>            &lt;button id=&quot;start-chat&quot;&gt;Start Chatting&lt;/button&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- Video Chat Screen --&gt;<br>        &lt;div id=&quot;chat-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;div id=&quot;video-container&quot;&gt;<br>                &lt;div id=&quot;local-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;local-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;You&lt;/p&gt;<br>                &lt;/div&gt;<br>                &lt;div id=&quot;remote-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;remote-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;Partner&lt;/p&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;chat-controls&quot;&gt;<br>                &lt;button id=&quot;next-chat&quot;&gt;Find Next&lt;/button&gt;<br>                &lt;button id=&quot;toggle-audio&quot;&gt;Mute&lt;/button&gt;<br>                &lt;button id=&quot;toggle-video&quot;&gt;Hide Video&lt;/button&gt;<br>                &lt;button id=&quot;end-chat&quot;&gt;End Chat&lt;/button&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;text-chat-container&quot;&gt;<br>                &lt;div id=&quot;chat-messages&quot;&gt;&lt;/div&gt;<br>                &lt;div id=&quot;chat-input-area&quot;&gt;<br>                    &lt;input type=&quot;text&quot; id=&quot;chat-input&quot; placeholder=&quot;Type a message...&quot;&gt;<br>                    &lt;button id=&quot;send-message&quot;&gt;Send&lt;/button&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- End Screen --&gt;<br>        &lt;div id=&quot;ending-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;h2&gt;Chat Ended&lt;/h2&gt;<br>            &lt;p&gt;Thanks for connecting! Ready to meet someone new?&lt;/p&gt;<br>            &lt;button id=&quot;new-chat&quot;&gt;Start New Chat&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/main&gt;<br>    <br>    &lt;!-- ZEGOCLOUD SDK --&gt;<br>    &lt;script src=&quot;./ZegoExpressWebRTC.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Gydoo Clone - Gay Video Chat&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;header&gt;<br>        &lt;h1&gt;Gydoo Clone&lt;/h1&gt;<br>        &lt;p&gt;Connect with guys from around the world!&lt;/p&gt;<br>    &lt;/header&gt;<br>    <br>    &lt;main&gt;<br>        &lt;!-- Welcome Screen --&gt;<br>        &lt;div id=&quot;welcome-screen&quot; class=&quot;screen active&quot;&gt;<br>            &lt;h2&gt;Welcome to Gydoo Clone&lt;/h2&gt;<br>            &lt;p&gt;Meet and chat with guys in a safe, friendly environment.&lt;/p&gt;<br>            &lt;div class=&quot;terms-notice&quot;&gt;<br>                &lt;p&gt;By clicking &quot;Start Chatting&quot; you confirm you&#39;re 18+ and agree to our Terms of Service.&lt;/p&gt;<br>            &lt;/div&gt;<br>            &lt;button id=&quot;start-chat&quot;&gt;Start Chatting&lt;/button&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- Video Chat Screen --&gt;<br>        &lt;div id=&quot;chat-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;div id=&quot;video-container&quot;&gt;<br>                &lt;div id=&quot;local-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;local-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;You&lt;/p&gt;<br>                &lt;/div&gt;<br>                &lt;div id=&quot;remote-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;remote-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;Partner&lt;/p&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;chat-controls&quot;&gt;<br>                &lt;button id=&quot;next-chat&quot;&gt;Find Next&lt;/button&gt;<br>                &lt;button id=&quot;toggle-audio&quot;&gt;Mute&lt;/button&gt;<br>                &lt;button id=&quot;toggle-video&quot;&gt;Hide Video&lt;/button&gt;<br>                &lt;button id=&quot;end-chat&quot;&gt;End Chat&lt;/button&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;text-chat-container&quot;&gt;<br>                &lt;div id=&quot;chat-messages&quot;&gt;&lt;/div&gt;<br>                &lt;div id=&quot;chat-input-area&quot;&gt;<br>                    &lt;input type=&quot;text&quot; id=&quot;chat-input&quot; placeholder=&quot;Type a message...&quot;&gt;<br>                    &lt;button id=&quot;send-message&quot;&gt;Send&lt;/button&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- End Screen --&gt;<br>        &lt;div id=&quot;ending-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;h2&gt;Chat Ended&lt;/h2&gt;<br>            &lt;p&gt;Thanks for connecting! Ready to meet someone new?&lt;/p&gt;<br>            &lt;button id=&quot;new-chat&quot;&gt;Start New Chat&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/main&gt;<br>    <br>    &lt;!-- ZEGOCLOUD SDK --&gt;<br>    &lt;script src=&quot;./ZegoExpressWebRTC.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>The HTML has a welcome screen with an age check and a button to start. After that, it shows the chat screen with two video areas — one for you and one for the other person.</p><p>There are buttons to find a new partner, mute, hide video, or end the chat. It also includes a text chat area to type and see messages. When the chat ends, there’s a screen with a button to start again. The ZEGOCLOUD SDK handles the real-time video and audio.</p><p>Notice how we’ve customized the language to be more inclusive and appropriate for a gay-focused platform, using terms like “partner” instead of “stranger” and adding an age verification notice.</p><h3>3. Styling the Application with LGBTQ+-Friendly Design</h3><p>Now, let’s create a visually appealing interface with colors that reflect the LGBTQ+ community while maintaining a clean, modern look:</p><pre>* {<br>    margin: 0;<br>    padding: 0;<br>    box-sizing: border-box;<br>    font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif;<br>}<br><br>body {<br>    background-color: #f8f9fa;<br>    color: #333;<br>    line-height: 1.6;<br>}<br><br>header {<br>    background: linear-gradient(90deg, #ff8a00, #e52e71);<br>    color: white;<br>    text-align: center;<br>    padding: 1.5rem;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);<br>}<br><br>main {<br>    max-width: 1000px;<br>    margin: 0 auto;<br>    padding: 1rem;<br>}<br><br>.screen {<br>    display: none;<br>    padding: 2rem;<br>    background: white;<br>    border-radius: 12px;<br>    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);<br>    margin-top: 2rem;<br>    text-align: center;<br>}<br><br>.screen.active {<br>    display: block;<br>}<br><br>.terms-notice {<br>    background-color: #f8f8f8;<br>    border-radius: 8px;<br>    padding: 10px;<br>    margin: 15px 0;<br>    font-size: 0.85rem;<br>    color: #666;<br>}<br><br>button {<br>    background: linear-gradient(90deg, #6a11cb, #2575fc);<br>    color: white;<br>    border: none;<br>    padding: 12px 24px;<br>    margin: 10px 5px;<br>    border-radius: 50px;<br>    cursor: pointer;<br>    font-size: 16px;<br>    font-weight: 600;<br>    transition: all 0.3s ease;<br>}<br><br>button:hover {<br>    background: linear-gradient(90deg, #5a0fb0, #1a65e8);<br>    transform: translateY(-2px);<br>    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);<br>}<br><br>#next-chat {<br>    background: linear-gradient(90deg, #ff8a00, #ff2976);<br>}<br><br>#next-chat:hover {<br>    background: linear-gradient(90deg, #e57e00, #e52e71);<br>}<br><br>#end-chat {<br>    background: linear-gradient(90deg, #ff416c, #ff4b2b);<br>}<br><br>#end-chat:hover {<br>    background: linear-gradient(90deg, #e53c62, #e54327);<br>}<br><br>#video-container {<br>    display: flex;<br>    justify-content: space-between;<br>    margin-bottom: 20px;<br>}<br><br>#local-video-wrapper, #remote-video-wrapper {<br>    width: 48%;<br>    text-align: center;<br>    border-radius: 12px;<br>    overflow: hidden;<br>    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);<br>}<br><br>#local-video, #remote-video {<br>    background-color: #212121;<br>    height: 320px;<br>    width: 100%;<br>    margin-bottom: 10px;<br>}<br><br>#local-video-wrapper p, #remote-video-wrapper p {<br>    padding: 8px;<br>    font-weight: 600;<br>    color: #555;<br>}<br><br>#chat-controls {<br>    margin-bottom: 20px;<br>    display: flex;<br>    flex-wrap: wrap;<br>    justify-content: center;<br>}<br><br>#text-chat-container {<br>    border: 1px solid #e0e0e0;<br>    border-radius: 12px;<br>    height: 300px;<br>    display: flex;<br>    flex-direction: column;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);<br>}<br><br>#chat-messages {<br>    flex-grow: 1;<br>    padding: 15px;<br>    overflow-y: auto;<br>    background-color: #f9f9f9;<br>}<br><br>#chat-input-area {<br>    display: flex;<br>    padding: 12px;<br>    border-top: 1px solid #e0e0e0;<br>    background-color: white;<br>}<br><br>#chat-input {<br>    flex-grow: 1;<br>    padding: 10px 16px;<br>    border: 1px solid #ddd;<br>    border-radius: 50px;<br>    margin-right: 10px;<br>    font-size: 14px;<br>}<br><br>#chat-input:focus {<br>    outline: none;<br>    border-color: #6a11cb;<br>}<br><br>.message {<br>    margin-bottom: 12px;<br>    padding: 10px 15px;<br>    border-radius: 18px;<br>    max-width: 75%;<br>    word-wrap: break-word;<br>    position: relative;<br>}<br><br>.user-message {<br>    background: linear-gradient(135deg, #6a11cb, #2575fc);<br>    color: white;<br>    margin-left: auto;<br>    border-bottom-right-radius: 4px;<br>}<br><br>.partner-message {<br>    background-color: #e9e9eb;<br>    color: #333;<br>    border-bottom-left-radius: 4px;<br>}<br><br>#connection-status {<br>    text-align: center;<br>    margin: 10px 0;<br>    font-style: italic;<br>    color: #555;<br>    padding: 5px;<br>    border-radius: 20px;<br>    background-color: #f0f0f0;<br>    font-weight: 500;<br>}<br><br>@media (max-width: 768px) {<br>    #video-container {<br>        flex-direction: column;<br>    }<br>    <br>    #local-video-wrapper, #remote-video-wrapper {<br>        width: 100%;<br>        margin-bottom: 15px;<br>    }<br>    <br>    button {<br>        padding: 10px 16px;<br>        font-size: 14px;<br>    }<br>}* {<br>    margin: 0;<br>    padding: 0;<br>    box-sizing: border-box;<br>    font-family: &#39;Segoe UI&#39;, Tahoma, Geneva, Verdana, sans-serif;<br>}<br><br>body {<br>    background-color: #f8f9fa;<br>    color: #333;<br>    line-height: 1.6;<br>}<br><br>header {<br>    background: linear-gradient(90deg, #ff8a00, #e52e71);<br>    color: white;<br>    text-align: center;<br>    padding: 1.5rem;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);<br>}<br><br>main {<br>    max-width: 1000px;<br>    margin: 0 auto;<br>    padding: 1rem;<br>}<br><br>.screen {<br>    display: none;<br>    padding: 2rem;<br>    background: white;<br>    border-radius: 12px;<br>    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);<br>    margin-top: 2rem;<br>    text-align: center;<br>}<br><br>.screen.active {<br>    display: block;<br>}<br><br>.terms-notice {<br>    background-color: #f8f8f8;<br>    border-radius: 8px;<br>    padding: 10px;<br>    margin: 15px 0;<br>    font-size: 0.85rem;<br>    color: #666;<br>}<br><br>button {<br>    background: linear-gradient(90deg, #6a11cb, #2575fc);<br>    color: white;<br>    border: none;<br>    padding: 12px 24px;<br>    margin: 10px 5px;<br>    border-radius: 50px;<br>    cursor: pointer;<br>    font-size: 16px;<br>    font-weight: 600;<br>    transition: all 0.3s ease;<br>}<br><br>button:hover {<br>    background: linear-gradient(90deg, #5a0fb0, #1a65e8);<br>    transform: translateY(-2px);<br>    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);<br>}<br><br>#next-chat {<br>    background: linear-gradient(90deg, #ff8a00, #ff2976);<br>}<br><br>#next-chat:hover {<br>    background: linear-gradient(90deg, #e57e00, #e52e71);<br>}<br><br>#end-chat {<br>    background: linear-gradient(90deg, #ff416c, #ff4b2b);<br>}<br><br>#end-chat:hover {<br>    background: linear-gradient(90deg, #e53c62, #e54327);<br>}<br><br>#video-container {<br>    display: flex;<br>    justify-content: space-between;<br>    margin-bottom: 20px;<br>}<br><br>#local-video-wrapper, #remote-video-wrapper {<br>    width: 48%;<br>    text-align: center;<br>    border-radius: 12px;<br>    overflow: hidden;<br>    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);<br>}<br><br>#local-video, #remote-video {<br>    background-color: #212121;<br>    height: 320px;<br>    width: 100%;<br>    margin-bottom: 10px;<br>}<br><br>#local-video-wrapper p, #remote-video-wrapper p {<br>    padding: 8px;<br>    font-weight: 600;<br>    color: #555;<br>}<br><br>#chat-controls {<br>    margin-bottom: 20px;<br>    display: flex;<br>    flex-wrap: wrap;<br>    justify-content: center;<br>}<br><br>#text-chat-container {<br>    border: 1px solid #e0e0e0;<br>    border-radius: 12px;<br>    height: 300px;<br>    display: flex;<br>    flex-direction: column;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);<br>}<br><br>#chat-messages {<br>    flex-grow: 1;<br>    padding: 15px;<br>    overflow-y: auto;<br>    background-color: #f9f9f9;<br>}<br><br>#chat-input-area {<br>    display: flex;<br>    padding: 12px;<br>    border-top: 1px solid #e0e0e0;<br>    background-color: white;<br>}<br><br>#chat-input {<br>    flex-grow: 1;<br>    padding: 10px 16px;<br>    border: 1px solid #ddd;<br>    border-radius: 50px;<br>    margin-right: 10px;<br>    font-size: 14px;<br>}<br><br>#chat-input:focus {<br>    outline: none;<br>    border-color: #6a11cb;<br>}<br><br>.message {<br>    margin-bottom: 12px;<br>    padding: 10px 15px;<br>    border-radius: 18px;<br>    max-width: 75%;<br>    word-wrap: break-word;<br>    position: relative;<br>}<br><br>.user-message {<br>    background: linear-gradient(135deg, #6a11cb, #2575fc);<br>    color: white;<br>    margin-left: auto;<br>    border-bottom-right-radius: 4px;<br>}<br><br>.partner-message {<br>    background-color: #e9e9eb;<br>    color: #333;<br>    border-bottom-left-radius: 4px;<br>}<br><br>#connection-status {<br>    text-align: center;<br>    margin: 10px 0;<br>    font-style: italic;<br>    color: #555;<br>    padding: 5px;<br>    border-radius: 20px;<br>    background-color: #f0f0f0;<br>    font-weight: 500;<br>}<br><br>@media (max-width: 768px) {<br>    #video-container {<br>        flex-direction: column;<br>    }<br>    <br>    #local-video-wrapper, #remote-video-wrapper {<br>        width: 100%;<br>        margin-bottom: 15px;<br>    }<br>    <br>    button {<br>        padding: 10px 16px;<br>        font-size: 14px;<br>    }<br>}</pre><h3>4. Implementing the Main Functionality</h3><p>Now, let’s write the JavaScript that powers our gay video chat platform. This is where we integrate the ZEGOCLOUD SDK to handle real-time video, audio, and messaging:</p><pre>// DOM elements<br>const welcomeScreen = document.getElementById(&#39;welcome-screen&#39;);<br>const chatScreen = document.getElementById(&#39;chat-screen&#39;);<br>const endingScreen = document.getElementById(&#39;ending-screen&#39;);<br>const startChatBtn = document.getElementById(&#39;start-chat&#39;);<br>const nextChatBtn = document.getElementById(&#39;next-chat&#39;);<br>const toggleAudioBtn = document.getElementById(&#39;toggle-audio&#39;);<br>const toggleVideoBtn = document.getElementById(&#39;toggle-video&#39;);<br>const endChatBtn = document.getElementById(&#39;end-chat&#39;);<br>const newChatBtn = document.getElementById(&#39;new-chat&#39;);<br>const sendMessageBtn = document.getElementById(&#39;send-message&#39;);<br>const chatInput = document.getElementById(&#39;chat-input&#39;);<br>const chatMessages = document.getElementById(&#39;chat-messages&#39;);<br><br>// Add connection status element to the DOM<br>const statusElement = document.createElement(&#39;div&#39;);<br>statusElement.id = &#39;connection-status&#39;;<br>statusElement.textContent = &#39;Status: Ready to Connect&#39;;<br>chatScreen.insertBefore(statusElement, chatScreen.firstChild);<br><br>// ZEGOCLOUD SDK setup - Replace these with your actual credentials<br>const appID = 987654321;  // Replace with your ZEGOCLOUD AppID<br>const serverURL = &#39;wss://webliveroom-test.zego.im/ws&#39;;  // ZEGOCLOUD server URL<br><br>// Initialize ZEGOCLOUD SDK<br>const zg = new ZegoExpressEngine(appID, serverURL);<br><br>// Variables to track state<br>let localStream = null;<br>let remoteStream = null;<br>let roomID = null;<br>let userID = null;<br>let isAudioMuted = false;<br>let isVideoOff = false;<br>let isConnectedToPartner = false;<br>let partnerName = &quot;Partner&quot;;<br><br>// Function to generate a random room ID with a community prefix<br>function generateRandomRoomID() {<br>    return gydoo_${Math.random().toString(36).substring(2, 10)};<br>}<br><br>// Function to generate a unique user ID<br>function generateUserID() {<br>    const timestamp = new Date().getTime();<br>    const randomPart = Math.random().toString(36).substring(2, 6);<br>    return user_${randomPart}_${timestamp};<br>}<br><br>// Function to update connection status with visual indicator<br>function updateConnectionStatus(status) {<br>    const statusElement = document.getElementById(&#39;connection-status&#39;);<br>    statusElement.textContent = Status: ${status};<br>    <br>    // Apply visual styling based on status<br>    if (status.includes(&#39;Connected&#39;)) {<br>        statusElement.style.backgroundColor = &#39;#d4edda&#39;;<br>        statusElement.style.color = &#39;#155724&#39;;<br>    } else if (status.includes(&#39;Connecting&#39;)) {<br>        statusElement.style.backgroundColor = &#39;#fff3cd&#39;;<br>        statusElement.style.color = &#39;#856404&#39;;<br>    } else if (status.includes(&#39;Failed&#39;) || status.includes(&#39;Disconnected&#39;)) {<br>        statusElement.style.backgroundColor = &#39;#f8d7da&#39;;<br>        statusElement.style.color = &#39;#721c24&#39;;<br>    } else {<br>        statusElement.style.backgroundColor = &#39;#f0f0f0&#39;;<br>        statusElement.style.color = &#39;#555&#39;;<br>    }<br>}<br><br>// Function to show a specific screen<br>function showScreen(screen) {<br>    welcomeScreen.classList.remove(&#39;active&#39;);<br>    chatScreen.classList.remove(&#39;active&#39;);<br>    endingScreen.classList.remove(&#39;active&#39;);<br>    <br>    screen.classList.add(&#39;active&#39;);<br>}<br><br>// Function to start a new chat<br>async function startNewChat() {<br>    try {<br>        updateConnectionStatus(&#39;Connecting to the community...&#39;);<br>        <br>        // Generate new IDs for this session<br>        roomID = generateRandomRoomID();<br>        userID = generateUserID();<br>        <br>        // Create a token (In a real app, this should be generated on your server)<br>        // For testing, we&#39;re using an empty token. In production, generate a proper token<br>        const token = &quot;&quot;; <br>        <br>        // Log in to the room<br>        await zg.loginRoom(roomID, token, {<br>            userID: userID,<br>            userName: userID<br>        }, { userUpdate: true });<br>        <br>        // Create and publish local stream<br>        localStream = await zg.createStream({<br>            camera: {<br>                audio: true,<br>                video: true,<br>                videoQuality: 2 // Higher quality for better experience<br>            }<br>        });<br>        <br>        // Display local stream<br>        const localView = zg.createLocalStreamView(localStream);<br>        localView.play(&quot;local-video&quot;, { enableAutoplayDialog: true });<br>        <br>        // Start publishing<br>        await zg.startPublishingStream(userID, localStream);<br>        <br>        // Listen for remote streams<br>        zg.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>            if (updateType === &#39;ADD&#39;) {<br>                // A new stream is available<br>                isConnectedToPartner = true;<br>                updateConnectionStatus(&#39;Connected to Partner&#39;);<br>                <br>                const remoteStreamID = streamList[0].streamID;<br>                remoteStream = await zg.startPlayingStream(remoteStreamID);<br>                <br>                const remoteView = zg.createRemoteStreamView(remoteStream);<br>                remoteView.play(&quot;remote-video&quot;, { enableAutoplayDialog: true });<br>                <br>                // Optional: Extract partner name from stream if available<br>                if (streamList[0].user &amp;&amp; streamList[0].user.userName) {<br>                    partnerName = streamList[0].user.userName.split(&#39;_&#39;)[0] || &quot;Partner&quot;;<br>                    document.querySelector(&#39;#remote-video-wrapper p&#39;).textContent = partnerName;<br>                }<br>                <br>                // Show welcome message<br>                showMessage(&quot;System&quot;, &quot;You&#39;re now connected! Say hello! 👋&quot;, false, true);<br>            } else if (updateType === &#39;DELETE&#39;) {<br>                // The remote stream has been removed<br>                isConnectedToPartner = false;<br>                updateConnectionStatus(&#39;Partner disconnected&#39;);<br>                showMessage(&quot;System&quot;, &quot;Your partner has disconnected. Click &#39;Find Next&#39; to meet someone new.&quot;, false, true);<br>                <br>                // Reset partner name<br>                partnerName = &quot;Partner&quot;;<br>                document.querySelector(&#39;#remote-video-wrapper p&#39;).textContent = partnerName;<br>            }<br>        });<br>        <br>        // Listen for room user updates<br>        zg.on(&#39;roomUserUpdate&#39;, (roomID, updateType, userList) =&gt; {<br>            console.log(`Room ${roomID} user update: ${updateType}`);<br>            userList.forEach(user =&gt; {<br>                console.log(`User: ${user.userID}`);<br>            });<br>        });<br>        <br>        // Show the chat screen<br>        showScreen(chatScreen);<br>        <br>        // Welcome message<br>        showMessage(&quot;System&quot;, &quot;Looking for a partner... Please wait.&quot;, false, true);<br>    } catch (error) {<br>        console.error(&quot;Error starting chat:&quot;, error);<br>        updateConnectionStatus(&#39;Connection Failed&#39;);<br>        alert(&quot;Failed to start chat. Please check your camera and microphone permissions and try again.&quot;);<br>    }<br>}<br><br>// Function to end the current chat<br>async function endCurrentChat() {<br>    try {<br>        updateConnectionStatus(&#39;Disconnecting...&#39;);<br>        <br>        if (localStream) {<br>            // Stop publishing<br>            await zg.stopPublishingStream(userID);<br>            // Destroy the stream<br>            zg.destroyStream(localStream);<br>            localStream = null;<br>        }<br>        <br>        if (remoteStream) {<br>            // Stop playing remote stream<br>            await zg.stopPlayingStream(remoteStream.streamID);<br>            remoteStream = null;<br>        }<br>        <br>        // Logout from the room<br>        if (roomID) {<br>            await zg.logoutRoom(roomID);<br>            roomID = null;<br>        }<br>        <br>        // Reset connection state<br>        isConnectedToPartner = false;<br>        <br>        // Clear chat messages<br>        chatMessages.innerHTML = &#39;&#39;;<br>        <br>        // Reset audio/video state<br>        isAudioMuted = false;<br>        isVideoOff = false;<br>        toggleAudioBtn.textContent = &quot;Mute&quot;;<br>        toggleVideoBtn.textContent = &quot;Hide Video&quot;;<br>        <br>        updateConnectionStatus(&#39;Disconnected&#39;);<br>        <br>        // Reset partner name<br>        partnerName = &quot;Partner&quot;;<br>        document.querySelector(&#39;#remote-video-wrapper p&#39;).textContent = partnerName;<br>        <br>        // Show the ending screen<br>        showScreen(endingScreen);<br>    } catch (error) {<br>        console.error(&quot;Error ending chat:&quot;, error);<br>    }<br>}<br><br>// Function to find a new chat partner<br>async function findNewChatPartner() {<br>    // Show looking message before disconnecting<br>    showMessage(&quot;System&quot;, &quot;Looking for a new partner...&quot;, false, true);<br>    <br>    // End the current chat<br>    await endCurrentChat();<br>    <br>    // Start a new chat<br>    await startNewChat();<br>}<br><br>// Function to toggle audio<br>async function toggleAudio() {<br>    if (localStream) {<br>        isAudioMuted = !isAudioMuted;<br>        await zg.mutePublishStreamAudio(localStream, isAudioMuted);<br>        toggleAudioBtn.textContent = isAudioMuted ? &quot;Unmute&quot; : &quot;Mute&quot;;<br>        <br>        // Show status message<br>        if (isAudioMuted) {<br>            showMessage(&quot;System&quot;, &quot;You muted your microphone&quot;, false, true);<br>        } else {<br>            showMessage(&quot;System&quot;, &quot;Your microphone is now active&quot;, false, true);<br>        }<br>    }<br>}<br><br>// Function to toggle video<br>async function toggleVideo() {<br>    if (localStream) {<br>        isVideoOff = !isVideoOff;<br>        await zg.mutePublishStreamVideo(localStream, isVideoOff);<br>        toggleVideoBtn.textContent = isVideoOff ? &quot;Show Video&quot; : &quot;Hide Video&quot;;<br>        <br>        // Show status message<br>        if (isVideoOff) {<br>            showMessage(&quot;System&quot;, &quot;You turned off your camera&quot;, false, true);<br>        } else {<br>            showMessage(&quot;System&quot;, &quot;Your camera is now active&quot;, false, true);<br>        }<br>    }<br>}<br><br>// Function to send a chat message<br>function sendChatMessage() {<br>    const messageText = chatInput.value.trim();<br>    if (messageText &amp;&amp; isConnectedToPartner) {<br>        // Display the message in the chat<br>        showMessage(&quot;You&quot;, messageText, true);<br>        <br>        // In a real app, you would send this message to the other user<br>        // For a complete implementation, you would use ZEGOCLOUD&#39;s real-time messaging<br>        // This example just displays messages locally for simplicity<br>        <br>        // Clear the input<br>        chatInput.value = &#39;&#39;;<br>    } else if (!isConnectedToPartner &amp;&amp; messageText) {<br>        showMessage(&quot;System&quot;, &quot;Wait for a partner to connect before sending messages&quot;, false, true);<br>        chatInput.value = &#39;&#39;;<br>    }<br>}<br><br>// Function to display a message in the chat<br>function showMessage(sender, text, isUser = false, isSystem = false) {<br>    const messageElement = document.createElement(&#39;div&#39;);<br>    messageElement.classList.add(&#39;message&#39;);<br>    <br>    if (isUser) {<br>        messageElement.classList.add(&#39;user-message&#39;);<br>        messageElement.textContent = text;<br>    } else if (isSystem) {<br>        messageElement.style.textAlign = &#39;center&#39;;<br>        messageElement.style.fontStyle = &#39;italic&#39;;<br>        messageElement.style.color = &#39;#666&#39;;<br>        messageElement.style.backgroundColor = &#39;#f0f0f0&#39;;<br>        messageElement.style.padding = &#39;8px 12px&#39;;<br>        messageElement.style.borderRadius = &#39;10px&#39;;<br>        messageElement.style.maxWidth = &#39;90%&#39;;<br>        messageElement.style.margin = &#39;10px auto&#39;;<br>        messageElement.textContent = text;<br>    } else {<br>        messageElement.classList.add(&#39;partner-message&#39;);<br>        messageElement.textContent = ${sender === &quot;System&quot; ? &quot;&quot; : partnerName + &quot;: &quot;}${text};<br>    }<br>    <br>    chatMessages.appendChild(messageElement);<br>    <br>    // Scroll to the bottom<br>    chatMessages.scrollTop = chatMessages.scrollHeight;<br>}<br><br>// Event listeners<br>startChatBtn.addEventListener(&#39;click&#39;, startNewChat);<br>nextChatBtn.addEventListener(&#39;click&#39;, findNewChatPartner);<br>toggleAudioBtn.addEventListener(&#39;click&#39;, toggleAudio);<br>toggleVideoBtn.addEventListener(&#39;click&#39;, toggleVideo);<br>endChatBtn.addEventListener(&#39;click&#39;, endCurrentChat);<br>newChatBtn.addEventListener(&#39;click&#39;, startNewChat);<br>sendMessageBtn.addEventListener(&#39;click&#39;, sendChatMessage);<br><br>// Allow sending messages with Enter key<br>chatInput.addEventListener(&#39;keypress&#39;, (e) =&gt; {<br>    if (e.key === &#39;Enter&#39;) {<br>        sendChatMessage();<br>    }<br>});<br><br>// Initialize the SDK when the page loads<br>window.onload = async () =&gt; {<br>    try {<br>        // Check browser compatibility<br>        const result = await zg.checkSystemRequirements();<br>        console.log(&quot;Browser compatibility check result:&quot;, result);<br>        <br>        if (!result.webRTC) {<br>            alert(&quot;Your browser doesn&#39;t support WebRTC, which is required for video chat. Please try Chrome, Firefox, or Edge.&quot;);<br>            return;<br>        }<br>        <br>        // Initialize the ZEGOCLOUD SDK<br>        zg.setLogConfig({<br>            logLevel: &#39;error&#39;<br>        });<br>        <br>        // Set event handlers for SDK events<br>        zg.on(&#39;roomStateUpdate&#39;, (roomID, state, errorCode, extendedData) =&gt; {<br>            if (state === &#39;DISCONNECTED&#39;) {<br>                console.log(&#39;Disconnected from room&#39;);<br>                updateConnectionStatus(&#39;Disconnected&#39;);<br>            } else if (state === &#39;CONNECTING&#39;) {<br>                console.log(&#39;Connecting to room&#39;);<br>                updateConnectionStatus(&#39;Connecting...&#39;);<br>            } else if (state === &#39;CONNECTED&#39;) {<br>                console.log(&#39;Connected to room&#39;);<br>                updateConnectionStatus(&#39;Connected to Room&#39;);<br>            }<br>        });<br>        <br>        // Set up quality monitoring to ensure best video experience<br>        zg.on(&#39;publishQualityUpdate&#39;, (streamID, stats) =&gt; {<br>            // Adjust video parameters based on network conditions<br>            if (stats.video.bitrate &lt; 100 &amp;&amp; localStream) {<br>                // If bitrate is low, reduce video quality to maintain smooth experience<br>                zg.setVideoConfig(localStream, {<br>                    width: 640,<br>                    height: 360,<br>                    bitrate: 400,<br>                    frameRate: 15<br>                });<br>            } else if (stats.video.bitrate &gt; 1000 &amp;&amp; localStream) {<br>                // If connection is good, increase quality<br>                zg.setVideoConfig(localStream, {<br>                    width: 1280,<br>                    height: 720,<br>                    bitrate: 1200,<br>                    frameRate: 24<br>                });<br>            }<br>        });<br>        <br>        console.log(&#39;ZEGOCLOUD SDK initialized successfully&#39;);<br>    } catch (error) {<br>        console.error(&#39;Failed to initialize ZEGOCLOUD SDK:&#39;, error);<br>        alert(&#39;Failed to initialize video chat capabilities. Please refresh the page or try a different browser.&#39;);<br>    }<br>};// DOM elements<br>const welcomeScreen = document.getElementById(&#39;welcome-screen&#39;);<br>const chatScreen = document.getElementById(&#39;chat-screen&#39;);<br>const endingScreen = document.getElementById(&#39;ending-screen&#39;);<br>const startChatBtn = document.getElementById(&#39;start-chat&#39;);<br>const nextChatBtn = document.getElementById(&#39;next-chat&#39;);<br>const toggleAudioBtn = document.getElementById(&#39;toggle-audio&#39;);<br>const toggleVideoBtn = document.getElementById(&#39;toggle-video&#39;);<br>const endChatBtn = document.getElementById(&#39;end-chat&#39;);<br>const newChatBtn = document.getElementById(&#39;new-chat&#39;);<br>const sendMessageBtn = document.getElementById(&#39;send-message&#39;);<br>const chatInput = document.getElementById(&#39;chat-input&#39;);<br>const chatMessages = document.getElementById(&#39;chat-messages&#39;);<br><br>// Add connection status element to the DOM<br>const statusElement = document.createElement(&#39;div&#39;);<br>statusElement.id = &#39;connection-status&#39;;<br>statusElement.textContent = &#39;Status: Ready to Connect&#39;;<br>chatScreen.insertBefore(statusElement, chatScreen.firstChild);<br><br>// ZEGOCLOUD SDK setup - Replace these with your actual credentials<br>const appID = 987654321;  // Replace with your ZEGOCLOUD AppID<br>const serverURL = &#39;wss://webliveroom-test.zego.im/ws&#39;;  // ZEGOCLOUD server URL<br><br>// Initialize ZEGOCLOUD SDK<br>const zg = new ZegoExpressEngine(appID, serverURL);<br><br>// Variables to track state<br>let localStream = null;<br>let remoteStream = null;<br>let roomID = null;<br>let userID = null;<br>let isAudioMuted = false;<br>let isVideoOff = false;<br>let isConnectedToPartner = false;<br>let partnerName = &quot;Partner&quot;;<br><br>// Function to generate a random room ID with a community prefix<br>function generateRandomRoomID() {<br>    return gydoo_${Math.random().toString(36).substring(2, 10)};<br>}<br><br>// Function to generate a unique user ID<br>function generateUserID() {<br>    const timestamp = new Date().getTime();<br>    const randomPart = Math.random().toString(36).substring(2, 6);<br>    return user_${randomPart}_${timestamp};<br>}<br><br>// Function to update connection status with visual indicator<br>function updateConnectionStatus(status) {<br>    const statusElement = document.getElementById(&#39;connection-status&#39;);<br>    statusElement.textContent = Status: ${status};<br>    <br>    // Apply visual styling based on status<br>    if (status.includes(&#39;Connected&#39;)) {<br>        statusElement.style.backgroundColor = &#39;#d4edda&#39;;<br>        statusElement.style.color = &#39;#155724&#39;;<br>    } else if (status.includes(&#39;Connecting&#39;)) {<br>        statusElement.style.backgroundColor = &#39;#fff3cd&#39;;<br>        statusElement.style.color = &#39;#856404&#39;;<br>    } else if (status.includes(&#39;Failed&#39;) || status.includes(&#39;Disconnected&#39;)) {<br>        statusElement.style.backgroundColor = &#39;#f8d7da&#39;;<br>        statusElement.style.color = &#39;#721c24&#39;;<br>    } else {<br>        statusElement.style.backgroundColor = &#39;#f0f0f0&#39;;<br>        statusElement.style.color = &#39;#555&#39;;<br>    }<br>}<br><br>// Function to show a specific screen<br>function showScreen(screen) {<br>    welcomeScreen.classList.remove(&#39;active&#39;);<br>    chatScreen.classList.remove(&#39;active&#39;);<br>    endingScreen.classList.remove(&#39;active&#39;);<br>    <br>    screen.classList.add(&#39;active&#39;);<br>}<br><br>// Function to start a new chat<br>async function startNewChat() {<br>    try {<br>        updateConnectionStatus(&#39;Connecting to the community...&#39;);<br>        <br>        // Generate new IDs for this session<br>        roomID = generateRandomRoomID();<br>        userID = generateUserID();<br>        <br>        // Create a token (In a real app, this should be generated on your server)<br>        // For testing, we&#39;re using an empty token. In production, generate a proper token<br>        const token = &quot;&quot;; <br>        <br>        // Log in to the room<br>        await zg.loginRoom(roomID, token, {<br>            userID: userID,<br>            userName: userID<br>        }, { userUpdate: true });<br>        <br>        // Create and publish local stream<br>        localStream = await zg.createStream({<br>            camera: {<br>                audio: true,<br>                video: true,<br>                videoQuality: 2 // Higher quality for better experience<br>            }<br>        });<br>        <br>        // Display local stream<br>        const localView = zg.createLocalStreamView(localStream);<br>        localView.play(&quot;local-video&quot;, { enableAutoplayDialog: true });<br>        <br>        // Start publishing<br>        await zg.startPublishingStream(userID, localStream);<br>        <br>        // Listen for remote streams<br>        zg.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>            if (updateType === &#39;ADD&#39;) {<br>                // A new stream is available<br>                isConnectedToPartner = true;<br>                updateConnectionStatus(&#39;Connected to Partner&#39;);<br>                <br>                const remoteStreamID = streamList[0].streamID;<br>                remoteStream = await zg.startPlayingStream(remoteStreamID);<br>                <br>                const remoteView = zg.createRemoteStreamView(remoteStream);<br>                remoteView.play(&quot;remote-video&quot;, { enableAutoplayDialog: true });<br>                <br>                // Optional: Extract partner name from stream if available<br>                if (streamList[0].user &amp;&amp; streamList[0].user.userName) {<br>                    partnerName = streamList[0].user.userName.split(&#39;_&#39;)[0] || &quot;Partner&quot;;<br>                    document.querySelector(&#39;#remote-video-wrapper p&#39;).textContent = partnerName;<br>                }<br>                <br>                // Show welcome message<br>                showMessage(&quot;System&quot;, &quot;You&#39;re now connected! Say hello! 👋&quot;, false, true);<br>            } else if (updateType === &#39;DELETE&#39;) {<br>                // The remote stream has been removed<br>                isConnectedToPartner = false;<br>                updateConnectionStatus(&#39;Partner disconnected&#39;);<br>                showMessage(&quot;System&quot;, &quot;Your partner has disconnected. Click &#39;Find Next&#39; to meet someone new.&quot;, false, true);<br>                <br>                // Reset partner name<br>                partnerName = &quot;Partner&quot;;<br>                document.querySelector(&#39;#remote-video-wrapper p&#39;).textContent = partnerName;<br>            }<br>        });<br>        <br>        // Listen for room user updates<br>        zg.on(&#39;roomUserUpdate&#39;, (roomID, updateType, userList) =&gt; {<br>            console.log(`Room ${roomID} user update: ${updateType}`);<br>            userList.forEach(user =&gt; {<br>                console.log(`User: ${user.userID}`);<br>            });<br>        });<br>        <br>        // Show the chat screen<br>        showScreen(chatScreen);<br>        <br>        // Welcome message<br>        showMessage(&quot;System&quot;, &quot;Looking for a partner... Please wait.&quot;, false, true);<br>    } catch (error) {<br>        console.error(&quot;Error starting chat:&quot;, error);<br>        updateConnectionStatus(&#39;Connection Failed&#39;);<br>        alert(&quot;Failed to start chat. Please check your camera and microphone permissions and try again.&quot;);<br>    }<br>}<br><br>// Function to end the current chat<br>async function endCurrentChat() {<br>    try {<br>        updateConnectionStatus(&#39;Disconnecting...&#39;);<br>        <br>        if (localStream) {<br>            // Stop publishing<br>            await zg.stopPublishingStream(userID);<br>            // Destroy the stream<br>            zg.destroyStream(localStream);<br>            localStream = null;<br>        }<br>        <br>        if (remoteStream) {<br>            // Stop playing remote stream<br>            await zg.stopPlayingStream(remoteStream.streamID);<br>            remoteStream = null;<br>        }<br>        <br>        // Logout from the room<br>        if (roomID) {<br>            await zg.logoutRoom(roomID);<br>            roomID = null;<br>        }<br>        <br>        // Reset connection state<br>        isConnectedToPartner = false;<br>        <br>        // Clear chat messages<br>        chatMessages.innerHTML = &#39;&#39;;<br>        <br>        // Reset audio/video state<br>        isAudioMuted = false;<br>        isVideoOff = false;<br>        toggleAudioBtn.textContent = &quot;Mute&quot;;<br>        toggleVideoBtn.textContent = &quot;Hide Video&quot;;<br>        <br>        updateConnectionStatus(&#39;Disconnected&#39;);<br>        <br>        // Reset partner name<br>        partnerName = &quot;Partner&quot;;<br>        document.querySelector(&#39;#remote-video-wrapper p&#39;).textContent = partnerName;<br>        <br>        // Show the ending screen<br>        showScreen(endingScreen);<br>    } catch (error) {<br>        console.error(&quot;Error ending chat:&quot;, error);<br>    }<br>}<br><br>// Function to find a new chat partner<br>async function findNewChatPartner() {<br>    // Show looking message before disconnecting<br>    showMessage(&quot;System&quot;, &quot;Looking for a new partner...&quot;, false, true);<br>    <br>    // End the current chat<br>    await endCurrentChat();<br>    <br>    // Start a new chat<br>    await startNewChat();<br>}<br><br>// Function to toggle audio<br>async function toggleAudio() {<br>    if (localStream) {<br>        isAudioMuted = !isAudioMuted;<br>        await zg.mutePublishStreamAudio(localStream, isAudioMuted);<br>        toggleAudioBtn.textContent = isAudioMuted ? &quot;Unmute&quot; : &quot;Mute&quot;;<br>        <br>        // Show status message<br>        if (isAudioMuted) {<br>            showMessage(&quot;System&quot;, &quot;You muted your microphone&quot;, false, true);<br>        } else {<br>            showMessage(&quot;System&quot;, &quot;Your microphone is now active&quot;, false, true);<br>        }<br>    }<br>}<br><br>// Function to toggle video<br>async function toggleVideo() {<br>    if (localStream) {<br>        isVideoOff = !isVideoOff;<br>        await zg.mutePublishStreamVideo(localStream, isVideoOff);<br>        toggleVideoBtn.textContent = isVideoOff ? &quot;Show Video&quot; : &quot;Hide Video&quot;;<br>        <br>        // Show status message<br>        if (isVideoOff) {<br>            showMessage(&quot;System&quot;, &quot;You turned off your camera&quot;, false, true);<br>        } else {<br>            showMessage(&quot;System&quot;, &quot;Your camera is now active&quot;, false, true);<br>        }<br>    }<br>}<br><br>// Function to send a chat message<br>function sendChatMessage() {<br>    const messageText = chatInput.value.trim();<br>    if (messageText &amp;&amp; isConnectedToPartner) {<br>        // Display the message in the chat<br>        showMessage(&quot;You&quot;, messageText, true);<br>        <br>        // In a real app, you would send this message to the other user<br>        // For a complete implementation, you would use ZEGOCLOUD&#39;s real-time messaging<br>        // This example just displays messages locally for simplicity<br>        <br>        // Clear the input<br>        chatInput.value = &#39;&#39;;<br>    } else if (!isConnectedToPartner &amp;&amp; messageText) {<br>        showMessage(&quot;System&quot;, &quot;Wait for a partner to connect before sending messages&quot;, false, true);<br>        chatInput.value = &#39;&#39;;<br>    }<br>}<br><br>// Function to display a message in the chat<br>function showMessage(sender, text, isUser = false, isSystem = false) {<br>    const messageElement = document.createElement(&#39;div&#39;);<br>    messageElement.classList.add(&#39;message&#39;);<br>    <br>    if (isUser) {<br>        messageElement.classList.add(&#39;user-message&#39;);<br>        messageElement.textContent = text;<br>    } else if (isSystem) {<br>        messageElement.style.textAlign = &#39;center&#39;;<br>        messageElement.style.fontStyle = &#39;italic&#39;;<br>        messageElement.style.color = &#39;#666&#39;;<br>        messageElement.style.backgroundColor = &#39;#f0f0f0&#39;;<br>        messageElement.style.padding = &#39;8px 12px&#39;;<br>        messageElement.style.borderRadius = &#39;10px&#39;;<br>        messageElement.style.maxWidth = &#39;90%&#39;;<br>        messageElement.style.margin = &#39;10px auto&#39;;<br>        messageElement.textContent = text;<br>    } else {<br>        messageElement.classList.add(&#39;partner-message&#39;);<br>        messageElement.textContent = ${sender === &quot;System&quot; ? &quot;&quot; : partnerName + &quot;: &quot;}${text};<br>    }<br>    <br>    chatMessages.appendChild(messageElement);<br>    <br>    // Scroll to the bottom<br>    chatMessages.scrollTop = chatMessages.scrollHeight;<br>}<br><br>// Event listeners<br>startChatBtn.addEventListener(&#39;click&#39;, startNewChat);<br>nextChatBtn.addEventListener(&#39;click&#39;, findNewChatPartner);<br>toggleAudioBtn.addEventListener(&#39;click&#39;, toggleAudio);<br>toggleVideoBtn.addEventListener(&#39;click&#39;, toggleVideo);<br>endChatBtn.addEventListener(&#39;click&#39;, endCurrentChat);<br>newChatBtn.addEventListener(&#39;click&#39;, startNewChat);<br>sendMessageBtn.addEventListener(&#39;click&#39;, sendChatMessage);<br><br>// Allow sending messages with Enter key<br>chatInput.addEventListener(&#39;keypress&#39;, (e) =&gt; {<br>    if (e.key === &#39;Enter&#39;) {<br>        sendChatMessage();<br>    }<br>});<br><br>// Initialize the SDK when the page loads<br>window.onload = async () =&gt; {<br>    try {<br>        // Check browser compatibility<br>        const result = await zg.checkSystemRequirements();<br>        console.log(&quot;Browser compatibility check result:&quot;, result);<br>        <br>        if (!result.webRTC) {<br>            alert(&quot;Your browser doesn&#39;t support WebRTC, which is required for video chat. Please try Chrome, Firefox, or Edge.&quot;);<br>            return;<br>        }<br>        <br>        // Initialize the ZEGOCLOUD SDK<br>        zg.setLogConfig({<br>            logLevel: &#39;error&#39;<br>        });<br>        <br>        // Set event handlers for SDK events<br>        zg.on(&#39;roomStateUpdate&#39;, (roomID, state, errorCode, extendedData) =&gt; {<br>            if (state === &#39;DISCONNECTED&#39;) {<br>                console.log(&#39;Disconnected from room&#39;);<br>                updateConnectionStatus(&#39;Disconnected&#39;);<br>            } else if (state === &#39;CONNECTING&#39;) {<br>                console.log(&#39;Connecting to room&#39;);<br>                updateConnectionStatus(&#39;Connecting...&#39;);<br>            } else if (state === &#39;CONNECTED&#39;) {<br>                console.log(&#39;Connected to room&#39;);<br>                updateConnectionStatus(&#39;Connected to Room&#39;);<br>            }<br>        });<br>        <br>        // Set up quality monitoring to ensure best video experience<br>        zg.on(&#39;publishQualityUpdate&#39;, (streamID, stats) =&gt; {<br>            // Adjust video parameters based on network conditions<br>            if (stats.video.bitrate &lt; 100 &amp;&amp; localStream) {<br>                // If bitrate is low, reduce video quality to maintain smooth experience<br>                zg.setVideoConfig(localStream, {<br>                    width: 640,<br>                    height: 360,<br>                    bitrate: 400,<br>                    frameRate: 15<br>                });<br>            } else if (stats.video.bitrate &gt; 1000 &amp;&amp; localStream) {<br>                // If connection is good, increase quality<br>                zg.setVideoConfig(localStream, {<br>                    width: 1280,<br>                    height: 720,<br>                    bitrate: 1200,<br>                    frameRate: 24<br>                });<br>            }<br>        });<br>        <br>        console.log(&#39;ZEGOCLOUD SDK initialized successfully&#39;);<br>    } catch (error) {<br>        console.error(&#39;Failed to initialize ZEGOCLOUD SDK:&#39;, error);<br>        alert(&#39;Failed to initialize video chat capabilities. Please refresh the page or try a different browser.&#39;);<br>    }<br>};</pre><h3>5. Testing and Deployment</h3><p><strong>Set up a local server:</strong></p><ol><li>Use tools like Live Server extension in VS Code, Python’s http.server module, or simply open your index.html with your WebRTC-supported browsers.</li><li>Run python -m http.server in your project directory.</li><li>Access your application at <a href="http://localhost:8000/">http:<em>//localhost:8000</em></a></li></ol><p><strong>Test with multiple browsers:</strong></p><ul><li>Open your application in different browsers or private/incognito windows.</li><li>Test connections between these instances.</li><li>Verify that video, audio, and text messaging work correctly.</li></ul><p><strong>Test privacy controls:</strong></p><ul><li>Ensure mute and video toggle buttons work properly.</li><li>Verify that “<strong>Find Next</strong>” functionality connects to new partners.</li></ul><h3>Conclusion</h3><p>Building a gay video chat platform like Gydoo requires technical knowledge, design sensitivity, and a commitment to user safety. ZEGOCLOUD’s powerful SDK handles the complex video streaming technology, allowing you to focus on creating features that make the platform welcoming and valuable for the LGBTQ+ community.</p><p>Your platform can become a meaningful space for connection, friendship, and community building with the right balance of technology and thoughtful design. As you develop and grow your service, continually gather user feedback to refine the experience and better serve the community.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc664efcfd6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Random Video Chat Platform Like Uhmegle]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-a-random-video-chat-platform-like-uhmegle-0ae9cce0e918?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ae9cce0e918</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Tue, 15 Apr 2025 02:11:43 GMT</pubDate>
            <atom:updated>2025-04-15T02:33:48.435Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*IA6z0Cea91c50lqVjBqmpA.png" /></figure><p>Thinking about creating a random video chat platform like Uhmegle? It’s easier than you might think. This article will walk you through the essential steps to build your own video chat service that connects strangers instantly. From selecting the proper development tools to adding important security features, we’ll guide you through each stage.</p><p>Whether you’re a developer looking for a new project or an entrepreneur seeking the next big social platform, our guide provides clear directions to get your random video chat service up and running quickly. Learn how to create a platform that users will love while avoiding common pitfalls.</p><h3>How to Build a Random Video Chat Platform Like Uhmegle</h3><p>Random video chat platforms have become incredibly popular for connecting people worldwide through spontaneous video conversations. Uhmegle stands out as one of the most well-known platforms in this space. In this section, we’ll walk you through how to build your own random video chat platform using ZEGOCLOUD’s powerful real-time communication SDKs.</p><p><a href="https://www.zegocloud.com/">ZEGOCLOUD</a> offers real-time communication APIs and SDKs that make it easy to add real-time features to your apps and websites. With ZEGOCLOUD, you can quickly <a href="https://www.zegocloud.com/product/video-call">integrate video calls</a>, voice chat, live streaming, and other interactive features into your platforms.</p><p>ZEGOCLOUD provides multi-platform support, meaning you can use their technology across web, iOS, Android, and other platforms.</p><p>ZEGOCLOUD SDKs handle the complex parts of real-time communication, such as:</p><ul><li>Setting up video and audio connections.</li><li>Managing network conditions.</li><li>Ensuring low latency.</li><li>Handling multiple users in the same session.</li><li>Providing high-quality video and audio.</li></ul><p>By using ZEGOCLOUD for your random video chat platform, you’ll save development time and create a more reliable service for your users.</p><h3>Prerequisites</h3><p>Before we start building our Uhmegle-like platform, make sure you have:</p><ul><li>A ZEGOCLOUD developer account (<a href="https://console.zegocloud.com/account/signup">sign up</a>).</li><li>Basic knowledge of HTML, CSS, and JavaScript.</li><li>An AppID and ServerSecret from the ZEGOCLOUD Admin Console.</li><li>A text editor or IDE for coding.</li><li>A web server for testing (local or online).</li></ul><h3>What We’ll Be Building</h3><p>Our Uhmegle clone will include these essential features:</p><ul><li><strong>Random user matching:</strong> Connect users with random strangers.</li><li><strong>Real-time video and audio:</strong> Clear communication using WebRTC.</li><li><strong>Text chat:</strong> Allow users to send text messages alongside video.</li><li><strong>Next button:</strong> Skip the current chat partner and find a new one.</li><li><strong>Mute and video toggle:</strong> Control audio and video during chats.</li><li><strong>Simple, user-friendly interface: </strong>Easy to understand and navigate</li></ul><h3>Project Structure</h3><p>We’ll organize our project with the following files:</p><ul><li><strong>index.html</strong>: The main structure and UI elements.</li><li><strong>styles.css</strong>: Styling for our application.</li><li><strong>app.js</strong>: The core functionality and ZEGOCLOUD SDK integration.</li></ul><p>Let’s build our random video chat platform step by step!</p><h3>1. Set Up the Project Structure</h3><p>First, let’s create our project files and basic folder structure:</p><pre>`mkdir uhmegle-clone<br>cd uhmegle-clone<br>touch index.html<br>touch styles.css<br>touch app.js</pre><h3>2. Download and Integrate the SDK</h3><p>Let’s start by setting up our HTML file with all the necessary elements for our video chat platform:</p><ul><li><a href="https://www.zegocloud.com/docs/video-call/download-sdk?platform=web&amp;language=javascript">Download the SDK</a> from ZEGOCLOUD’s official website.</li><li>Extract the compressed package.</li><li>Locate the <strong>ZegoExpressWebRTC-xxx.js</strong> file in the <strong>dist_js/</strong> folder (where xxx is the version number).</li><li>Place this file in your project directory.</li><li>Reference it directly in your HTML file.</li></ul><p>Here’s how your HTML file should look:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Uhmegle Clone - Random Video Chat&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;header&gt;<br>        &lt;h1&gt;Uhmegle Clone&lt;/h1&gt;<br>        &lt;p&gt;Talk to strangers from around the world!&lt;/p&gt;<br>    &lt;/header&gt;<br>    <br>    &lt;main&gt;<br>        &lt;!-- Welcome Screen --&gt;<br>        &lt;div id=&quot;welcome-screen&quot; class=&quot;screen active&quot;&gt;<br>            &lt;h2&gt;Welcome to Uhmegle Clone&lt;/h2&gt;<br>            &lt;p&gt;Click the button below to start a random video chat.&lt;/p&gt;<br>            &lt;button id=&quot;start-chat&quot;&gt;Start Chatting&lt;/button&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- Video Chat Screen --&gt;<br>        &lt;div id=&quot;chat-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;div id=&quot;video-container&quot;&gt;<br>                &lt;div id=&quot;local-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;local-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;You&lt;/p&gt;<br>                &lt;/div&gt;<br>                &lt;div id=&quot;remote-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;remote-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;Stranger&lt;/p&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;chat-controls&quot;&gt;<br>                &lt;button id=&quot;next-chat&quot;&gt;Next&lt;/button&gt;<br>                &lt;button id=&quot;toggle-audio&quot;&gt;Mute&lt;/button&gt;<br>                &lt;button id=&quot;toggle-video&quot;&gt;Turn Off Video&lt;/button&gt;<br>                &lt;button id=&quot;end-chat&quot;&gt;End Chat&lt;/button&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;text-chat-container&quot;&gt;<br>                &lt;div id=&quot;chat-messages&quot;&gt;&lt;/div&gt;<br>                &lt;div id=&quot;chat-input-area&quot;&gt;<br>                    &lt;input type=&quot;text&quot; id=&quot;chat-input&quot; placeholder=&quot;Type a message...&quot;&gt;<br>                    &lt;button id=&quot;send-message&quot;&gt;Send&lt;/button&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- End Screen --&gt;<br>        &lt;div id=&quot;ending-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;h2&gt;Chat Ended&lt;/h2&gt;<br>            &lt;p&gt;Your chat has ended. Would you like to start a new chat?&lt;/p&gt;<br>            &lt;button id=&quot;new-chat&quot;&gt;Start New Chat&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/main&gt;<br>    <br>    &lt;!-- ZEGOCLOUD SDK --&gt;<br>    &lt;script src=&quot;./dist_js/ZegoExpressWebRTC-xxx.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Uhmegle Clone - Random Video Chat&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;header&gt;<br>        &lt;h1&gt;Uhmegle Clone&lt;/h1&gt;<br>        &lt;p&gt;Talk to strangers from around the world!&lt;/p&gt;<br>    &lt;/header&gt;<br>    <br>    &lt;main&gt;<br>        &lt;!-- Welcome Screen --&gt;<br>        &lt;div id=&quot;welcome-screen&quot; class=&quot;screen active&quot;&gt;<br>            &lt;h2&gt;Welcome to Uhmegle Clone&lt;/h2&gt;<br>            &lt;p&gt;Click the button below to start a random video chat.&lt;/p&gt;<br>            &lt;button id=&quot;start-chat&quot;&gt;Start Chatting&lt;/button&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- Video Chat Screen --&gt;<br>        &lt;div id=&quot;chat-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;div id=&quot;video-container&quot;&gt;<br>                &lt;div id=&quot;local-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;local-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;You&lt;/p&gt;<br>                &lt;/div&gt;<br>                &lt;div id=&quot;remote-video-wrapper&quot;&gt;<br>                    &lt;div id=&quot;remote-video&quot;&gt;&lt;/div&gt;<br>                    &lt;p&gt;Stranger&lt;/p&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;chat-controls&quot;&gt;<br>                &lt;button id=&quot;next-chat&quot;&gt;Next&lt;/button&gt;<br>                &lt;button id=&quot;toggle-audio&quot;&gt;Mute&lt;/button&gt;<br>                &lt;button id=&quot;toggle-video&quot;&gt;Turn Off Video&lt;/button&gt;<br>                &lt;button id=&quot;end-chat&quot;&gt;End Chat&lt;/button&gt;<br>            &lt;/div&gt;<br>            <br>            &lt;div id=&quot;text-chat-container&quot;&gt;<br>                &lt;div id=&quot;chat-messages&quot;&gt;&lt;/div&gt;<br>                &lt;div id=&quot;chat-input-area&quot;&gt;<br>                    &lt;input type=&quot;text&quot; id=&quot;chat-input&quot; placeholder=&quot;Type a message...&quot;&gt;<br>                    &lt;button id=&quot;send-message&quot;&gt;Send&lt;/button&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>        <br>        &lt;!-- End Screen --&gt;<br>        &lt;div id=&quot;ending-screen&quot; class=&quot;screen&quot;&gt;<br>            &lt;h2&gt;Chat Ended&lt;/h2&gt;<br>            &lt;p&gt;Your chat has ended. Would you like to start a new chat?&lt;/p&gt;<br>            &lt;button id=&quot;new-chat&quot;&gt;Start New Chat&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/main&gt;<br>    <br>    &lt;!-- ZEGOCLOUD SDK --&gt;<br>    &lt;script src=&quot;./dist_js/ZegoExpressWebRTC-xxx.js&quot;&gt;&lt;/script&gt;<br>    &lt;script src=&quot;app.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This HTML structure includes:</p><ul><li>A welcome screen with a start button.</li><li>A chat screen with local and remote video areas.</li><li>Control buttons for next, mute, video toggle, and ending the chat.</li><li>A text chat area with message display and input.</li><li>An ending screen with an option to start a new chat.</li><li>We also include the ZEGOCLOUD SDK from their CDN, which provides all the real-time communication functionality we need.</li></ul><h3>3. Style the Application</h3><p>Now, let’s add CSS to make our application look good:</p><pre>* {<br>    margin: 0;<br>    padding: 0;<br>    box-sizing: border-box;<br>    font-family: Arial, sans-serif;<br>}<br><br>body {<br>    background-color: #f4f4f4;<br>    color: #333;<br>    line-height: 1.6;<br>}<br><br>header {<br>    background-color: #4267B2;<br>    color: white;<br>    text-align: center;<br>    padding: 1rem;<br>}<br><br>main {<br>    max-width: 1000px;<br>    margin: 0 auto;<br>    padding: 1rem;<br>}<br><br>.screen {<br>    display: none;<br>    padding: 2rem;<br>    background: white;<br>    border-radius: 8px;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);<br>    margin-top: 2rem;<br>    text-align: center;<br>}<br><br>.screen.active {<br>    display: block;<br>}<br><br>button {<br>    background-color: #4267B2;<br>    color: white;<br>    border: none;<br>    padding: 10px 20px;<br>    margin: 10px 5px;<br>    border-radius: 4px;<br>    cursor: pointer;<br>    font-size: 16px;<br>}<br><br>button:hover {<br>    background-color: #365899;<br>}<br><br>#video-container {<br>    display: flex;<br>    justify-content: space-between;<br>    margin-bottom: 20px;<br>}<br><br>#local-video-wrapper, #remote-video-wrapper {<br>    width: 48%;<br>    text-align: center;<br>}<br><br>#local-video, #remote-video {<br>    background-color: #000;<br>    border-radius: 8px;<br>    height: 300px;<br>    width: 100%;<br>    margin-bottom: 10px;<br>}<br><br>#chat-controls {<br>    margin-bottom: 20px;<br>}<br><br>#text-chat-container {<br>    border: 1px solid #ddd;<br>    border-radius: 8px;<br>    height: 300px;<br>    display: flex;<br>    flex-direction: column;<br>}<br><br>#chat-messages {<br>    flex-grow: 1;<br>    padding: 10px;<br>    overflow-y: auto;<br>    background-color: #f9f9f9;<br>}<br><br>#chat-input-area {<br>    display: flex;<br>    padding: 10px;<br>    border-top: 1px solid #ddd;<br>}<br><br>#chat-input {<br>    flex-grow: 1;<br>    padding: 8px;<br>    border: 1px solid #ddd;<br>    border-radius: 4px;<br>    margin-right: 10px;<br>}<br><br>.message {<br>    margin-bottom: 10px;<br>    padding: 8px 12px;<br>    border-radius: 18px;<br>    max-width: 70%;<br>    word-wrap: break-word;<br>}<br><br>.user-message {<br>    background-color: #DCF8C6;<br>    margin-left: auto;<br>}<br><br>.stranger-message {<br>    background-color: #ECECEC;<br>}<br><br>#connection-status {<br>    text-align: center;<br>    margin: 10px 0;<br>    font-style: italic;<br>    color: #555;<br>}* {<br>    margin: 0;<br>    padding: 0;<br>    box-sizing: border-box;<br>    font-family: Arial, sans-serif;<br>}<br><br>body {<br>    background-color: #f4f4f4;<br>    color: #333;<br>    line-height: 1.6;<br>}<br><br>header {<br>    background-color: #4267B2;<br>    color: white;<br>    text-align: center;<br>    padding: 1rem;<br>}<br><br>main {<br>    max-width: 1000px;<br>    margin: 0 auto;<br>    padding: 1rem;<br>}<br><br>.screen {<br>    display: none;<br>    padding: 2rem;<br>    background: white;<br>    border-radius: 8px;<br>    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);<br>    margin-top: 2rem;<br>    text-align: center;<br>}<br><br>.screen.active {<br>    display: block;<br>}<br><br>button {<br>    background-color: #4267B2;<br>    color: white;<br>    border: none;<br>    padding: 10px 20px;<br>    margin: 10px 5px;<br>    border-radius: 4px;<br>    cursor: pointer;<br>    font-size: 16px;<br>}<br><br>button:hover {<br>    background-color: #365899;<br>}<br><br>#video-container {<br>    display: flex;<br>    justify-content: space-between;<br>    margin-bottom: 20px;<br>}<br><br>#local-video-wrapper, #remote-video-wrapper {<br>    width: 48%;<br>    text-align: center;<br>}<br><br>#local-video, #remote-video {<br>    background-color: #000;<br>    border-radius: 8px;<br>    height: 300px;<br>    width: 100%;<br>    margin-bottom: 10px;<br>}<br><br>#chat-controls {<br>    margin-bottom: 20px;<br>}<br><br>#text-chat-container {<br>    border: 1px solid #ddd;<br>    border-radius: 8px;<br>    height: 300px;<br>    display: flex;<br>    flex-direction: column;<br>}<br><br>#chat-messages {<br>    flex-grow: 1;<br>    padding: 10px;<br>    overflow-y: auto;<br>    background-color: #f9f9f9;<br>}<br><br>#chat-input-area {<br>    display: flex;<br>    padding: 10px;<br>    border-top: 1px solid #ddd;<br>}<br><br>#chat-input {<br>    flex-grow: 1;<br>    padding: 8px;<br>    border: 1px solid #ddd;<br>    border-radius: 4px;<br>    margin-right: 10px;<br>}<br><br>.message {<br>    margin-bottom: 10px;<br>    padding: 8px 12px;<br>    border-radius: 18px;<br>    max-width: 70%;<br>    word-wrap: break-word;<br>}<br><br>.user-message {<br>    background-color: #DCF8C6;<br>    margin-left: auto;<br>}<br><br>.stranger-message {<br>    background-color: #ECECEC;<br>}<br><br>#connection-status {<br>    text-align: center;<br>    margin: 10px 0;<br>    font-style: italic;<br>    color: #555;<br>}</pre><p>This CSS provides:</p><ul><li>Clean, modern styling for our application.</li><li>Proper layout for video containers.</li><li>Styling for buttons and input fields.</li><li>Chat message bubbles with different styles for user and stranger messages.</li></ul><h3>4. Implement the Core Functionality</h3><p>Now, let’s implement the JavaScript logic that will power our random video chat platform. This is where we’ll integrate the ZEGOCLOUD SDK to handle real-time video, audio, and messaging.</p><pre>// DOM elements<br>const welcomeScreen = document.getElementById(&#39;welcome-screen&#39;);<br>const chatScreen = document.getElementById(&#39;chat-screen&#39;);<br>const endingScreen = document.getElementById(&#39;ending-screen&#39;);<br>const startChatBtn = document.getElementById(&#39;start-chat&#39;);<br>const nextChatBtn = document.getElementById(&#39;next-chat&#39;);<br>const toggleAudioBtn = document.getElementById(&#39;toggle-audio&#39;);<br>const toggleVideoBtn = document.getElementById(&#39;toggle-video&#39;);<br>const endChatBtn = document.getElementById(&#39;end-chat&#39;);<br>const newChatBtn = document.getElementById(&#39;new-chat&#39;);<br>const sendMessageBtn = document.getElementById(&#39;send-message&#39;);<br>const chatInput = document.getElementById(&#39;chat-input&#39;);<br>const chatMessages = document.getElementById(&#39;chat-messages&#39;);<br><br>// Add connection status element to the DOM<br>const statusElement = document.createElement(&#39;div&#39;);<br>statusElement.id = &#39;connection-status&#39;;<br>statusElement.textContent = &#39;Status: Disconnected&#39;;<br>chatScreen.insertBefore(statusElement, chatScreen.firstChild);<br><br>// ZEGOCLOUD SDK setup - Replace these with your actual credentials<br>const appID = 123456789;  // Replace with your ZEGOCLOUD AppID<br>const serverURL = &#39;wss://webliveroom-test.zego.im/ws&#39;;  // ZEGOCLOUD server URL<br><br>// Initialize ZEGOCLOUD SDK<br>const zg = new ZegoExpressEngine(appID, serverURL);<br><br>// Variables to track state<br>let localStream = null;<br>let remoteStream = null;<br>let roomID = null;<br>let userID = null;<br>let isAudioMuted = false;<br>let isVideoOff = false;<br>let isConnectedToStranger = false;<br><br>// Function to generate a random room ID<br>function generateRandomRoomID() {<br>    return Math.random().toString(36).substring(2, 8).toUpperCase();<br>}<br><br>// Function to generate a unique user ID<br>function generateUserID() {<br>    const timestamp = new Date().getTime();<br>    const randomPart = Math.random().toString(36).substring(2, 6).toUpperCase();<br>    return user_${randomPart}_${timestamp};<br>}<br><br>// Function to update connection status<br>function updateConnectionStatus(status) {<br>    const statusElement = document.getElementById(&#39;connection-status&#39;);<br>    statusElement.textContent = Status: ${status};<br>}<br><br>// Function to show a specific screen<br>function showScreen(screen) {<br>    welcomeScreen.classList.remove(&#39;active&#39;);<br>    chatScreen.classList.remove(&#39;active&#39;);<br>    endingScreen.classList.remove(&#39;active&#39;);<br>    <br>    screen.classList.add(&#39;active&#39;);<br>}<br><br>// Function to start a new chat<br>async function startNewChat() {<br>    try {<br>        updateConnectionStatus(&#39;Connecting...&#39;);<br>        <br>        // Generate new IDs for this session<br>        roomID = generateRandomRoomID();<br>        userID = generateUserID();<br>        <br>        // Create a token (In a real app, this should be generated on your server)<br>        // For testing, we&#39;re using an empty token. In production, generate a proper token<br>        const token = &quot;&quot;; <br>        <br>        // Log in to the room<br>        await zg.loginRoom(roomID, token, {<br>            userID: userID,<br>            userName: userID<br>        }, { userUpdate: true });<br>        <br>        // Create and publish local stream<br>        localStream = await zg.createStream({<br>            camera: {<br>                audio: true,<br>                video: true<br>            }<br>        });<br>        <br>        // Display local stream<br>        const localView = zg.createLocalStreamView(localStream);<br>        localView.play(&quot;local-video&quot;, { enableAutoplayDialog: true });<br>        <br>        // Start publishing<br>        await zg.startPublishingStream(userID, localStream);<br>        <br>        // Listen for remote streams<br>        zg.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>            if (updateType === &#39;ADD&#39;) {<br>                // A new stream is available<br>                isConnectedToStranger = true;<br>                updateConnectionStatus(&#39;Connected to Stranger&#39;);<br>                <br>                const remoteStreamID = streamList[0].streamID;<br>                remoteStream = await zg.startPlayingStream(remoteStreamID);<br>                <br>                const remoteView = zg.createRemoteStreamView(remoteStream);<br>                remoteView.play(&quot;remote-video&quot;, { enableAutoplayDialog: true });<br>            } else if (updateType === &#39;DELETE&#39;) {<br>                // The remote stream has been removed<br>                isConnectedToStranger = false;<br>                updateConnectionStatus(&#39;Stranger disconnected&#39;);<br>                showMessage(&quot;System&quot;, &quot;Stranger has disconnected. Click &#39;Next&#39; to find a new chat partner.&quot;);<br>            }<br>        });<br>        <br>        // Listen for room user updates<br>        zg.on(&#39;roomUserUpdate&#39;, (roomID, updateType, userList) =&gt; {<br>            if (updateType === &#39;ADD&#39;) {<br>                console.log(`Users joined: ${userList.map(user =&gt; user.userID).join(&#39;, &#39;)}`);<br>            } else if (updateType === &#39;DELETE&#39;) {<br>                console.log(`Users left: ${userList.map(user =&gt; user.userID).join(&#39;, &#39;)}`);<br>            }<br>        });<br>        <br>        // Show the chat screen<br>        showScreen(chatScreen);<br>    } catch (error) {<br>        console.error(&quot;Error starting chat:&quot;, error);<br>        updateConnectionStatus(&#39;Connection Failed&#39;);<br>        alert(&quot;Failed to start chat. Please try again.&quot;);<br>    }<br>}<br><br>// Function to end the current chat<br>async function endCurrentChat() {<br>    try {<br>        updateConnectionStatus(&#39;Disconnecting...&#39;);<br>        <br>        if (localStream) {<br>            // Stop publishing<br>            await zg.stopPublishingStream(userID);<br>            // Destroy the stream<br>            zg.destroyStream(localStream);<br>            localStream = null;<br>        }<br>        <br>        if (remoteStream) {<br>            // Stop playing remote stream<br>            await zg.stopPlayingStream(remoteStream.streamID);<br>            remoteStream = null;<br>        }<br>        <br>        // Logout from the room<br>        if (roomID) {<br>            await zg.logoutRoom(roomID);<br>            roomID = null;<br>        }<br>        <br>        // Reset connection state<br>        isConnectedToStranger = false;<br>        <br>        // Clear chat messages<br>        chatMessages.innerHTML = &#39;&#39;;<br>        <br>        // Reset audio/video state<br>        isAudioMuted = false;<br>        isVideoOff = false;<br>        toggleAudioBtn.textContent = &quot;Mute&quot;;<br>        toggleVideoBtn.textContent = &quot;Turn Off Video&quot;;<br>        <br>        updateConnectionStatus(&#39;Disconnected&#39;);<br>        <br>        // Show the ending screen<br>        showScreen(endingScreen);<br>    } catch (error) {<br>        console.error(&quot;Error ending chat:&quot;, error);<br>    }<br>}<br><br>// Function to find a new chat partner<br>async function findNewChatPartner() {<br>    // End the current chat<br>    await endCurrentChat();<br>    // Start a new chat<br>    await startNewChat();<br>}<br><br>// Function to toggle audio<br>async function toggleAudio() {<br>    if (localStream) {<br>        isAudioMuted = !isAudioMuted;<br>        await zg.mutePublishStreamAudio(localStream, isAudioMuted);<br>        toggleAudioBtn.textContent = isAudioMuted ? &quot;Unmute&quot; : &quot;Mute&quot;;<br>    }<br>}<br><br>// Function to toggle video<br>async function toggleVideo() {<br>    if (localStream) {<br>        isVideoOff = !isVideoOff;<br>        await zg.mutePublishStreamVideo(localStream, isVideoOff);<br>        toggleVideoBtn.textContent = isVideoOff ? &quot;Turn On Video&quot; : &quot;Turn Off Video&quot;;<br>    }<br>}<br><br>// Function to send a chat message<br>function sendChatMessage() {<br>    const messageText = chatInput.value.trim();<br>    if (messageText &amp;&amp; isConnectedToStranger) {<br>        // Display the message in the chat<br>        showMessage(&quot;You&quot;, messageText, true);<br>        <br>        // In a real app, you would send this message to the other user<br>        // For simplicity, we&#39;re just displaying it locally<br>        // To implement real messaging, you would use ZEGOCLOUD&#39;s messaging features<br>        <br>        // Clear the input<br>        chatInput.value = &#39;&#39;;<br>    }<br>}<br><br>// Function to display a message in the chat<br>function showMessage(sender, text, isUser = false) {<br>    const messageElement = document.createElement(&#39;div&#39;);<br>    messageElement.classList.add(&#39;message&#39;);<br>    <br>    if (isUser) {<br>        messageElement.classList.add(&#39;user-message&#39;);<br>    } else if (sender !== &quot;System&quot;) {<br>        messageElement.classList.add(&#39;stranger-message&#39;);<br>    } else {<br>        messageElement.style.textAlign = &#39;center&#39;;<br>        messageElement.style.fontStyle = &#39;italic&#39;;<br>        messageElement.style.color = &#39;#888&#39;;<br>    }<br>    <br>    messageElement.textContent = sender === &quot;System&quot; ? text : ${sender}: ${text};<br>    chatMessages.appendChild(messageElement);<br>    <br>    // Scroll to the bottom<br>    chatMessages.scrollTop = chatMessages.scrollHeight;<br>}<br><br>// Event listeners<br>startChatBtn.addEventListener(&#39;click&#39;, startNewChat);<br>nextChatBtn.addEventListener(&#39;click&#39;, findNewChatPartner);<br>toggleAudioBtn.addEventListener(&#39;click&#39;, toggleAudio);<br>toggleVideoBtn.addEventListener(&#39;click&#39;, toggleVideo);<br>endChatBtn.addEventListener(&#39;click&#39;, endCurrentChat);<br>newChatBtn.addEventListener(&#39;click&#39;, startNewChat);<br>sendMessageBtn.addEventListener(&#39;click&#39;, sendChatMessage);<br><br>// Allow sending messages with Enter key<br>chatInput.addEventListener(&#39;keypress&#39;, (e) =&gt; {<br>    if (e.key === &#39;Enter&#39;) {<br>        sendChatMessage();<br>    }<br>});<br><br>// Initialize the SDK when the page loads<br>window.onload = async () =&gt; {<br>    try {<br>        // Check browser compatibility<br>        const result = await zg.checkSystemRequirements();<br>        console.log(&quot;Browser compatibility check result:&quot;, result);<br>        <br>        if (!result.webRTC) {<br>            alert(&quot;Your browser doesn&#39;t support WebRTC, which is required for video chat.&quot;);<br>            return;<br>        }<br>        <br>        // Initialize the ZEGOCLOUD SDK<br>        zg.setLogConfig({<br>            logLevel: &#39;error&#39;<br>        });<br>        <br>        // Set event handlers for SDK events<br>        zg.on(&#39;roomStateUpdate&#39;, (roomID, state, errorCode, extendedData) =&gt; {<br>            if (state === &#39;DISCONNECTED&#39;) {<br>                console.log(&#39;Disconnected from room&#39;);<br>                updateConnectionStatus(&#39;Disconnected&#39;);<br>            } else if (state === &#39;CONNECTING&#39;) {<br>                console.log(&#39;Connecting to room&#39;);<br>                updateConnectionStatus(&#39;Connecting...&#39;);<br>            } else if (state === &#39;CONNECTED&#39;) {<br>                console.log(&#39;Connected to room&#39;);<br>                updateConnectionStatus(&#39;Connected&#39;);<br>            }<br>        });<br>        <br>        // Set event handler for player state updates<br>        zg.on(&#39;playerStateUpdate&#39;, (result) =&gt; {<br>            console.log(&#39;Player state update:&#39;, result);<br>        });<br>        <br>        // Set event handler for publisher state updates<br>        zg.on(&#39;publisherStateUpdate&#39;, (result) =&gt; {<br>            console.log(&#39;Publisher state update:&#39;, result);<br>        });<br>        <br>        console.log(&#39;ZEGOCLOUD SDK initialized successfully&#39;);<br>    } catch (error) {<br>        console.error(&#39;Failed to initialize ZEGOCLOUD SDK:&#39;, error);<br>        alert(&#39;Failed to initialize video chat capabilities. Please try again or use a different browser.&#39;);<br>    }<br>};</pre><h3>5. Testing and Deployment</h3><p><strong>Local Testing:</strong></p><ul><li>Run your application on a local development server.</li><li>Test with multiple browser windows to simulate different users.</li><li>Verify that video, audio, and text messaging work correctly.</li></ul><p><strong>Deploy to Production:</strong></p><ul><li>Upload your files to a web hosting service.</li><li>Ensure your server for token generation is also deployed.</li><li>Configure HTTPS (required for camera and microphone access).</li><li>Update your AppID and server URL for production.</li></ul><h3>Conclusion</h3><p>Building a random video chat platform like Uhmegle takes work, but is very possible with ZEGOCLOUD’s tools. By following this guide, you can create a platform that connects people from around the world through video conversations. Remember to focus on user safety, smooth video quality, and easy navigation.</p><p>Your platform should make it simple for users to find new chat partners with just one click. While there are challenges in development, the end result is worth the effort. With some testing and refinement, your random video chat platform can provide a fun and valuable service to users worldwide.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ae9cce0e918" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Video Call App Like Vidizzy]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-a-video-call-app-like-vidizzy-3140645e7b7c?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/3140645e7b7c</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 11:58:11 GMT</pubDate>
            <atom:updated>2024-12-04T11:58:11.551Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*9QQwW111CvKNhAAEtsofvA.png" /></figure><p>Are you interested in building a video call app like Vidizzy? With the rise of remote work and online learning, video calling has become a key part of our daily lives. Whether you want to connect people for business, social interactions, or education, creating an easy-to-use and reliable app is a smart move.</p><p>In this guide, we will show you how to build a video call app that’s simple to navigate, secure, and full of useful features. We’ll walk you through the essential steps, including choosing the right technology, designing a great user interface, and making sure your app runs smoothly. By the end, you’ll be ready to create a top-quality video calling app that users will love. Let’s get started!</p><h3>What is Vidizzy?</h3><p>Vidizzy is a <a href="https://www.zegocloud.com/product/video-call">video call</a> app that connects users for random video chats. It allows people to meet and talk with strangers from all around the world without registration. Vidizzy provides an easy and anonymous way for users to have live, one-on-one conversations via video and text. The app is designed for those who want to meet new people, make friends, or have casual chats.</p><p>With Vidizzy, users are matched with others randomly, making it exciting and unpredictable. You can start a conversation instantly without needing to register or log in, making it simple and quick to use. Vidizzy also offers features like live video streaming and text chatting, allowing users to communicate in different ways during their interactions.</p><p>Unlike other video chat apps, Vidizzy focuses on creating a fun and spontaneous environment for users. The app is free to use and can be accessed on various devices, such as smartphones, tablets, and computers. Vidizzy is perfect for anyone looking to connect with new people in a safe and entertaining way. Whether you’re bored and want to chat, or looking to meet interesting people, Vidizzy makes it easy to start a conversation.</p><h3>How to Develop a Video Chat App like Vidizzy</h3><p>Vidizzy has grown in popularity over the years, offering users the ability to randomly connect with others from different parts of the world. In this section, we’ll walk you through how to develop a similar video chat app using <a href="https://www.zegocloud.com/">ZEGOCLOUD</a>.</p><p>We’ll be using ZEGOCLOUD’s <a href="https://www.zegocloud.com/docs/video-call/overview?platform=web&amp;language=javascript">Express Video SDK</a> and <a href="https://www.zegocloud.com/docs/zim-web/introduction/overview">ZIM SDK</a>, for adding real-time video and messaging features to your app.</p><h3>Key Features of the ZEGOCLOUD API/SDK</h3><p>Before we dive into coding, here are some important features of ZEGOCLOUD’s SDK that will be critical for your app:</p><ul><li><strong>High-quality video &amp; audio:</strong> ZEGOCLOUD provides clear and smooth video and audio communication to ensure your video chats are seamless and enjoyable.</li><li><strong>Screen sharing:</strong> This feature allows users to share their screen, which is useful for collaborative activities, presentations, or teaching.</li><li><strong>Secure communication:</strong> All video chats are encrypted, keeping user privacy intact and complying with privacy regulations.</li><li><strong>Customizable UI:</strong> You can design the video call interface to match your app’s branding and offer a unique experience.</li></ul><h3>Prerequisites</h3><p>To follow this guide, ensure you have the following:</p><ul><li><strong>ZEGOCLOUD developer account:</strong> You’ll need to <a href="https://console.zegocloud.com/account/signup">sign up</a> at ZEGOCLOUD to get access to the credentials needed to use the SDKs.</li><li><strong>App ID and token:</strong> These are provided by ZEGOCLOUD when you create a new app within their console.</li><li><strong>Basic web development knowledge:</strong> Some familiarity with HTML, CSS, and JavaScript will help you understand the steps better.</li><li>A computer with internet access to run your code and test the application.</li></ul><h3>1. Set Up the SDK</h3><p>The first step is installing the ZEGOCLOUD SDK. This allows you to access ZEGOCLOUD’s real-time video capabilities.</p><p>Install the ZEGOCLOUD SDK using npm:</p><pre>npm install zego-express-engine-webrtc</pre><p>After installation, you can import the SDK into your JavaScript file:</p><pre>const { ZegoExpressEngine } = require(‘zego-express-engine-webrtc’);</pre><p>This sets up your app to interact with ZEGOCLOUD’s video call features.</p><h3>2. Design the User Interface (UI)</h3><p>Creating a simple but engaging UI is essential for a great user experience. You’ll need to set up the following elements:</p><ul><li><strong>Local video feed:</strong> This is where the user’s video feed will be displayed.</li><li><strong>Remote video feed:</strong> This will display the video feed of the person they are connected with.</li><li><strong>Action buttons:</strong> Buttons to start and end the video call.</li></ul><p>Here’s an example of the HTML layout:</p><pre>&lt;div id=”local-video”&gt;&lt;/div&gt;<br>&lt;div id=”remote-video”&gt;&lt;/div&gt;<br>&lt;button id=”startCall”&gt;Start Random Chat&lt;/button&gt;<br>&lt;button id=”endCall” disabled&gt;End Chat&lt;/button&gt;</pre><p>You can adjust the styles later to fit your app’s design.</p><h3>3. Initialize ZEGOCLOUD SDK</h3><p>To begin using the ZEGOCLOUD services, you need to initialize the SDK with your app’s unique credentials. Define your App_ID and Server_URL.</p><pre>const appID = YOUR_APP_ID; // Replace with your actual App ID<br>const server = ‘YOUR_SERVER_URL’; // Replace with your server address<br>const zg = new ZegoExpressEngine(appID, server);</pre><p>This will allow your app to interact with ZEGOCLOUD’s platform and manage video calls.</p><h3>4. Authenticate Users and Create Random Rooms</h3><p>In a random video chat app, users should be automatically assigned to random rooms. This gives each user a unique experience and avoids the need for manual room management.</p><p><strong>a. Generate a Random Room ID</strong></p><p>You can generate a random string that serves as the roomID. This will be used to connect the user to the chat:</p><pre>function generateRandomRoomID() {<br> return Math.random().toString(36).substring(2, 8).toUpperCase(); // Generates a random 6-character room ID<br>}</pre><p><strong>b. Generate a Unique User ID</strong></p><p>To keep track of different users, we generate a unique ID for each one:</p><pre>function generateUserID() {<br> const timestamp = new Date().getTime(); // Using timestamp ensures uniqueness<br> const randomPart = Math.random().toString(36).substring(2, 6).toUpperCase(); // Add randomness for more variation<br> return `user_${randomPart}_${timestamp}`;<br>}</pre><p>This ensures each user has a unique identity in the system.</p><h3>5. Log In to the Room</h3><p>Once the user has been authenticated and assigned a random room, you need to log them into the room and allow them to join the conversation. Here’s how you can do that:</p><pre>const roomID = generateRandomRoomID(); // Generate a random room ID<br>const userID = generateUserID(); // Create a unique user ID<br>const token = &#39;YOUR_TEMPORARY_TOKEN&#39;; // Token obtained from ZEGOCLOUD<br><br>zg.loginRoom(roomID, token, { userID, userName: userID })<br>    .then(() =&gt; {<br>        console.log(`Logged into room: ${roomID} as user: ${userID}`);<br>    })<br>    .catch(error =&gt; {<br>        console.error(&#39;Error logging into room:&#39;, error);<br>    });</pre><p>The loginRoom function connects the user to the random room and allows them to start interacting with others.</p><h3>6. Capture and Display Local Video</h3><p>Next, we need to capture the local user’s video feed and display it on the screen. This captures the local stream and displays it in the “local-video” div.</p><pre>const localStream = await zg.createStream(); // Access camera and mic<br>// Display the local video feed in the HTML element<br>zg.createLocalStreamView(localStream).play(&#39;local-video&#39;);<br>// Start publishing the stream to ZEGOCLOUD for others to see<br>zg.startPublishingStream(&#39;localStreamID&#39;, localStream);</pre><h3>7. Handle Remote Video Streams</h3><p>Now that your app is connected, you need to listen for incoming video streams from other users in the same room. When another user joins the room and starts their video feed, your app needs to display their stream.</p><pre>zg.on(‘roomStreamUpdate’, async (roomID, updateType, streamList) =&gt; {<br> if (updateType === ‘ADD’) {<br> const remoteStream = await zg.startPlayingStream(streamList[0].streamID); // Access remote stream<br> zg.createRemoteStreamView(remoteStream).play(‘remote-video’); // Display remote video in the “remote-video” div<br> }<br>});</pre><h3>8. End the Call</h3><p>To end the video chat, you need to stop publishing and playing streams. This will stop the video feed and disconnect the user from the room.</p><pre>zg.stopPublishingStream(‘localStreamID’); // Stop publishing the local stream<br>zg.stopPlayingStream(‘remoteStreamID’); // Stop displaying the remote stream</pre><p>Make sure to clean up the streams to avoid unnecessary resource usage.</p><h3>9. Logout from the Room</h3><p>When a user decides to exit the video chat, it’s important to log them out from the room and clean up the resources.</p><pre>zg.logoutRoom(roomID); // Log the user out from the room</pre><p>This will end the session and disconnect the user from the ZEGOCLOUD platform.</p><h3>10. Full Implementation</h3><p>Here’s how the final implementation should look in HTML and JavaScript:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Random Video Chat&lt;/title&gt;<br>    &lt;style&gt;<br>        body {<br>            font-family: Arial, sans-serif;<br>            margin: 0;<br>            padding: 0;<br>            display: flex;<br>            flex-direction: column;<br>            align-items: center;<br>            justify-content: center;<br>            height: 100vh;<br>            background-color: #f4f4f4;<br>        }<br>        h1 {<br>            margin-bottom: 20px;<br>        }<br>        #video-container {<br>            display: flex;<br>            gap: 20px;<br>            justify-content: center;<br>            margin-bottom: 20px;<br>        }<br>        #local-video, #remote-video {<br>            width: 300px;<br>            height: 225px;<br>            border: 1px solid #ccc;<br>            background-color: #000;<br>            display: flex;<br>            align-items: center;<br>            justify-content: center;<br>            color: white;<br>            font-size: 14px;<br>        }<br>        #controls {<br>            display: flex;<br>            gap: 10px;<br>        }<br>        button {<br>            padding: 10px 20px;<br>            font-size: 16px;<br>            border: none;<br>            cursor: pointer;<br>            border-radius: 5px;<br>        }<br>        button:disabled {<br>            background-color: #ccc;<br>            cursor: not-allowed;<br>        }<br>    &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h1&gt;Vidizzy Video Chat&lt;/h1&gt;<br>    &lt;div id=&quot;video-container&quot;&gt;<br>        &lt;div id=&quot;local-video&quot;&gt;Local Video&lt;/div&gt;<br>        &lt;div id=&quot;remote-video&quot;&gt;Remote Video&lt;/div&gt;<br>    &lt;/div&gt;<br>    &lt;div id=&quot;controls&quot;&gt;<br>        &lt;button id=&quot;startCall&quot;&gt;Start Random Chat&lt;/button&gt;<br>        &lt;button id=&quot;endCall&quot; disabled&gt;End Chat&lt;/button&gt;<br>    &lt;/div&gt;<br><br>    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/zego-express-engine-webrtc&quot;&gt;&lt;/script&gt;<br>    &lt;script&gt;<br>        const appID = &#39;YOUR_APP_ID&#39;; // Replace with your App ID<br>        const server = &#39;YOUR_SERVER_URL&#39;; // Replace with your server URL<br>        const zg = new ZegoExpressEngine(appID, server);<br><br>        const startCallBtn = document.getElementById(&#39;startCall&#39;);<br>        const endCallBtn = document.getElementById(&#39;endCall&#39;);<br><br>        startCallBtn.addEventListener(&#39;click&#39;, async () =&gt; {<br>            const roomID = generateRandomRoomID();<br>            const userID = generateUserID();<br>            const token = &#39;YOUR_TEMPORARY_TOKEN&#39;; // Token<br><br>            try {<br>                await zg.loginRoom(roomID, token, { userID, userName: userID });<br><br>                const localStream = await zg.createStream();<br>                zg.createLocalStreamView(localStream).play(&#39;local-video&#39;);<br>                zg.startPublishingStream(&#39;localStreamID&#39;, localStream);<br><br>                startCallBtn.disabled = true;<br>                endCallBtn.disabled = false;<br><br>                zg.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>                    if (updateType === &#39;ADD&#39;) {<br>                        const remoteStream = await zg.startPlayingStream(streamList[0].streamID);<br>                        zg.createRemoteStreamView(remoteStream).play(&#39;remote-video&#39;);<br>                    }<br>                });<br><br>            } catch (error) {<br>                console.error(&#39;Error during call start:&#39;, error);<br>            }<br>        });<br><br>        endCallBtn.addEventListener(&#39;click&#39;, async () =&gt; {<br>            try {<br>                await zg.stopPublishingStream(&#39;localStreamID&#39;);<br>                await zg.stopPlayingStream(&#39;remoteStreamID&#39;);<br>                startCallBtn.disabled = false;<br>                endCallBtn.disabled = true;<br>            } catch (error) {<br>                console.error(&#39;Error during call end:&#39;, error);<br>            }<br>        });<br><br>        function generateRandomRoomID() {<br>            return Math.random().toString(36).substring(2, 8).toUpperCase();<br>        }<br><br>        function generateUserID() {<br>            const timestamp = new Date().getTime();<br>            const randomPart = Math.random().toString(36).substring(2, 6).toUpperCase();<br>            return user_${randomPart}_${timestamp};<br>        }<br>    &lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Conclusion</h3><p>Building a video call app like Vidizzy is a fun and valuable project, especially with the growing need for online communication. This guide has shown you how to use ZEGOCLOUD’s SDK to add video and messaging features, and how to create an easy-to-use interface.</p><p>You learned how to set up the SDK, authenticate users, and manage video streams. With these steps, you can build a smooth, high-quality video call app. Whether your app is for social, business, or educational purposes, you now have the knowledge to create an app that people will enjoy using and rely on for their communication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3140645e7b7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Dating App Like OkCupid]]></title>
            <link>https://medium.com/@chigozzdev/how-to-build-a-dating-app-like-okcupid-ad06d01fd63c?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad06d01fd63c</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[dating]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 11:32:56 GMT</pubDate>
            <atom:updated>2024-12-04T11:32:56.751Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VczfIt82EBBcraS7f_GeyA.jpeg" /></figure><p>Creating a dating app like OkCupid is a great way to help people meet and build relationships. To make your app stand out, it’s important to include features that make communication easy and fun. This guide will show you how to add video calls and chat to your app.</p><p>These features are simple to use and help users connect in a safe and friendly way. We’ll explain the steps clearly, share the best tools to use, and give you tips to make everything work smoothly. By the end of this guide, you’ll know how to create communication tools that make your app better and more enjoyable for everyone.</p><h3>How to Build a Dating App Like OkCupid</h3><p>Dating apps like OkCupid are popular because they help people connect based on their interests and preferences. They make meeting new people easy by offering features like user profiles, matchmaking, and real-time chat. If you want to create a similar app, you’ll need to include these features and make sure the app works smoothly.</p><p>A good way to build such an app is by using <a href="https://www.zegocloud.com/">ZEGOCLOUD</a> SDKs. These tools help you add features like real-time messaging, group chats, and even video calls to your app quickly and easily. In this section, we’ll explain how to build your dating app step by step and show how ZEGOCLOUD can help you create a great user experience.</p><h3>Why Use ZEGOCLOUD SDKs?</h3><p>When you’re building a dating app, strong communication tools are a must. ZEGOCLOUD SDKs make it simple to add these features to your app. Here’s what they offer:</p><ul><li><strong>Real-time messaging:</strong> Users can chat instantly without delays, making conversations feel natural.</li><li><strong>High-quality video and audio:</strong> Video calls and voice chats are smooth and clear, letting users connect on a deeper level.</li><li><strong>Group chat features:</strong> Users can join or create groups, making it easy to socialize with others who share similar interests.</li><li><strong>Privacy and security:</strong> Messages and calls are encrypted, so users feel safe using your app.</li><li><strong>Customizable design:</strong> You can make the chat and video tools match your app’s design for a seamless look and feel.</li></ul><p>These features not only save time during development but also help you create a professional app that users will love. Let’s dive into how to get started!</p><h3>Prerequisites</h3><p>Before you begin, make sure you have:</p><ul><li>A ZEGOCLOUD developer account (to access real-time chat and group features) — <a href="https://console.zegocloud.com/account/signup">Sign up</a></li><li>Node.js installed for backend and package management.</li><li>A basic understanding of JavaScript or TypeScript.</li><li>A code editor like Visual Studio Code.</li><li>Familiarity with front-end development.</li></ul><h3>1. Setting Up the Project</h3><p>The first step in building the app is to set up your project directory. By organizing files for HTML, CSS, and JavaScript separately, you ensure that the app’s structure remains clean and manageable.</p><p>Start by creating a project folder named <strong>dating-app</strong> and initializing it using:</p><pre>npm init -y</pre><p>This command creates a <strong>package.json</strong> file, which manages your dependencies later. Then create a structure that look like this:</p><pre>dating-app/<br>├── index.html # Defines the app’s interface<br>├── index.js # Handles functionality and features<br>├── styles.css # Styles the app’s UI<br>├── package.json # Tracks dependencies</pre><p>This clear organization helps keep the project scalable and makes it easier to debug or add features later.</p><h3>2. Designing the User Interface</h3><p>The user interface is the heart of any dating app, as it determines how users interact with the application. In our app, the interface is divided into four core sections:</p><ul><li><strong>Profile section:</strong> This section allows users to see their photo, name, and bio. It is essential for building a sense of identity within the app.</li><li><strong>Match section:</strong> Users swipe through potential matches by liking and disliking in this section. It provides a dynamic way for users to explore profiles and connect.</li><li><strong>Chat section:</strong> This feature enables real-time messaging between matched users, ensuring smooth and continuous communication.</li><li><strong>Group section:</strong> This allows users to create, join, or manage groups, adding a social element to the app.</li></ul><p>Here is the <strong>index.html</strong> file defining the structure:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;CupidConnect&lt;/title&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;div id=&quot;app&quot;&gt;<br>        &lt;h1&gt;Welcome to CupidConnect&lt;/h1&gt;<br><br>        &lt;!-- Profile Section --&gt;<br>        &lt;div id=&quot;profile-section&quot;&gt;<br>            &lt;h2&gt;Your Profile&lt;/h2&gt;<br>            &lt;img src=&quot;default-profile.jpg&quot; alt=&quot;Profile Picture&quot; id=&quot;profile-pic&quot;&gt;<br>            &lt;p id=&quot;user-name&quot;&gt;User Name&lt;/p&gt;<br>            &lt;p id=&quot;user-bio&quot;&gt;This is your bio. Add some personality!&lt;/p&gt;<br>        &lt;/div&gt;<br><br>        &lt;!-- Match Section --&gt;<br>        &lt;div id=&quot;match-section&quot;&gt;<br>            &lt;h2&gt;Find Matches&lt;/h2&gt;<br>            &lt;div id=&quot;potential-matches&quot;&gt;&lt;/div&gt;<br>            &lt;button onclick=&quot;likeProfile()&quot;&gt;Like&lt;/button&gt;<br>            &lt;button onclick=&quot;dislikeProfile()&quot;&gt;Dislike&lt;/button&gt;<br>        &lt;/div&gt;<br><br>        &lt;!-- Chat Section --&gt;<br>        &lt;div id=&quot;chat-section&quot;&gt;<br>            &lt;h2&gt;Your Chats&lt;/h2&gt;<br>            &lt;div id=&quot;chat-list&quot;&gt;&lt;/div&gt;<br>            &lt;input type=&quot;text&quot; id=&quot;chat-input&quot; placeholder=&quot;Type a message...&quot;&gt;<br>            &lt;button onclick=&quot;sendMessage()&quot;&gt;Send&lt;/button&gt;<br>        &lt;/div&gt;<br><br>        &lt;!-- Group Section --&gt;<br>        &lt;div id=&quot;group-section&quot;&gt;<br>            &lt;h2&gt;Groups&lt;/h2&gt;<br>            &lt;div id=&quot;group-list&quot;&gt;&lt;/div&gt;<br>            &lt;h3&gt;Create a Group&lt;/h3&gt;<br>            &lt;input type=&quot;text&quot; id=&quot;group-name-input&quot; placeholder=&quot;Enter group name&quot;&gt;<br>            &lt;button onclick=&quot;createGroup()&quot;&gt;Create Group&lt;/button&gt;<br><br>            &lt;h3&gt;Join a Group&lt;/h3&gt;<br>            &lt;input type=&quot;text&quot; id=&quot;group-id-input&quot; placeholder=&quot;Enter group ID&quot;&gt;<br>            &lt;button onclick=&quot;joinGroup()&quot;&gt;Join Group&lt;/button&gt;<br><br>            &lt;h3&gt;Invite Users&lt;/h3&gt;<br>            &lt;input type=&quot;text&quot; id=&quot;invite-user-id&quot; placeholder=&quot;Enter user ID&quot;&gt;<br>            &lt;input type=&quot;text&quot; id=&quot;invite-group-id&quot; placeholder=&quot;Enter group ID&quot;&gt;<br>            &lt;button onclick=&quot;inviteUsers()&quot;&gt;Invite&lt;/button&gt;<br>        &lt;/div&gt;<br>    &lt;/div&gt;<br><br>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This layout ensures users can navigate profiles, connect with others, and communicate effortlessly.</p><h3>3. Adding Styles to Enhance the UI</h3><p>The design should look appealing and user-friendly. The <strong>styles.css</strong> file provides a clean and professional look. Use the following styles:</p><pre>body {<br>    font-family: Arial, sans-serif;<br>    background-color: #f8f9fa;<br>    margin: 0;<br>    padding: 0;<br>}<br>#app {<br>    max-width: 600px;<br>    margin: auto;<br>    padding: 20px;<br>    background: #fff;<br>    border-radius: 10px;<br>    box-shadow: 0 4px 8px rgba(0,0,0,0.2);<br>}<br>#profile-pic {<br>    border-radius: 50%;<br>    width: 100px;<br>    height: 100px;<br>}<br>button {<br>    padding: 10px 20px;<br>    margin: 5px;<br>    border: none;<br>    border-radius: 5px;<br>    background-color: #007BFF;<br>    color: white;<br>    cursor: pointer;<br>}<br>button:hover {<br>    background-color: #0056b3;<br>}</pre><p>These styles create a cohesive look, making the app visually engaging.</p><h3>4. Installing Necessary Dependencies</h3><p>To add functionality like real-time chat and group features, you need <a href="https://www.zegocloud.com/docs/video-call/overview?platform=web&amp;language=javascript">ZEGOCLOUD Express Video</a> and <a href="https://www.zegocloud.com/docs/zim-web/introduction/overview">ZIM SDK</a>. These libraries simplify the implementation of messaging and video calling features. Install the dependencies with:</p><pre>npm install zego-zim-web zego-express-engine-webrtc</pre><p>This adds the necessary tools to your project.</p><h3>5. Initializing SDKs</h3><p>Next, set up ZegoExpressEngine and ZIM SDKs in your <strong>index.js</strong>. These will handle real-time communication and messaging. Here’s how:</p><pre>import { ZegoExpressEngine } from ‘zego-express-engine-webrtc’;<br>import { ZIM } from ‘zego-zim-web’;<br>const appID = 123456789; // Replace with your AppID<br>const serverURL = &#39;wss://your-server-url&#39;; // Replace with your server URL<br>const zegoEngine = new ZegoExpressEngine(appID, serverURL);<br>const zim = ZIM.create({ appID });</pre><h3>6. Implementing Matchmaking Logic</h3><p>The matchmaking feature connects users with potential matches. This is achieved by cycling through a list of profiles.</p><pre>const profiles = [<br>    { name: &#39;Alice&#39;, bio: &#39;Loves hiking and dogs&#39; },<br>    { name: &#39;Bob&#39;, bio: &#39;Tech enthusiast and gamer&#39; },<br>];<br><br>let currentProfileIndex = 0;<br><br>function displayProfile() {<br>    const profile = profiles[currentProfileIndex];<br>    document.getElementById(&#39;potential-matches&#39;).innerHTML = <br>        &lt;strong&gt;${profile.name}&lt;/strong&gt;&lt;br&gt;${profile.bio}<br>    ;<br>}<br><br>function likeProfile() {<br>    currentProfileIndex = (currentProfileIndex + 1) % profiles.length;<br>    displayProfile();<br>}<br><br>function dislikeProfile() {<br>    currentProfileIndex = (currentProfileIndex + 1) % profiles.length;<br>    displayProfile();<br>}<br><br>displayProfile();</pre><p>This setup creates an interactive way for users to browse potential matches.</p><h3>7. Adding Chat Functionality</h3><p>Chat functionality allows users to communicate in real time. The following functions handle sending and receiving messages:</p><pre>async function sendMessage() {<br>    const content = document.getElementById(&#39;chat-input&#39;).value;<br>    if (content.trim()) {<br>        await zim.sendPeerMessage({<br>            toUserID: &#39;match-chat&#39;,<br>            message: { type: ZIM.MessageType.TEXT, message: content }<br>        });<br>        document.getElementById(&#39;chat-list&#39;).innerHTML += &lt;div&gt;You: ${content}&lt;/div&gt;;<br>    }<br>}<br><br>zim.on(&#39;receivePeerMessage&#39;, ({ messageList }) =&gt; {<br>    messageList.forEach(msg =&gt; {<br>        document.getElementById(&#39;chat-list&#39;).innerHTML += &lt;div&gt;Match: ${msg.message}&lt;/div&gt;;<br>    });<br>});</pre><h3>8. Adding Group Features</h3><p>Groups enhance social interaction. Users can create, join, or invite others to groups. Here’s how:</p><pre>async function createGroup() {<br>    const groupName = document.getElementById(&#39;group-name-input&#39;).value;<br>    const { groupInfo } = await zim.createGroup({ groupName }, {});<br>    console.log(&#39;Group created:&#39;, groupInfo);<br>}<br><br>async function joinGroup() {<br>    const groupID = document.getElementById(&#39;group-id-input&#39;).value;<br>    const { groupInfo } = await zim.joinGroup(groupID);<br>    console.log(&#39;Joined group:&#39;, groupInfo);<br>}<br><br>async function inviteUsers() {<br>    const userID = document.getElementById(&#39;invite-user-id&#39;).value;<br>    const groupID = document.getElementById(&#39;invite-group-id&#39;).value;<br>    await zim.inviteUsersIntoGroup([userID], groupID);<br>    console.log(&#39;Invitation sent&#39;);<br>}</pre><h3>9. Testing and Deployment</h3><p>Run the app locally and test all functionalities. Once satisfied, deploy it using platforms like Vercel or Netlify. With these steps completed, you’ve successfully built a basic functional dating app! 🚀</p><h3>Conclusion</h3><p>Creating a dating app like OkCupid is an exciting opportunity to bring people together. With features like user profiles, matchmaking, real-time chat, and group interactions, you can create a platform that helps users connect meaningfully. This guide has outlined every step, from setting up your project to adding powerful communication features using ZEGOCLOUD SDKs. These tools simplify the development process and ensure your app is secure, reliable, and easy to use.</p><p>By following this guide, you can create a user-friendly dating app with all the basic features users expect. Focus on making your app intuitive, engaging, and safe, and you’ll be well on your way to launching a successful platform that stands out in the competitive dating app market.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad06d01fd63c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Create a Sports Streaming App Like Sportsurge]]></title>
            <link>https://medium.com/@chigozzdev/how-to-create-a-sports-streaming-app-like-sportsurge-51a2fcdca4b3?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/51a2fcdca4b3</guid>
            <category><![CDATA[beginner-project]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Sat, 30 Nov 2024 09:59:52 GMT</pubDate>
            <atom:updated>2024-11-30T09:59:52.366Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VmjZ82h8yAoCGU2kozo2zQ.jpeg" /></figure><p>Creating a sports streaming app like Sportsurge.net is a smart move. With more people turning to online platforms to watch live sports, this market is growing fast. Such an app lets users stream their favorite games anytime, anywhere. To build a successful app, you need to focus on features like high-quality streaming, an easy-to-use interface, and fast loading times. Security and smooth navigation are also key factors.</p><p>In this guide, we’ll cover everything you need to know about online sports streaming. Whether you’re a developer or entrepreneur, this article will help you start on the path to building a reliable and user-friendly sports streaming platform.</p><h3>What is Sportsurge App?</h3><p>The Sportsurge app is a popular online platform designed for sports fans who want access to live streams of their favorite games. It provides links to watch major sporting events, covering a wide range of sports like football, basketball, baseball, soccer, and more. Sportsurge stands out because it focuses on delivering reliable, high-quality streaming options for free.</p><p>One of the key features of Sportsurge is its user-friendly interface. The app is designed to make navigation simple, so users can quickly find the games or events they want to watch. It does not host the content directly but acts as a directory, connecting users to trusted sources for live streams. This makes it a preferred choice for those seeking convenience and variety.</p><p>Another advantage of the Sportsurge app is its commitment to providing uninterrupted streaming. It often offers multiple links for each event, ensuring users have alternatives if one link doesn’t work. This reliability is one of the reasons it has gained a loyal following among sports enthusiasts.</p><p>Whether you are a casual viewer or a die-hard sports fan, the Sportsurge app can be an excellent tool for staying connected to live sports action. With its easy access to streams and broad sports coverage, it has become a go-to solution for many users worldwide.</p><h3>How to Develop a Sports Streaming App Like Sportsurge</h3><p>Sports streaming platforms like Sportsurge have changed how fans engage with live games. These apps provide easy access to live sports events with high-quality video streaming, minimal latency, and seamless performance across devices. Developing such an app requires not only technical expertise but also the right tools to simplify the process.</p><p>One such tool is <a href="https://www.zegocloud.com/">ZEGOCLOUD</a>, a platform offering powerful SDKs for real-time video and audio streaming. It helps developers build robust and engaging real-time communication apps. This section will walk you through the entire process of creating a sports streaming app, from preparing your environment to integrating live streaming features.</p><h3>Why Use ZEGOCLOUD for Sports Streaming Apps?</h3><p>ZEGOCLOUD provides a suite of tools that simplify the process of building high-quality streaming apps. Its SDKs are designed to handle real-time video, audio, and messaging, making it an ideal choice for sports streaming apps. Key features include:</p><ul><li><strong>High-quality video streaming:</strong> ZEGOCLOUD’s adaptive streaming ensures smooth, high-definition playback, even when users have varying internet speeds.</li><li><strong>Low latency:</strong> For live sports, latency is critical. ZEGOCLOUD minimizes delays, ensuring viewers experience real-time action.</li><li><strong>Cross-platform support:</strong> The SDK supports web browsers, iOS, and Android, giving your app universal accessibility.</li><li><strong>Interactive features:</strong> Add features like live chats, polls, or multi-camera angles for an engaging user experience.</li><li><strong>Easy integration:</strong> The SDK is beginner-friendly, offering extensive documentation and sample code to accelerate development.</li></ul><h3>Prerequisites</h3><p>Before you begin, ensure the following requirements are met:</p><ul><li>A <a href="https://console.zegocloud.com/account/signup">ZEGOCLOUD account</a> to get your AppID and Server URL.</li><li>A Windows or macOS computer with a stable internet connection.</li><li>The latest/compatible version of a WebRTC-enabled browser like Chrome or Firefox.</li><li>Node.js installed on your machine.</li><li>Familiarity with JavaScript or TypeScript for coding.</li><li>A code editor like Visual Studio Code for writing and managing your code.</li></ul><p>With these ready, you can proceed to set up your app.</p><h3>1. Set Up the Project</h3><p>To start, create a folder to house your project and add the necessary files for its structure. You can name the folder sports-streaming-app or something relatable. Inside this folder, add two files:</p><ul><li><strong>index.html</strong> (for the user interface).</li><li><strong>index.js</strong> (for the app’s functionality).</li></ul><p>The folder structure should look like this:</p><pre>sports-streaming-app/<br>├── index.html<br>├── index.js</pre><p>In <strong>index.html</strong>, add the following code:</p><pre>&lt;html&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;title&gt;Sports Streaming App&lt;/title&gt;<br>    &lt;style&gt;<br>        body { font-family: Arial, sans-serif; text-align: center; }<br>        #local-video, #remote-video { width: 400px; height: 300px; border: 1px solid #ccc; }<br>    &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;h1&gt;Sports Streaming App&lt;/h1&gt;<br>    &lt;h3&gt;Local Video&lt;/h3&gt;<br>    &lt;div id=&quot;local-video&quot;&gt;&lt;/div&gt;<br>    &lt;h3&gt;Remote Video&lt;/h3&gt;<br>    &lt;div id=&quot;remote-video&quot;&gt;&lt;/div&gt;<br>    &lt;script src=&quot;index.js&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>This sets up a simple layout with placeholders for displaying live video streams from local and remote users.</p><h3>2. Install the ZEGOCLOUD SDK</h3><p>The <a href="https://www.zegocloud.com/docs/live-streaming/overview?platform=web&amp;language=javascript">ZEGOCLOUD Express Video SDK</a> enables the real-time streaming features needed for your app. To install the SDK, navigate to your project folder in the terminal and run:</p><pre>npm i zego-express-engine-webrtc</pre><p>If you encounter permission issues on macOS or Linux, use the sudo command:</p><pre>sudo npm i zego-express-engine-webrtc</pre><p>This command downloads and sets up the ZEGOCLOUD SDK, which you’ll use to implement streaming capabilities.</p><h3>3. Initialize the ZEGOCLOUD SDK</h3><p>To connect your app to ZEGOCLOUD’s servers, initialize the SDK in index.js. Add the following code to index.js:</p><pre>import { ZegoExpressEngine } from ‘zego-express-engine-webrtc’;<br>const appID = YOUR_APP_ID; // Replace with your AppID<br>const server = &#39;YOUR_SERVER_URL&#39;; // Replace with your Server URL<br>// Initialize the ZegoExpressEngine instance<br>const zg = new ZegoExpressEngine(appID, server);</pre><p>This code does the following:</p><ul><li><strong>Imports the SDK:</strong> Makes the ZEGOCLOUD features available in your app.</li><li><strong>Initializes the Engine:</strong> Establishes a connection to ZEGOCLOUD using your AppID and Server URL.</li></ul><h3>4. Check Browser Compatibility</h3><p>Before implementing streaming, verify the browser supports WebRTC, which is essential for real-time communication. Add this function to <strong>index.js</strong>:</p><pre>async function checkCompatibility() {<br> const result = await zg.checkSystemRequirements();<br> if (result.webRTC) {<br> console.log(“WebRTC is supported!”);<br> } else {<br> console.error(“WebRTC is not supported on this browser.”);<br> }<br>}<br>checkCompatibility();</pre><p>This checks if the browser can handle video and audio streaming, ensuring compatibility before proceeding.</p><h3>5. Log In to a Room</h3><p>Users need to log into a virtual room to start publishing or viewing streams. Again, add the following code to <strong>index.js</strong>:</p><pre>const roomID = &quot;sportsRoom&quot;;<br>const token = &quot;YOUR_TOKEN&quot;; // Replace with a valid token<br>const userID = &quot;user123&quot;;<br>const userName = &quot;User 123&quot;;<br><br>async function loginRoom() {<br>    const result = await zg.loginRoom(<br>        roomID,<br>        token,<br>        { userID, userName },<br>        { userUpdate: true }<br>    );<br><br>    if (result) {<br>        console.log(&quot;Logged into the room successfully!&quot;);<br>    }<br>}<br>loginRoom();</pre><p>Here’s what this does:</p><ul><li>Logs the user into a virtual room using a unique Room ID and authentication token.</li><li>Allows interaction with other users in the room for streaming.</li></ul><h3>6. Publish a Stream</h3><p>Broadcasters need to publish their streams so others can view them. You can achieve this with the <strong>startPublishing</strong> method. This method captures video and audio from the user’s device and displays it in the “Local Video” section while publishing it to the room.</p><pre>async function startPublishing() {<br> const localStream = await zg.createStream();<br> zg.startPublishingStream(“streamID”, localStream);<br> document.getElementById(“local-video”).srcObject = localStream;<br>}<br>startPublishing();</pre><h3>7. Play Remote Streams</h3><p>Viewers can watch live streams published by others in the room. Add the following code to <strong>index.js</strong> to make this happen:</p><pre>zg.on(“roomStreamUpdate”, async (roomID, updateType, streamList) =&gt; {<br> if (updateType === “ADD”) {<br> const remoteStream = await zg.startPlayingStream(streamList[0].streamID);<br> document.getElementById(“remote-video”).srcObject = remoteStream;<br> }<br>});</pre><p>This listens for new streams in the room and plays them in the “Remote Video” section.</p><h3>8. Test and Optimize</h3><p>Run your app in a real browser. Use another device or ZEGOCLOUD’s Web Demo to join the same room and test remote streaming. Ensure video and audio are captured, published, and played correctly.</p><h3>Conclusion</h3><p>Building a sports streaming app like Sportsurge is a great way to meet the growing demand for live sports content. To succeed, focus on key features like smooth streaming, low delay, and an easy-to-use design.</p><p>Tools like ZEGOCLOUD make the process easier by providing reliable video and audio streaming capabilities. Ensure your app works on multiple platforms so more users can enjoy it. Adding features like live chat or multiple camera views can make the app even more engaging.</p><p>With the right planning and tools, creating a high-quality sports streaming app is achievable. Start now, and you can deliver a great experience for sports fans while building a successful platform.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51a2fcdca4b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Develop Apps Like Monkey with ZEGOCLOUD]]></title>
            <link>https://medium.com/@chigozzdev/how-to-develop-apps-like-monkey-with-zegocloud-0ee3d4716022?source=rss-2c2a38b18f27------2</link>
            <guid isPermaLink="false">https://medium.com/p/0ee3d4716022</guid>
            <dc:creator><![CDATA[Chigozzdev]]></dc:creator>
            <pubDate>Sat, 30 Nov 2024 08:50:16 GMT</pubDate>
            <atom:updated>2024-11-30T08:50:16.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*5IVvPVOHD12uoPf7r5rwhA.png" /></figure><p>Building a random video chat app like Monkey is simpler than ever with the right tools and guidance. These apps let users connect with strangers instantly, making them popular for fun and spontaneous interactions. Using <a href="https://www.zegocloud.com/">ZEGOCLOUD</a>, a platform that offers pre-built solutions for video and chat features, you can create a similar app quickly and efficiently.</p><p>In this article, we will walk you through step-by-step how to design and develop a video chat app, focusing on the features that make apps like Monkey successful. With that being said, let’s jump right in!</p><h3>How to Develop Random Video Chat App like Monkey</h3><p>Random video chat apps like Monkey are popular because they offer a fun and spontaneous way to connect with strangers worldwide. These apps provide real-time video and audio interactions, combined with features like random pairing and easy navigation, making them highly engaging. Developing a Monkey app alternative requires a reliable backend for user management, a smooth video communication interface, and safety features to ensure compliance with privacy standards.</p><p>Using the <a href="https://www.zegocloud.com/docs/video-call/overview?platform=web&amp;language=javascript">ZEGOCLOUD Express Video SDK</a>, you can easily integrate high-quality video chat functionality into your application. Below is a comprehensive step-by-step instructions to help you build a random video chat app from scratch.</p><p><strong>Features of ZEGOCLOUD API/SDK</strong></p><p>ZEGOCLOUD offers a lot of features; here are some of the key features:</p><ul><li><strong>Crystal clear video and audio:</strong> Supports smooth communication with excellent audio and video quality for uninterrupted conversations.</li><li><strong>Screen sharing capability:</strong> Essential for collaborative activities like presentations and online teaching.</li><li><strong>Secure communication:</strong> Offers end-to-end encryption to ensure user privacy.</li><li><strong>Customizable interface:</strong> Easily matches the app’s UI design for a seamless user experience.</li></ul><h3>Prerequisites</h3><ul><li>A ZEGOCLOUD Developer Account: <a href="https://console.zegocloud.com/account/signup">Sign up</a> here.</li><li>Obtain your AppID and AppSign from the ZEGOCLOUD console.</li><li>Basic knowledge of HTML, JavaScript, and web application development.</li><li>A computer with internet access for coding and testing.</li></ul><h3>1. Set Up the SDK</h3><p>Integrating the ZEGOCLOUD SDK is the first step. For web applications, install the required library:</p><pre>npm i zego-express-engine-webrtc</pre><p>After installation, import the SDK into your project:</p><pre>const { ZegoExpressEngine } = require(‘zego-express-engine-webrtc’);</pre><h3>2. Design the User Interface (UI)</h3><p>Craft an engaging and intuitive interface that supports random video calls. At a minimum, your UI should include:</p><ul><li><strong>Video displays:</strong> Separate sections for local and remote video feeds.</li><li><strong>Action buttons:</strong> Include buttons for connecting, disconnecting, and switching calls.</li></ul><p><strong>Example HTML structure:</strong></p><pre>&lt;div id=”local-video”&gt;&lt;/div&gt;<br>&lt;div id=”remote-video”&gt;&lt;/div&gt;<br>&lt;button id=”startCall”&gt;Start Random Chat&lt;/button&gt;</pre><p>You can customize this design further to make it visually appealing and functional.</p><h3>3. Initialize ZegoExpressEngine</h3><p>Create an instance of ZegoExpressEngine using your AppID and server details:</p><pre>const appID = YOUR_APP_ID; // Replace with your actual AppID.<br>const server = ‘YOUR_SERVER_URL’; // Replace with your server address.<br>const zg = new ZegoExpressEngine(appID, server);</pre><p>This setup prepares your app to manage video streams.</p><h3>4. User Authentication and Random Room Login</h3><p>To enable random pairing, you need to assign each user to a randomly generated room. Additionally, each user should have a unique identifier for tracking and communication.</p><p><strong>a. Generate Random IDs</strong></p><p>This function generates a random alphanumeric string that serves as the room ID for a session:</p><pre>function generateRandomRoomID() {<br> return Math.random().toString(36).substring(2, 8).toUpperCase(); // 6-character alphanumeric string<br>}</pre><p><strong>b. Generate Unique User ID</strong></p><p>Each user is assigned a unique ID to identify them within the room:</p><pre>function generateUserID() {<br> const timestamp = new Date().getTime(); // Use the current timestamp for uniqueness<br> const randomPart = Math.random().toString(36).substring(2, 6).toUpperCase(); // Add randomness<br> return `user_${randomPart}_${timestamp}`;<br>}</pre><p><strong>c. Log into the Room</strong></p><p>Once IDs are generated, log the user into a room:</p><pre>const roomID = generateRandomRoomID(); // Assign the user to a random room<br>const userID = generateUserID(); // Generate a unique user ID<br>const token = &#39;YOUR_TEMPORARY_TOKEN&#39;; // Obtain from ZEGOCLOUD Admin Console<br><br>zg.loginRoom(roomID, token, { userID: userID, userName: User_${userID} })<br>    .then(() =&gt; {<br>        console.log(`Logged into room: ${roomID} as user: ${userID}`);<br>    })<br>    .catch(error =&gt; {<br>        console.error(&#39;Failed to log into room:&#39;, error);<br>    });</pre><h3>5. Start Local Video Stream</h3><p>Enable the user’s camera and microphone to preview their video:</p><pre>const localStream = await zg.createStream(); // Access camera and mic.<br>zg.createLocalStreamView(localStream).play(‘local-video’); // Play the stream in the UI.<br>zg.startPublishingStream(‘localStreamID’, localStream); // Publish the stream to the cloud.</pre><p>This step makes the user’s video feed visible and available to others in the room.</p><h3>6. Handle Remote Streams</h3><p>Play video streams from other users in the chat room. Listen for new streams using the roomStreamUpdate event:</p><pre>zg.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>    if (updateType === &#39;ADD&#39;) {<br>        const remoteStream = await zg.startPlayingStream(streamList[0].streamID); // Play the first available stream.<br>        zg.createRemoteStreamView(remoteStream).play(&#39;remote-video&#39;); // Display the remote stream.<br>    }<br>});</pre><p>This ensures that the app automatically shows new video feeds when someone joins the chat.</p><h3>7. End the Call</h3><p>When a user decides to leave the video call, stop the streams and clean up resources:</p><p><strong>Stop Publishing Local Streams:</strong></p><pre>zg.stopPublishingStream(‘localStreamID’); // Stop sharing the video.<br>zg.destroyStream(localStream); // Destroy local video data.</pre><p><strong>Stop Playing Remote Streams:</strong></p><pre>zg.stopPlayingStream(‘remoteStreamID’); // Cease remote video playback.</pre><h3>8. Logout from the Room</h3><p>To exit a room and ensure no leftover connections, use:</p><pre>zg.logoutRoom(roomID);</pre><p>Always call this when the user leaves the app or stops interacting.</p><h3>9. Complete Implementation</h3><p>Here’s the complete HTML structure for your random video chat app, with local and remote video sections, buttons for starting and ending the call, and styling for a clean interface.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;Random Video Chat&lt;/title&gt;<br>    &lt;style&gt;<br>        /* Basic styling for the app */<br>        body {<br>            font-family: Arial, sans-serif;<br>            margin: 0;<br>            padding: 0;<br>            display: flex;<br>            flex-direction: column;<br>            align-items: center;<br>            justify-content: center;<br>            height: 100vh;<br>            background-color: #f4f4f4;<br>        }<br><br>        h1 {<br>            margin-bottom: 20px;<br>        }<br><br>        #video-container {<br>            display: flex;<br>            gap: 20px;<br>            justify-content: center;<br>            margin-bottom: 20px;<br>        }<br><br>        #local-video, #remote-video {<br>            width: 300px;<br>            height: 225px;<br>            border: 1px solid #ccc;<br>            background-color: #000;<br>            display: flex;<br>            align-items: center;<br>            justify-content: center;<br>            color: white;<br>            font-size: 14px;<br>        }<br><br>        #controls {<br>            display: flex;<br>            gap: 10px;<br>        }<br><br>        button {<br>            padding: 10px 20px;<br>            font-size: 16px;<br>            border: none;<br>            cursor: pointer;<br>            border-radius: 5px;<br>        }<br><br>        button#startCall {<br>            background-color: #28a745;<br>            color: white;<br>        }<br><br>        button#endCall {<br>            background-color: #dc3545;<br>            color: white;<br>        }<br><br>        button:disabled {<br>            background-color: #ccc;<br>            cursor: not-allowed;<br>        }<br>    &lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br><br>    &lt;h1&gt;Random Video Chat&lt;/h1&gt;<br>    <br>    &lt;!-- Video container for local and remote streams --&gt;<br>    &lt;div id=&quot;video-container&quot;&gt;<br>        &lt;div id=&quot;local-video&quot;&gt;Local Video&lt;/div&gt;<br>        &lt;div id=&quot;remote-video&quot;&gt;Remote Video&lt;/div&gt;<br>    &lt;/div&gt;<br>    <br>    &lt;!-- Buttons to start and end calls --&gt;<br>    &lt;div id=&quot;controls&quot;&gt;<br>        &lt;button id=&quot;startCall&quot;&gt;Start Random Chat&lt;/button&gt;<br>        &lt;button id=&quot;endCall&quot; disabled&gt;End Chat&lt;/button&gt;<br>    &lt;/div&gt;<br><br>    &lt;!-- JavaScript integration --&gt;<br>    &lt;script&gt;<br>        // App logic here<br>        let zg, localStream;<br><br>        const startCallBtn = document.getElementById(&#39;startCall&#39;);<br>        const endCallBtn = document.getElementById(&#39;endCall&#39;);<br>        const localVideo = document.getElementById(&#39;local-video&#39;);<br>        const remoteVideo = document.getElementById(&#39;remote-video&#39;);<br><br>        // Initialize the ZegoExpressEngine instance<br>        const appID = YOUR_APP_ID;  // Replace with your actual AppID<br>        const server = &#39;YOUR_SERVER_URL&#39;;  // Replace with your server URL<br><br>        zg = new ZegoExpressEngine(appID, server);<br><br>        // Generate random room and user IDs<br>        function generateRandomRoomID() {<br>            return Math.random().toString(36).substring(2, 8).toUpperCase();<br>        }<br><br>        function generateUserID() {<br>            const timestamp = new Date().getTime();<br>            const randomPart = Math.random().toString(36).substring(2, 6).toUpperCase();<br>            return user_${randomPart}_${timestamp};<br>        }<br><br>        const roomID = generateRandomRoomID();<br>        const userID = generateUserID();<br>        const token = &#39;YOUR_TEMPORARY_TOKEN&#39;;  // Replace with a token from ZEGOCLOUD<br><br>        startCallBtn.addEventListener(&#39;click&#39;, async () =&gt; {<br>            try {<br>                // Log into the room<br>                await zg.loginRoom(roomID, token, { userID, userName: userID });<br>                console.log(`Logged into room: ${roomID} as user: ${userID}`);<br><br>                // Create and display local stream<br>                localStream = await zg.createStream();<br>                const localView = zg.createLocalStreamView(localStream);<br>                localView.play(&#39;local-video&#39;);<br><br>                // Publish local stream<br>                zg.startPublishingStream(&#39;localStreamID&#39;, localStream);<br><br>                // Listen for remote streams<br>                zg.on(&#39;roomStreamUpdate&#39;, async (roomID, updateType, streamList) =&gt; {<br>                    if (updateType === &#39;ADD&#39;) {<br>                        const remoteStream = await zg.startPlayingStream(streamList[0].streamID);<br>                        const remoteView = zg.createRemoteStreamView(remoteStream);<br>                        remoteView.play(&#39;remote-video&#39;);<br>                    }<br>                });<br><br>                // Enable &quot;End Chat&quot; button<br>                startCallBtn.disabled = true;<br>                endCallBtn.disabled = false;<br><br>            } catch (error) {<br>                console.error(&#39;Error starting the call:&#39;, error);<br>            }<br>        });<br><br>        endCallBtn.addEventListener(&#39;click&#39;, async () =&gt; {<br>            try {<br>                // Stop local stream<br>                zg.stopPublishingStream(&#39;localStreamID&#39;);<br>                zg.destroyStream(localStream);<br><br>                // Logout from room<br>                zg.logoutRoom(roomID);<br><br>                // Clear video displays<br>                localVideo.innerHTML = &#39;Local Video&#39;;<br>                remoteVideo.innerHTML = &#39;Remote Video&#39;;<br><br>                // Toggle buttons<br>                startCallBtn.disabled = false;<br>                endCallBtn.disabled = true;<br><br>            } catch (error) {<br>                console.error(&#39;Error ending the call:&#39;, error);<br>            }<br>        });<br>    &lt;/script&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Conclusion</h3><p>Developing a random video chat app like Monkey is easier than ever with ZEGOCLOUD’s powerful API and SDK. By following the steps in this guide, you can create an app that connects people instantly through high-quality video calls. ZEGOCLOUD handles the complex parts, like streaming and encryption, so you can focus on building a fun and engaging user experience.</p><p>Add features like random user pairing, secure communication, and custom designs to make your app unique. Whether it’s for socializing or learning, your app can provide safe, seamless, and exciting video interactions. Start building today, and bring your random video chat app idea to life with ZEGOCLOUD’s tools and support.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0ee3d4716022" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>