mediasfu-angular 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -405,7 +405,6 @@ const initialValuesState = {
|
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
class JoinRoomOnMediaSFU {
|
|
408
|
-
API_URL = 'https://mediasfu.com/v1/rooms/';
|
|
409
408
|
constructor() { }
|
|
410
409
|
/**
|
|
411
410
|
* Joins a room on MediaSFU.
|
|
@@ -426,11 +425,12 @@ class JoinRoomOnMediaSFU {
|
|
|
426
425
|
apiUserName.length < 6) {
|
|
427
426
|
return { data: { error: 'Invalid credentials' }, success: false };
|
|
428
427
|
}
|
|
428
|
+
let API_URL = 'https://mediasfu.com/v1/rooms/';
|
|
429
429
|
if (localLink && localLink.trim() !== '' && !localLink.includes('mediasfu.com')) {
|
|
430
430
|
localLink = localLink.replace(/\/$/, '');
|
|
431
|
-
|
|
431
|
+
API_URL = localLink + '/joinRoom';
|
|
432
432
|
}
|
|
433
|
-
const response = await fetch(
|
|
433
|
+
const response = await fetch(API_URL, {
|
|
434
434
|
method: 'POST',
|
|
435
435
|
headers: {
|
|
436
436
|
'Content-Type': 'application/json',
|
|
@@ -446,7 +446,7 @@ class JoinRoomOnMediaSFU {
|
|
|
446
446
|
return { data, success: true };
|
|
447
447
|
}
|
|
448
448
|
catch (error) {
|
|
449
|
-
const errorMessage = error.reason
|
|
449
|
+
const errorMessage = error.reason ? error.reason : 'unknown error';
|
|
450
450
|
return {
|
|
451
451
|
data: { error: `Unable to join room, ${errorMessage}` },
|
|
452
452
|
success: false,
|
|
@@ -474,7 +474,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.1", ngImpor
|
|
|
474
474
|
* @returns {Promise<{ data: CreateJoinRoomResponse | CreateJoinRoomError | null; success: boolean; }>} The response from the API.
|
|
475
475
|
*/
|
|
476
476
|
class CreateRoomOnMediaSFU {
|
|
477
|
-
API_URL = 'https://mediasfu.com/v1/rooms/';
|
|
478
477
|
constructor() { }
|
|
479
478
|
async createRoomOnMediaSFU({ payload, apiUserName, apiKey, localLink, }) {
|
|
480
479
|
try {
|
|
@@ -486,11 +485,12 @@ class CreateRoomOnMediaSFU {
|
|
|
486
485
|
apiUserName.length < 6) {
|
|
487
486
|
return { data: { error: 'Invalid credentials' }, success: false };
|
|
488
487
|
}
|
|
488
|
+
let API_URL = 'https://mediasfu.com/v1/rooms/';
|
|
489
489
|
if (localLink && localLink.trim() !== '' && !localLink.includes('mediasfu.com')) {
|
|
490
490
|
localLink = localLink.replace(/\/$/, '');
|
|
491
|
-
|
|
491
|
+
API_URL = localLink + '/createRoom';
|
|
492
492
|
}
|
|
493
|
-
const response = await fetch(
|
|
493
|
+
const response = await fetch(API_URL, {
|
|
494
494
|
method: 'POST',
|
|
495
495
|
headers: {
|
|
496
496
|
'Content-Type': 'application/json',
|