🎥 Get started with Daily
Please check our our documentation site to get started. If you're building a web app with our daily-js
front-end JavaScript library, you may be particularly interested in:
⚠ Upcoming changes that may require action
Duplicate call instances will not be allowed
Today we do not support multiple call objects to be instantiated and running simultaneously. Doing so causes a smorgasbord of issues, some more obvious than others. After detecting this to be a common issue in development we will be making this setup impossible. Starting in 0.45.0, two currently unsupported behaviors will now throw an Error
instead of silently failing or simply logging the error. The constructor of a call will throw an Error
if another one exists and has not been destroyed. And attempting to use a call instance that has been destroyed will throw an Error
. To see if you are using multiple call objects or using a call after it has been detroyed, check your logs for Dual call object instances detected
, Duplicate call object instances detected
, or You are attempting to use a call instance that was previously destroyed
.
If you think this will affect you, you can turn on the 0.45.0 behavior and have an Error
thrown by passing adding strictMode: true
to your iframe properties passed in at construction:
try {
let call = DailyIframe.createCallObject({strictMode: true});
call = DailyIframe.createCallObject({strictMode: true});
} catch (e) {
console.error(e); // 'Error: Duplicate DailyIframe instances are not allowed'
console.log('more info about my code and where this happened');
}
try {
call.destroy();
call.join();
} catch (e) {
console.error(e); // 'Error: Use after destroy'
console.log('more info about my code and where this happened');
}
Please note, there are two supported ways of leaving and rejoining.
-
A single call instance can be re-used, so long as you properly await each call to ensure the prior action has completed:
await call.join();
await call.leave();
await call.join();
// rinse and repeat
-
Use a new call instance for each new join, but be sure to leave and destroy the prior one.
let call1 = DailyIframe.createCallObject({strictMode: true});
await call1.join({url: 'https://myDailyDomain.daily.co/myRoom'});
await call.destroy(); // this will also leave the call
let call2 = DailyIframe.createCallObject({strictMode: true});
await call2.join({url: 'https://myDailyDomain.daily.co/myRoom'});
Without the call to destroy()
, the above code would be unsupported and will throw an Error
.
Also of note: to help with the handling of this, we have introduced a new static method: getCallInstance()
so that you can get a handle to your call instance from anywhere in ase you lost track of it.
try {
call = DailyIframe.createCallObject({strictMode: true});
} catch (e) {
console.error(e); // 'Duplicate DailyIframe instances are not allowed'
console.log('more info about my code and where this happened');
call = DailyIframe.getCallInstance();
await call.destroy();
call = DailyIframe.createCallObject({strictMode: true});
// ^ should work now, though maybe you just wanted the handle and don't want to leave the call :)
}
avoidEval
will become true
by default
Today you can opt in to making daily-js
behave in a CSP-friendly way by specifying dailyConfig: { avoidEval: true }
wherever you provide your call options. You can read more about this option and how to set up your CSP (Content Security Policy) in this guide.
Starting in an upcoming version of daily-js
, avoidEval
will switch to defaulting to true
. To prepare for this change, please make sure that your CSP's script-src
directive contains https://*.daily.co
(or explicitly opt out of the new behavior by setting avoidEval: false
).