Документация ComusThumbz
Вход для Администратора

Настройка Live Video Streaming

Что делает эта страница

Это руководство поможет вам настроить функцию потокового видео в прямом эфире на вашем сайте ComusThumbz. После настройки ваши создатели могут транслировать живое видео прямо из своих браузеров своим поклонникам, с чатом в реальном времени, чаевыми и частными шоу. Подумайте об этом, как о создании собственной персональной платформы потокового вещания Twitch или OnlyFans.

[Скриншот: live-streaming-overview]


Зачем вам это нужно

Функция прямой трансляции позволяет создателям на вашем сайте:

  • Перейдите прямо из своего браузера (не требуется специальное программное обеспечение)
  • Потоковое видео с очень низкой задержкой (менее 1 секунды)
  • Чат со зрителями в реальном времени
  • Получать советы во время их потока
  • Предлагайте частные шоу один на один
  • Контроль, кто может смотреть (бесплатно, только подписчики, плата за просмотр и т.д.)

Для зрителей они могут:

  • Watch Creators транслируются в прямом эфире
  • Отправлять сообщения в чат
  • Отправить советы создателям
  • Запрос частных шоу


Прежде чем вы начнете

Предупреждение:
Прямая трансляция требует выделенного сервера или VPS (Virtual Private Server). Он не будет работать на совместном хостинге, таком как GoDaddy или основные планы Bluehost. Вам нужен root-доступ для установки программного обеспечения на сервер.

Что вам понадобится

  1. Отдельный сервер или VPS Это может быть тот же сервер, где установлен ComusThumbz, или другой. Минимальная 2 ГБ ОЗУ, рекомендуется 2 ядра процессора.
  2. Домен или субдомен Что-то вроде streaming.yoursite.com
  3. Около 30-60 минут - Для процесса установки
  4. Базовый комфорт с командной строкой Вам нужно будет запустить несколько команд на вашем сервере.

Проверьте, готовы ли вы

Войдите на свой сервер через SSH и запустите следующие команды:

# Check if Docker is installed
docker --version

Проверьте публичный IP вашего сервера


curl -s ifconfig.me

Если Docker не установлен, не волнуйтесь - скрипт настройки может установить его для вас.


Понимание установки

Как работает Live Streaming

Creator's Browser -> Streaming Server -> Viewers' Browsers
  1. Создатель открывает страницу «Go Live» на вашем сайте
  2. Их веб-камера и микрофон подключаются к вашему потоковому серверу
  3. Потоковый сервер отправляет видео всем зрителям, наблюдающим
  4. Каждый может общаться и отправлять советы в режиме реального времени

Что устанавливается

Процесс установки устанавливает LiveKitЭто программное обеспечение потокового сервера. Он работает в контейнере Docker (подумайте об этом как о автономном мини-компьютере) на вашем сервере и обрабатывает всю маршрутизацию видео.


Шаги установки

Шаг 1: Выберите способ установки

Существует два способа настройки потокового сервера:

Вариант А: Автоматизированная настройка (рекомендуется) Сценарий делает все для вас
Вариант B: ручная настройка Вы запускаете каждую команду самостоятельно (для продвинутых пользователей)

Мы рекомендуем вариант А для большинства людей.


Вариант А: Автоматизированная настройка (самая простая)

1.Загрузить сценарий установки

  1. Загрузите скрипт настройки из папки установки ComusThumbz: tools/setuplivekitserver.sh
  2. Загрузите его на потоковый сервер (вы можете разместить его в домашнем каталоге)

2.Сделать сценарий исполняемым

Войдите на свой сервер через SSH и запустите:

chmod +x setuplivekitserver.sh

3. Запустите сценарий установки

sudo ./setuplivekitserver.sh

Сценарий задаст вам несколько вопросов, а затем:

  • Установите Docker при необходимости
  • Настройте свой Firewall
  • Настройка потокового сервера
  • Создание ключей безопасности

4.Сохранить свои полномочия

В конце концов, сценарий покажет вам что-то вроде:

API Credentials:
  API Key: APIxxxxxxxxxxxxxxxx
  API Secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Предупреждение:
Скопируйте эти данные и сохраните их в безопасном месте! Они вам понадобятся в следующем разделе.

5.Проверка установки

Сценарий подскажет, все ли работает. Вы должны увидеть сообщение «LiveKit успешно работает».


Вариант B: ручная настройка (продвинутая)

Если вы предпочитаете выполнять настройку вручную или автоматический скрипт не работает для вашего сервера, выполните подробные шаги ручной установки в техническом руководстве.

Совет:
По сути, ручные шаги — это то же самое, что и автоматический сценарий, просто разбитый на отдельные команды. Используйте его только в том случае, если вам удобно администрировать сервер.


Подключение ComusThumbz к потоковому серверу

Теперь, когда ваш потоковый сервер работает, вам нужно сообщить вашей установке ComusThumbz, как подключиться к нему.

Шаг 1: Включить функцию

  1. Log into your Admin Panel
  2. Go to Admin Panel > Settings > Feature Toggles
  3. Find Live Streaming and turn it ON
  4. Click Save Changes

Step 2: Add Your Streaming Server Details

You need to add three pieces of information to your configuration file.

  1. Log into your web server via SFTP or File Manager
  2. Navigate to ct/dat/config.inc.php
  3. Open the file for editing
  4. Add these lines at the end of the file (before the closing ?> if there is one):
// LiveKit WebRTC Streaming Configuration
define('LIVEKITHOST', 'wss://streaming.yoursite.com/livekit/');
define('LIVEKITAPIKEY', 'paste-your-api-key-here');
define('LIVEKITAPISECRET', 'paste-your-api-secret-here');
  1. Replace the values:
  • streaming.yoursite.com - Your streaming server domain
  • paste-your-api-key-here - The API Key from Step 4 of the installation
  • paste-your-api-secret-here - The API Secret from Step 4 of the installation
  1. Save the file

 

Tip:
For LIVEKIT
HOST, use wss:// (secure WebSocket) if you have SSL/HTTPS on your site. If you're just testing on a local network, you can use ws:// followed by your server's IP address and :7880.

 

Step 3: Verify It's Working

  1. Log into your site as a user who has creator access
  2. Go to My Account > Go Live (in your user settings)
  3. You should see the "Go Live" page with webcam options
  4. If you see an error message instead, something isn't configured correctly

Testing Your Setup

Complete Streaming Test

Follow these steps to verify everything is working:

1. Prepare a Creator Account

You need an account with creator privileges to test.

  1. Go to Admin Panel > Users > User Management
  2. Find the user you want to test with
  3. Click Edit
  4. Make sure Is Creator is set to Yes
  5. Save

2. Start a Test Stream

  1. Log in as the creator
  2. Go to My Account > Go Live
  3. Fill in a stream title (like "Test Stream")
  4. Set access to Free (so anyone can watch)
  5. Click Start Streaming
  6. When your browser asks for camera/microphone permission, click Allow
  7. You should see your webcam preview on screen

3. Watch the Stream as a Viewer

  1. Open a different browser (or incognito/private window)
  2. Visit your site and go to Live Streams in the main menu
  3. You should see your test stream listed
  4. Click on it to watch
  5. The video should appear within 1-2 seconds

4. Test the Chat

  1. In the viewer window, type a message in the chat box and press Enter
  2. The message should appear in both the viewer and broadcaster windows
  3. This confirms real-time communication is working

5. End the Stream

  1. Back in the broadcaster window, click End Stream
  2. The stream should disappear from the Live Streams page
  3. The viewer should see a message that the stream has ended

 

Success:
If all five steps worked, congratulations! Your live streaming is fully operational.

 


Where Creators and Viewers Go

For Creators (Broadcasters)

Go Live Page: Settings > Go Live

On this page, creators can:

  • Select their camera and microphone
  • Set a title and description for their stream
  • Choose who can watch (free, password protected, subscribers only, pay-per-view, or tip goal)
  • See their viewer count
  • Read and respond to chat messages
  • See tip notifications
  • Accept or decline private show requests

 

For Viewers

Stream Directory: Live Streams (in main navigation)

This page shows:

  • All active streams as a grid of preview cards
  • Number of viewers watching each stream
  • Creator's profile picture and name

 

Watch Stream Page: Clicking on any stream opens the viewer page

On this page, viewers can:

  • Watch the live video
  • Chat with the creator and other viewers
  • Send tips
  • Request a private show (if they have enough tokens)

 


Common Tasks

Restarting the Streaming Server

If your streams aren't working, sometimes you just need to restart the server:

# Log into your streaming server via SSH
docker restart livekit

Wait 10 seconds, then test again.

Checking if the Streaming Server is Running

# Log into your streaming server via SSH
docker ps | grep livekit

If you see a line with "livekit" in it, the server is running. If you don't see anything, start it:

cd /opt/livekit
docker compose up -d

Viewing Server Logs

If something isn't working and you need to see what's happening:

# Show the last 50 lines of the log
docker logs --tail 50 livekit

Watch the log in real-time (press Ctrl+C to stop)


docker logs -f livekit

Updating the Streaming Server

Every few months, you may want to update to the latest version:

# Pull the latest version
docker pull livekit/livekit-server:latest

Restart with the new version


docker compose down
docker compose up -d

Troubleshooting

Streams Won't Start

What you see: Creator clicks "Start Streaming" but nothing happens or an error appears.

How to fix it:

  1. Check that the feature is enabled in Admin Panel > Settings > Feature Toggles
  2. Verify the creator account has Is Creator set to Yes
  3. Check your config.inc.php file has the three LIVEKIT settings
  4. Verify the streaming server is running: docker ps | grep livekit

Viewers Can't Connect

What you see: The Live Streams page loads but clicking a stream shows an error or black screen.

How to fix it:

  1. Make sure your firewall allows traffic on these ports:
  • TCP: 7880, 7881
  • UDP: 50000-60000
  1. Check that your LIVEKITHOST uses wss:// (not ws://) if your site uses HTTPS
  2. Verify your SSL certificate is valid if using HTTPS

Chat Works But Video is Black

What you see: Viewers can send chat messages but the video never appears.

How to fix it:

This usually means the UDP ports are blocked. On your streaming server:

# Open the UDP port range
sudo ufw allow 50000:60000/udp

Then restart the streaming server and try again.

"You Already Have an Active Stream" Error

What you see: Creator tries to go live but gets an error saying they already have a stream.

How to fix it:

This happens if a previous stream didn't end properly (browser crash, etc.). You can manually end it:

  1. Go to Admin Panel > Live Streams (if you have this page)
  2. Find the stuck stream and click End Stream

Or ask a developer to run this SQL command:

UPDATE tblLiveStreams
SET status = 'ended', endedat = NOW()
WHERE creatorid = [USERID] AND status IN ('waiting', 'live');

Replace [USERID] with the creator's user ID number.

Stream Previews Not Showing

What you see: The Live Streams directory page shows streams but no preview images.

How to fix it:

  1. Check that the uploads/streamsnapshots/ folder exists
  2. Make sure the folder is writable (permission 755 or 777)
  3. Wait a few seconds - previews are captured every 30 seconds during a live stream

Tips for New Users

 

Tip:
  • Start with free streams - Get comfortable with the technology before setting up paid streams
  • Test with friends - Have a few people watch your first stream to verify everything works
  • Check your internet speed - Creators need at least 5 Mbps upload speed for good quality streaming
  • Use a wired connection - WiFi can be unreliable for streaming; ethernet cables work better
  • Close other apps - Streaming uses a lot of computer resources; close unnecessary programs
  • Have good lighting - Viewers can't tip if they can't see you clearly

 


Access Control Options Explained

When creators start a stream, they choose who can watch:

Access Type What It Means When to Use It
Free Anyone can watch, no payment required Building an audience, special events, or casual streams
Password Protected Viewers need a password to watch Private streams for a specific group, like fan club members
Subscribers Only Only users with an active subscription can watch Exclusive content for paying subscribers
Pay-Per-View Viewers pay tokens once to unlock the stream Special events or premium content
Tip Goal Stream unlocks when tip goal is reached Interactive fundraising or community challenges

Creators can change these settings for each stream.


Understanding Private Shows

Private shows are one-on-one streams between a creator and a single viewer. Here's how they work:

  1. A viewer watches a public stream
  2. They click Request Private Show
  3. They set how many minutes they want
  4. The request appears to the creator
  5. If the creator accepts:
  • The public stream ends
  • A new private stream starts
  • Only the requesting viewer can watch
  • Tokens are deducted per minute automatically
  1. When time runs out (or someone ends it), the private show ends

Creators set their per-minute rate in their creator profile settings.


Security and Privacy

What's Protected

  • All video streams are encrypted in transit
  • Tokens (payment for access) are generated by the server, not the browser
  • Viewers can only join rooms they have permission for
  • Chat messages are stored in your database

What to Watch For

  • Require SSL/HTTPS - Always use wss:// in your LIVEKIT_HOST setting for production sites
  • Monitor reported streams - Have a moderation system for inappropriate content
  • Set up rate limiting - Prevent chat spam by limiting how fast users can send messages
  • Review your firewall - Only open the ports mentioned in this guide

Page When to Use It
Feature Toggles Turn live streaming on or off site-wide
Creator Management Approve creators who can go live
User Management Set who has creator privileges
Token Settings Configure token pricing for pay-per-view and private shows

Getting Help

If you're stuck:

  1. Check the logs - Run docker logs livekit to see what the streaming server is reporting
  2. Test the connection - Make sure you can reach your streaming server from a browser
  3. Verify your config - Double-check the three LIVEKIT settings in config.inc.php
  4. Check the forum - Other users may have solved the same issue
  5. Contact support - Provide the output of docker ps and docker logs --tail 50 livekit

What's Next?

Once your live streaming is set up:

  1. Promote the feature - Let your creators know they can now go live
  2. Create a guide for creators - Write simple instructions for your specific audience
  3. Set token prices - Decide pricing for pay-per-view and private shows
  4. Monitor usage - Watch server resources to see if you need to upgrade
  5. Gather feedback - Ask creators and viewers what they like or what needs improvement

 

Success:
Live streaming can significantly increase engagement and revenue on your site. Take time to promote it to your creators and viewers!