Skip to content

Live Plugin

Daniel Neto edited this page Oct 11, 2024 · 43 revisions

This plugin allows you to broadcast live streams from your device to your AVideo platform, providing real-time video to viewers.


Configuration

Before you can start using the live streaming plugin, certain configurations are required. Below is a detailed guide to set up your server and integrate with the Live Plugin.

1. NGINX RTMP Server Setup

The Live Plugin requires an NGINX RTMP Server to handle live streams. If you haven’t set one up yet, please follow this tutorial.

Other RTMP servers can be used, but they won’t be as tightly integrated as the NGINX RTMP setup. To use third-party RTMP servers, you’ll need the LiveLinks plugin.


Configuration Parameters

The following parameters are used to configure the Live Plugin. If you have installed NGINX RTMP on the same server as AVideo, you probably do not need to change anything. For advanced settings, make sure you understand their functionality before making modifications.

Core Parameters:

  • 🖥️ server:
    RTMP Server URL
    Default: rtmp://your-domain/live
    This is the URL where your RTMP server listens for incoming streams.

  • 🌐 playerServer:
    HTML5 Player URL
    Default: https://your-domain:8443/live
    This URL is used by your HTML5 player to serve HLS streams. Ensure it uses HTTPS if your site is HTTPS.

  • 📊 stats:
    Stats Page URL
    Default: https://your-domain:8443/stat
    This URL is used to retrieve statistics about your live stream (e.g., whether it’s online).

  • 🔁 restreamerURL:
    Restreamer URL
    Default: your-domain/plugin/Live/standAloneFiles/restreamer.json.php
    This URL handles the restreaming process. If you plan to restream your live stream to platforms like YouTube or Facebook, this is where the configuration occurs.

  • 🔧 controlURL:
    Control URL
    Default: your-domain/plugin/Live/standAloneFiles/control.json.php
    This URL is used to manage live stream control features like starting/stopping recording or dropping publishers.

  • 🛠️ controlServer:
    Control Server
    Default: http://localhost:8080/
    URL used for live stream control. You can keep the default if NGINX RTMP is installed on the same server.

  • 🌐 useLiveServers:
    Use Live Servers
    Default: false
    Enable this if you plan to use external live servers. Otherwise, leave it disabled.

  • 📂 hls_path:
    HLS Path
    Default: /HLS/live
    This is the path where HLS segments are stored when a live stream is stopped.


Optional Parameters:

  • ⏪ disableDVR:
    Disable DVR
    Default: false
    Enabling this will disable the DVR functionality, preventing users from rewinding the live stream. Control DVR length in nginx.conf.

  • 🖼️ disableGifThumbs:
    Disable GIF Thumbnails
    Default: false
    Disabling this option will prevent animated GIF thumbnails from being generated for live streams, reducing server load.

  • 📷 disableLiveThumbs:
    Disable Live Thumbnails
    Default: false
    Disabling this option will use a static image for live streams instead of generating a live thumbnail, saving server resources.

  • 📜 doNotShowLiveOnVideosList:
    Do Not Show Live on Videos List
    Default: false
    If enabled, live streams will not be listed on the main videos gallery page.

  • 🔒 protectLive:
    Live Protection
    Default: false
    Enabling this will protect your live stream encryption key, so only your site’s player can play the video. Download tools will be blocked.

  • 🔢 limitLiveOnVideosList:
    Limit Live on Videos List
    Default: 12
    Limits the number of live videos shown on the videos list page.


Advanced Parameters (Use with Caution):

If you are not familiar with these options, it's best to leave them unchanged.

  • 🌀 useAadaptiveMode:
    Adaptive Mode
    Default: false
    This mode adjusts the live stream quality based on the viewer's bandwidth. It consumes more CPU resources.

  • ⏰ autoFishLiveEveryHour:
    Default: false
    This option checks every hour for offline live sessions and ends them automatically if they are still marked as live.

  • 🛡️ controllButtonsShowOnlyToAdmin_*:
    These options control whether certain buttons (e.g., for starting/stopping recording or dropping the publisher) are visible to admins only.


Summary

For most users, the default configuration will work if NGINX RTMP is installed on the same server as AVideo. The plugin is designed to handle most of the configuration automatically. If you need to customize your setup (e.g., restreaming to other platforms or using external servers), you can adjust the parameters listed above.

For advanced options such as Adaptive Mode and control buttons, it's recommended to only modify them if you're familiar with how they impact performance.


3. Live Stream Server Balance

From version 4, the Live Plugin supports distributing live streams across multiple servers. You can configure RTMP servers on different machines in the Live Servers menu.

image


Usage

Once you have configured the system, you can start using the live streaming features of the plugin.


1. How to Publish a Live Stream

You can publish live streams using:

  • A mobile device.
  • Desktop RTMP publisher software (e.g., OBS).

Currently, you cannot publish directly using your webcam through the website interface.

For more details on how to publish a live stream, click here.


2. Saving the Livestream

The plugin allows you to save your live streams. Once a live stream ends, it can be sent to your encoder and stored in your video library.

For more details on saving live streams, click here.


3. Live Stream Limits

The plugin allows for unlimited simultaneous live streams and users, but hardware limitations will apply based on:

  • Bandwidth available.
  • Video quality being streamed.

For live broadcasts with a large audience, we recommend using a dedicated server. VPS providers may suspend your account due to high resource usage.

📶 Estimated Bandwidth Usage

Video Resolution Bandwidth Simultaneous Users (100Mbps) Simultaneous Users (1Gbps) YPT CDN
1080p 5 Mbps 20 200 unlimited
720p 2.5 Mbps 40 400 unlimited
480p 1 Mbps 100 1000 unlimited
360p 500 kbps 200 2000 unlimited
240p 300 kbps 350 3500 unlimited

4. 🎯 Redirect URL Feature with Auto-Redirect Option

The Redirect URL feature allows live stream owners to redirect all live viewers to a specified URL at any time or automatically at the end of the live stream. You can now customize this experience with an additional message field and an auto-redirect option for seamless post-stream transitions.

How to Use:

  1. Open the Live Panel: Inside the live panel, you will find the option to redirect viewers.
  2. Add a URL: Choose from a list of available live streams or manually enter a URL, including external websites.
  3. Set a Custom Message (optional): You can include a custom message that viewers will see before being redirected. If no message is provided, a default message will be displayed.
  4. Enable Auto-Redirect (optional): You can enable the Auto-redirect at the end of the livestream option, which will automatically redirect all viewers when the stream ends.
  5. Click the Redirect Viewers Button: Regardless of whether the Auto-redirect option is checked or not, clicking the Redirect Viewers button will immediately redirect all live viewers to the specified URL, even if the live stream is still running.
Important:
  • The Redirect Viewers button will only be active if the live stream is running and active.
  • If you finish the live stream without clicking the button and auto-redirect is disabled, viewers will not receive the redirection message or be redirected.
  • If Auto-redirect is enabled, the viewers will automatically be redirected when the live stream ends, even if you don’t manually click the button.
  • Clicking the Redirect Viewers Button will immediately redirect viewers, whether or not the Auto-Redirect option is enabled, and regardless of whether the stream is still active.

Your viewers will receive the custom message you provided (or the default message), and then they will be redirected to the specified link.

Note: This feature requires the Socket Plugin.

Key Features Recap:

  • Manual Redirect: Click the button to manually redirect all viewers during a live stream, regardless of whether Auto-redirect is enabled.
  • Custom Message: Add a custom message that viewers will see before being redirected.
  • Auto-Redirect: Enable this option to automatically send viewers to the specified URL when the live stream ends, but clicking the manual redirect button will still immediately redirect viewers.
  • Socket Plugin Required: The redirection functionality relies on the Socket Plugin to notify viewers in real-time.

This Auto-Redirect option enhances control over your livestream experience, ensuring that viewers are directed to the desired location when the broadcast ends, while the Redirect Viewers Button allows for immediate manual redirection at any time, offering flexibility in managing live viewers.

5. YPT CDN

To avoid bottlenecks when delivering live streams, use the [YPT CDN Plugin](https://

github.com/WWBN/AVideo/wiki/CDN-Plugin). CDNs distribute your video across servers worldwide, improving scalability and performance for your live streams.


6. Why is My Live Stream Buffering or Delayed?

Live streams use HLS (HTTP Live Streaming), which introduces a natural delay. The delay is due to the time required for:

  • Encoding.
  • Transmission across the internet.
  • Distribution to edge servers.

Latency and buffering can also be caused by:

  1. Server hardware: Insufficient CPU, RAM, or disk I/O can introduce delays.
  2. Internet speed: Slow bandwidth at either the server or client’s end.

7. Adaptive Streaming

For larger audiences or unstable internet connections, we recommend using Adaptive Streaming, which dynamically adjusts the video quality based on the viewer’s bandwidth.

This requires a specific NGINX configuration. More details here.


8. Restreaming

The Restream feature allows you to broadcast your live stream to multiple platforms simultaneously (e.g., YouTube, Facebook, Twitch). You can configure restreaming by editing the restreamer.json.php file inside the Live Plugin.

For security, restreaming requires token authentication, but the same configuration can be used across multiple live servers.


9. Control Module

The Control Module allows you to:

  • Start/Stop live stream recording.
  • Drop live stream clients using HTTP control commands.

Ensure the following configuration is present in your nginx.conf file:

http {
    server {
        location /control {
            allow 127.0.0.1;
            deny all;
            rtmp_control all;
        }
    }
}

The control logic is handled by the control.json.php file, which must be placed on the same server as the NGINX RTMP server.

Clone this wiki locally