-
Notifications
You must be signed in to change notification settings - Fork 976
Live Plugin
Before using the Live Streaming Plugin, you need to configure your server correctly. Below is a detailed guide to set up your server and integrate the Live Plugin.
The Live Plugin requires an NGINX RTMP Server to handle live streams. If you haven’t set one up yet, follow this tutorial. Although other RTMP servers can be used, the NGINX RTMP setup offers the best integration. If using a third-party RTMP server, you’ll need the LiveLinks Plugin for compatibility.
These parameters are used to configure the Live Plugin. If you have installed NGINX RTMP on the same server as AVideo, the default settings should work. For custom setups or using external servers, modify the parameters accordingly.
-
🖥️ RTMP Server URL (
server
):
Default:rtmp://your-domain/live
This is the URL where your RTMP server listens for incoming streams. -
🌐 HTML5 Player URL (
playerServer
):
Default:https://your-domain:8443/live
The URL used by your HTML5 player to serve HLS streams. Use HTTPS if your site uses HTTPS. -
📊 Stats Page URL (
stats
):
Default:https://your-domain:8443/stat
Used to retrieve statistics about your live stream (e.g., live status). -
🔁 Restreamer URL (
restreamerURL
):
Default:your-domain/plugin/Live/standAloneFiles/restreamer.json.php
Configures restreaming to platforms like YouTube or Facebook. -
🔧 Control URL (
controlURL
):
Default:your-domain/plugin/Live/standAloneFiles/control.json.php
Manages live stream controls like start/stop recording. -
🛠️ Control Server (
controlServer
):
Default:http://localhost:8080/
URL used for live stream control when NGINX RTMP is installed on the same server. -
🌐 Use External Live Servers (
useLiveServers
):
Default:false
Enable if using external servers. -
📂 HLS Path (
hls_path
):
Default:/HLS/live
Path where HLS segments are stored when a live stream is stopped.
-
⏪ Disable DVR (
disableDVR
):
Default:false
Disabling this prevents rewinding the live stream. -
🖼️ Disable GIF Thumbnails (
disableGifThumbs
):
Default:false
Disables animated GIF thumbnails, reducing server load. -
📷 Disable Live Thumbnails (
disableLiveThumbs
):
Default:false
Uses a static image for live streams instead of live thumbnails. -
📜 Do Not Show Live on Videos List (
doNotShowLiveOnVideosList
):
Default:false
Hides live streams from the main videos gallery. -
🔒 Protect Live (
protectLive
):
Default:false
Protects your live stream encryption key so only your site’s player can access the stream. Essential for Live PPV. -
🔢 Limit Live on Videos List (
limitLiveOnVideosList
):
Default:12
Limits the number of live streams shown on the videos page.
To protect a live stream (e.g., for live pay-per-view), you need the VideoHLS Plugin (details here). Ensure your NGINX is built with the http_auth_request_module:
sudo ./auto/configure --with-http_ssl_module --with-http_stub_status_module --with-http_auth_request_module --add-module=../nginx-rtmp-module --with-cc-opt="-Wimplicit-fallthrough=0"
To protect your HLS keys and secure your live streams (e.g., for live pay-per-view setups), follow the steps below. Make sure your NGINX is built with the http_auth_request_module as mentioned earlier.
Here’s how to structure each part of the protection configuration within your nginx.conf
file:
This configuration is for the rtmp
module and manages the settings for live streaming.
rtmp {
server {
...
application live {
...
# Enable HLS encryption
hls_keys on;
hls_fragments_per_key 20;
...
}
}
}
-
hls_keys on;
andhls_fragments_per_key 20;
: These lines enable HLS encryption and set the number of fragments per key. Place these lines inside theapplication live
block within thertmp
block.
The HTTP configuration handles the requests for .m3u8
and .key
files, including the authorization check for .key
files. This block is crucial for securing access to the HLS key files.
http {
...
server {
...
location /live {
...
location ~ \.key$ {
# Authorization for HLS key files
auth_request /auth_key_check;
add_header 'Content-Type' 'application/octet-stream';
add_header 'Cache-Control' 'no-cache';
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
}
...
}
# Authorization endpoint for key access
location = /auth_key_check {
internal; # This location is internal, preventing direct access
proxy_pass http://avideo/plugin/Live/authorizeKeyAccess.php;
proxy_pass_request_body off; # Do not forward the request body
proxy_set_header Content-Length "";
# Pass headers with client information to the authorization service
proxy_set_header X-Original-URI $request_uri; # Original request URI
proxy_set_header X-Forwarded-For $remote_addr; # Client IP address
proxy_set_header User-Agent $http_user_agent; # Client User-Agent
}
}
}
-
location /live
: This block serves the HLS files (.m3u8
and.key
). Place this inside theserver
block of yourhttp
section.-
.m3u8
files: This configuration ensures proper headers and CORS setup. -
.key
files: Theauth_request
directive points to the/auth_key_check
location for key file access authorization.
-
-
location = /auth_key_check
: This is the endpoint that verifies whether the request for the.key
file is authorized. It’s configured as an internal location to prevent direct access. Place it at the same level as the/live
location, within theserver
block.-
proxy_pass http://avideo/plugin/Live/authorizeKeyAccess.php;
:
Ensure thathttp://avideo/
is replaced with the base URL of your AVideo site. Your live server must have access to this URL for the authorization service to function correctly. -
proxy_set_header
directives: These headers pass client details (e.g., URI, IP, and User-Agent) to the authorization script (authorizeKeyAccess.php
) for validation.
-
Use these with caution. If you’re not familiar with them, it’s best to leave the defaults unchanged.
-
🌀 Adaptive Mode (
useAadaptiveMode
):
Default:false
Dynamically adjusts live stream quality based on bandwidth but uses more CPU. -
⏰ Auto End Live Streams (
autoFishLiveEveryHour
):
Default:false
Automatically ends sessions marked as live but offline. -
🛡️ Admin Control Buttons (
controllButtonsShowOnlyToAdmin_*
):
Configure whether control buttons (e.g., start/stop recording) are visible to admins only.
Publish using:
- Mobile devices.
- Desktop RTMP publisher software (e.g., OBS).
Currently, you cannot publish directly using your webcam via the website interface. For more details, see Publishing Live Streams.
The plugin allows saving live streams. Once a live stream ends, it can be sent to your encoder and stored in your video library. See more details on Saving Live Streams.
The plugin allows for unlimited simultaneous live streams and users, but hardware limitations may apply based on:
- Bandwidth
- Video Quality
For large audiences, a dedicated server is recommended.
If you plan to use Live PPV or secure your streams, the Protect Live feature is crucial. Ensure the VideoHLS Plugin is installed, and your NGINX is correctly configured as shown earlier. This setup blocks unauthorized access, ensuring that only legitimate viewers can watch your live streams.
Video Resolution | Bandwidth | 100 Mbps Users | 1 Gbps Users | YPT CDN Users |
---|---|---|---|---|
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 |
This feature dynamically adjusts video quality based on the viewer's bandwidth. For configuration details, see Adaptive Bitrates on Livestream.
Broadcast your live stream to multiple platforms (e.g., YouTube, Facebook) simultaneously. Edit the restreamer.json.php
file and ensure token authentication is configured.
The Control Module manages live stream controls (e.g., start/stop recording). Ensure your nginx.conf
contains:
http {
server {
location /control {
allow 127.0.0.1;
deny all;
rtmp_control all;
}
}
}
For more information, see the complete example nginx.conf.
Feature | Description |
---|---|
💰 Pay-Per-View (PPV) | Charge users for accessing live streams, enabling monetization of live events. Setup PPV. |
🔄 Restreaming | Broadcast your stream simultaneously to other platforms like YouTube or Facebook. Restream Guide. |
📼 Recording Live Streams | Save and store live broadcasts automatically for future viewing. Learn more. |
⚙️ Adaptive Bitrates | Dynamically adjust stream quality based on the viewer's bandwidth for optimal viewing experience. Setup Guide. |
🗓️ Livestream Playlists | Schedule video playlists to stream live, allowing for automated broadcasting. Details here. |
♻️ Rebroadcast Videos | Rebroadcast stored videos as live content, creating the effect of a live event for pre-recorded material. Rebroadcaster Guide. |