1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 17:59:55 +02:00

WebRTC updates

This commit is contained in:
Daniel Neto 2025-01-15 17:09:57 -03:00
parent ce15e2a380
commit 2174593665
5 changed files with 29 additions and 27 deletions

View file

@ -2556,7 +2556,7 @@ Click <a href=\"{link}\">here</a> to join our live.";
$playlists_id_live = $parameters['playlists_id_live'];
$live_index = $parameters['live_index'];
if (!empty($live_index) && $live_index !== 'false') {
$title .= " ({$live_index})";
$title .= " <small class=\"text-muted pull-right\">({$live_index})</small>";
}
return $title;

Binary file not shown.

View file

@ -1,5 +1,5 @@
{
"version": "4.4",
"date": "2025-01-15T19:31:31.025Z",
"phpTimestamp": 1736969491
"version": "4.5",
"date": "2025-01-15T20:09:31.152Z",
"phpTimestamp": 1736971771
}

View file

@ -39,7 +39,7 @@ socket.on('reconnect_attempt', () => {
// Handle live-start
socket.on('live-start', ({ rtmpURL }) => {
console.log('live-start', rtmpURL);
avideoToastSuccess(`Live streaming started successfully.`);
avideoToastSuccess(`<i class="fa-solid fa-sync fa-spin"></i> Live streaming connecting...`);
setIsLive();
requestNotifications();
});
@ -55,14 +55,14 @@ socket.on('live-resumed', ({ rtmpURL }) => {
// Handle live-stopped
socket.on('live-stopped', ({ rtmpURL, message }) => {
console.log('live-stopped', rtmpURL, message);
avideoToastWarning(`Live streaming stopped. Reason: ${message}`);
avideoToastWarning(`${message}`);
setIsNotLive();
requestNotifications();
});
socket.on('stream-will-stop', ({ rtmpURL, message }) => {
console.log('stream-will-stop', rtmpURL, message);
avideoToastWarning(` ${message}`);
avideoToastWarning(`<i class="fa-solid fa-triangle-exclamation fa-beat-fade"></i> ${message}`, 30000);
});
// Handle general errors
@ -110,7 +110,7 @@ socket.on('rtmp-status', ({ rtmpURL, isRunning }) => {
// Handle stream-stopped
socket.on('stream-stopped', ({ rtmpURL, reason }) => {
console.log(`Stream for ${rtmpURL} stopped: ${reason}`);
avideoToastWarning(`Stream stopped. Reason: ${reason}`);
avideoToastWarning(`Stream stopped. ${reason}`);
requestNotifications();
setIsNotLive();
});

View file

@ -1333,19 +1333,21 @@ function avideoAlertOnceForceConfirm(title, msg, type) {
});
}
function _avideoToast(msg, icon) {
function _avideoToast(msg, icon, displayTime = 0) {
if (empty(msg)) {
msg = '';
}
try {
if(displayTime == 0){
// Average reading speed: around 200 words per minute (or 3.3 words per second)
var wordsPerSecond = 2;
var words = msg.split(' ').length;
var readingTimeInSeconds = words / wordsPerSecond;
// Convert reading time to milliseconds and add a buffer time
var displayTime = Math.max(readingTimeInSeconds * 1000 + 2000, 7000); // Minimum display time of 7000ms
displayTime = Math.max(readingTimeInSeconds * 1000 + 2000, 7000); // Minimum display time of 7000ms
}
var options = { text: msg, hideAfter: displayTime };
if (icon) {
options.icon = icon;
@ -1356,20 +1358,20 @@ function _avideoToast(msg, icon) {
}
}
function avideoToast(msg) {
_avideoToast(msg, null);
function avideoToast(msg, displayTime = 0) {
_avideoToast(msg, null, displayTime);
}
function avideoToastInfo(msg) {
_avideoToast(msg, 'info');
function avideoToastInfo(msg, displayTime = 0) {
_avideoToast(msg, 'info', displayTime);
}
function avideoToastError(msg) {
_avideoToast(msg, 'error');
function avideoToastError(msg, displayTime = 0) {
_avideoToast(msg, 'error', displayTime);
}
function avideoToastSuccess(msg) {
_avideoToast(msg, 'success');
function avideoToastSuccess(msg, displayTime = 0) {
_avideoToast(msg, 'success', displayTime);
}
function avideoToastWarning(msg) {
_avideoToast(msg, 'warning');
function avideoToastWarning(msg, displayTime = 0) {
_avideoToast(msg, 'warning', displayTime);
}
function avideoAlertAJAXHTML(url) {