Skip to content

Commit

Permalink
[mirotalkbro] - #10 refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jan 20, 2025
1 parent 3cb5642 commit e5c99c1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @license For open source under AGPL-3.0
* @license For private project or commercial purposes contact us at: [email protected]
* @author Miroslav Pejic - [email protected]
* @version 1.1.17
* @version 1.1.18
*/

require('dotenv').config();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalkbro",
"version": "1.1.17",
"version": "1.1.18",
"description": "P2P WebRTC audio, video and screen live broadcast",
"main": "app/server.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions public/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ input:checked + .slider:before {
padding: 0.5rem;
}

a {
color: #0969b4;
}

.swal2-title,
.swal2-content {
background-color: var(--panel-color) !important;
Expand Down
2 changes: 1 addition & 1 deletion public/js/broadcast.js
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ function handleMediaDeviceError(error) {
if (screenShareEnabled) {
toggleScreen();
} else {
handleMediaStreamError('Audio/Video', error);
handleMediaStreamError(error);
}
}

Expand Down
22 changes: 4 additions & 18 deletions public/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function stopVideoTrack(mediaStream) {
}
}

function handleMediaStreamError(mediaStreamType, error) {
function handleMediaStreamError(error) {
let errorMessage = error;
let shouldHandleGetUserMediaError = true;

Expand All @@ -138,25 +138,11 @@ function handleMediaStreamError(mediaStreamType, error) {
break;
}

let popupContent = `
<ul style="text-align: left">
<li>Media type: ${mediaStreamType}</li>
<li>Error name: ${error.name}</li>
<li>
Error message:
<p style="color: red">${errorMessage}</p>
</li>`;

if (shouldHandleGetUserMediaError) {
popupContent += `
<li>Common: <a href="https://blog.addpipe.com/common-getusermedia-errors" target="_blank">getUserMedia errors</a></li>`;
errorMessage += `
Check the common <a href="https://blog.addpipe.com/common-getusermedia-errors" target="_blank">getUserMedia errors</a></li>`;
}

popupContent += `
</ul>
`;

popupMessage('warning', 'Access denied', popupContent, 'center');
popupMessage('warning', 'Ops', errorMessage, 'center');
}

function saveDataToFile(dataURL, fileName) {
Expand Down
2 changes: 1 addition & 1 deletion public/js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ async function getStream() {
return stream;
} catch (error) {
console.error('Failed to access media devices:', error.message);
handleMediaStreamError('Audio/Video', error);
handleMediaStreamError(error);
hideVideoAudioButtons();
return null;
}
Expand Down

0 comments on commit e5c99c1

Please sign in to comment.