1 | import { isSfuSupported } from './shared-with-pluot-core/Environment';
|
2 |
|
3 | export function randomStringId() {
|
4 | return Date.now() + Math.random().toString();
|
5 | }
|
6 |
|
7 | export function notImplementedError() {
|
8 | throw new Error('Method must be implemented in subclass');
|
9 | }
|
10 |
|
11 | export function callObjectBundleUrl(meetingOrBaseUrl) {
|
12 |
|
13 |
|
14 |
|
15 | let baseUrl = meetingOrBaseUrl ? new URL(meetingOrBaseUrl).origin : null;
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | if (
|
22 | process.env.NODE_ENV === 'production' &&
|
23 | (!baseUrl || baseUrl.match(/https:\/\/[^.]+\.daily\.co/))
|
24 | ) {
|
25 | if (!isSfuSupported()) {
|
26 | return `https://c.daily.co/static/call-machine-object-nosfu-bundle.js`;
|
27 | } else {
|
28 | return `https://c.daily.co/static/call-machine-object-bundle.js`;
|
29 | }
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | if (!baseUrl) {
|
36 | console.warn(
|
37 | 'No baseUrl provided for call object bundle. Defaulting to production CDN...'
|
38 | );
|
39 | baseUrl = 'https://c.daily.co';
|
40 | }
|
41 | if (!isSfuSupported()) {
|
42 | return `${baseUrl}/static/call-machine-object-nosfu-bundle.js`;
|
43 | } else {
|
44 | return `${baseUrl}/static/call-machine-object-bundle.js`;
|
45 | }
|
46 | }
|