Skip to content

Commit

Permalink
WebRTC updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Jan 15, 2025
1 parent ce15e2a commit 2174593
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion plugin/Live/Live.php
Original file line number Diff line number Diff line change
Expand Up @@ -2556,7 +2556,7 @@ static function getTitleFromKey($key, $title = '')
$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;
Expand Down
Binary file modified plugin/WebRTC/assets/WebRTC2RTMP
Binary file not shown.
6 changes: 3 additions & 3 deletions plugin/WebRTC/assets/versionInfo.json
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions plugin/WebRTC/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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
Expand Down Expand Up @@ -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();
});
40 changes: 21 additions & 19 deletions view/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1333,19 +1333,21 @@ function avideoAlertOnceForceConfirm(title, msg, type) {
});
}

function _avideoToast(msg, icon) {
function _avideoToast(msg, icon, displayTime = 0) {
if (empty(msg)) {
msg = '';
}
try {
// 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

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
displayTime = Math.max(readingTimeInSeconds * 1000 + 2000, 7000); // Minimum display time of 7000ms

}
var options = { text: msg, hideAfter: displayTime };
if (icon) {
options.icon = icon;
Expand All @@ -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) {
Expand Down

0 comments on commit 2174593

Please sign in to comment.