Plugin Generate App TURN/STUN Support Request Install

“Live Stream Add-on For Sngine” Documentation by “Vanea Young” v1.1


“Live Stream Plugin For Sngine”

Created: 06/08/2022
By: Vanea Young
Support: Help Desk
Version: v1.0 [06/08/2022]

Thank you for purchasing my item. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!

How to install Guide

Attach the plugin to Sngine.
Step 1
Copy all the files & folders from Plugin folder to your /public_html/ directory where is located your sngine files.

[includes]
[content]
[cr-turnserver]
[vy-livestream]
*vy-livestream-cmd.php

Step 2
If you use apache, Open your .htaccess file, and find the code from below.

# Installer
RewriteRule ^install/?$ install.php [L,QSA]

After this add the following code.

# Live Plugin
RewriteRule ^livestream$ vy-livestream-cmd.php [QSA]
RewriteRule ^watchstream$ vy-livestream-cmd.php?cmd=watchstream [QSA]
Redirect 301 /live /livestream
RewriteRule ^livestream/g/([^\/]+)(\/|)$ vy-livestream-cmd.php?group_id=$1 [NC,QSA]
RewriteRule ^livestream/p/([^\/]+)(\/|)$ vy-livestream-cmd.php?page_id=$1 [NC,QSA]
RewriteRule ^livestream/up$ vy-livestream-cmd.php?cmd=blueimpupload [NC,QSA]
RewriteRule ^livestream/u/(.*)$ vy-livestream-cmd.php?cmd=openuser&id=$1 [NC,QSA]

If you use nginx, Open your nginx.conf file, and add the code from below.

# Live plugin
location = /live { return 301 /livestream; } 
rewrite ^/livestream$ /vy-livestream-cmd.php;
rewrite ^/watchstream$ /vy-livestream-cmd.php?cmd=watchstream;
rewrite ^/livestream/g/([^\/]+)(\/|)$ /vy-livestream-cmd.php?group_id=$1;
rewrite ^/livestream/p/([^\/]+)(\/|)$ /vy-livestream-cmd.php?page_id=$1;
rewrite ^/livestream/up$ /vy-livestream-cmd.php?cmd=blueimpupload;
rewrite ^/livestream/u/(.*)$ /vy-livestream-cmd.php?cmd=openuser&id=$1;

Step 3
Open your sngine _js_files.tpl file. You can find it here:

/content/themes/default/templates/_js_files.tpl

Go to end of file.. and above of below code:

{/strip}

Add this code:



{if $user->_logged_in}
{include file='../../../../vy-livestream/assets.html'}
{/if}
	

Step 4
Now please open this file > /content/themes/default/templates/__feeds_post.body.tpl, and search this line of code:


{elseif $_post['post_type'] == "live" && $_post['live']}


Before add the following code:


     {elseif $_post['post_type'] == "live" && $_post['vy-live'] == 'yes'}
 

      {include file="__feed_vy_livestream.tpl"}


Step 5
Open file /public_html/bootloader.php and find this code:
/* assign variables */
$smarty->assign('ads_master', $ads_master);

After, add the following code:


// include Live stream
$vy = array();
$vy['user'] = $user->_data;
require_once('includes/vaneayoung/LiveStream/classes/class.LiveStream.php');
$smarty->assign(["wo" => $vy, "vy" => $vy, "GLOBALS" => $GLOBALS, "live_stream" => new LIVE_STREAM]);
 


Step 6
Open file /includes/class-user.php and comment the following 3 lines of code:
      $agora = $this->agora_token_builder(false, $post['live']['agora_channel_name']);
      $post['live']['agora_audience_uid'] = $agora['uid'];
      $post['live']['agora_audience_token'] = $agora['token'];

Should look like in example from bellow:
	/*
      $agora = $this->agora_token_builder(false, $post['live']['agora_channel_name']);
      $post['live']['agora_audience_uid'] = $agora['uid'];
      $post['live']['agora_audience_token'] = $agora['token'];
     */

Step 7 (optional) [settings]
Go to /includes/vaneayoung/LiveStream/ini/config.ini file, and add your settings:

;<?php die('Direct access not allowed ;') ?>
;The above is for security, do not remove

[purchase code]
st__PURCHASE_KEY = YOUR_LICENSE_KEY

[THEME]
st__ORIGINAL_THEME_NAME = "default"; 


[TIMEZONE]
timezone = "Europe/Berlin"

[sngine tables]
tbl_users 		=	"`users`";
tbl_comments 		= 	"`posts_comments`";
tbl_notif 		= 	"`notifications`";
tbl_pages 		=	"`pages`";
tbl_groups 		=	"`groups`";
tbl_posts 		= 	"`posts`";
tbl_posts_live 		= 	"`posts_live`";
tbl_followers = "`followings`"; 

[live tables]
tbl_vy_lv_broadcasts = 	"`vy_live_broadcasts`";
tbl_vy_lv_config 	 =	"`vy_live_conf`";

[server url]
st__APP_SERVER_URL = ""; # your domain name where running nodejs application

[ports]
st__SERVER_PORT = ""; # port number
st__RTMP_PORT_TLS = ""; # port number
st__RTMP_PORT = "";# port number
st__RTMP_HTTP = "";# port number
st__RTMP_HTTPS = "";# port number
st__MEDIA_SERVER = "";# port number
st__MEDIA_SERVER_TLS = "";# port number


[plugin location]
st__PLUGIN_ASSETS = "/vy-livestream" ;

[default blank cover]
st__DEFAULT_BLANK = "/vy-livestream/blank.png";

[ffmpeg]
st__ffmpeg_path = "/usr/bin/ffmpeg"; # define ffmpeg location [ $ whereis ffmpeg ]

[sounds]
st__success = "sounds/success.mp3";
st__countdown2 = "sounds/countdown2.mp3";
st__countdown = "sounds/countdown.mp3";
st__clickuibut = "sounds/clickuibut.mp3";
st__openpopup = "sounds/openpopup.mp3";

[storage]
st__STORAGE_DIR = "content/uploads/vy-streams-media"; # the path where to save all the broadcast records
st__recording = 1; # record bool true|false
st__record_type = ".mp4"; # allowed format > [.mp4 or .webm], record video format webm or mp4 [this is only for local device streaming not for OBS]
st_mp4_high_quality = 0; #  this only works if record_type option is set to .mp4 value,
		             # if you enable this to true the video size will increase x4, 
			     # for example a 1 minute video size will be almost 100MB


[settings]
st__reconnecting_notif = 1; # by enabling this users with low network connection will face issue 
st__rtmp_enabled = 1; # RTMP ENABLED TRUE / FALSE
st__away_desktop = 0; # IF USER STREAMING FROM PC (DESKTOP) enable disable Away feature ( by default away feature is enabled only for mobiles )
st__audioBitsPerSecond = 128000; # AUDIO BITS PER SECOND
st__videoBitsPerSecond = 2500000;# VIDEO BITS PER SECOND
st__fr_miliseconds = 1000;# the number of milliseconds to record into each Blob
st__stream_secret = "22r2m6p13rra1w2022"; # stream secret, any word
st__stream_prefix = "VY"; #  stream key prefix
st__app_name = "live"; # define app name, you can leave it as default
st__hls = 1; # hls bool true/false
st__hlsFlags = "[hls_time=2:hls_list_size=3:hls_flags=delete_segments]"; # hls options
st__dash = 1; # dash bool true/false
st__dashFlags = "[f=dash:window_size=3:extra_window_size=5]"; # dash options
st__mp4Flags = "[movflags=faststart]"; # mp4 options 

Step 8
Please go to folder cr_turnserver, open file turnserver.json and populate these 3 lines:
      {
         "urls":"turn:YOUR_TURN_SERVER_URL:PORT", 
         "username":"YOUR_TURN_SERVER_USERNAME", 
         "credential":"YOUR_TURN_SERVER_CREDENTIAL" 
      }

Step 9
Now please go to your phpmyadmin and upload the SQL file
database.sql 

Step 10
The last step, you have to go to https://liveplugin.kontackt.de/setup.html and complete all the fields to get your Nodejs Application Server directly via your email.
https://liveplugin.kontackt.de/setup.html

STUN/TURN SERVER CONFIGURATION.
We Recommend to configure your own STUN/TURN SERVER, to do this you must run at least VPS.

Full Documentation URL: https://www.webrtc-experiment.com/docs/TURN-server-installation-guide.html#top