@daily-co/daily-js
Advanced tools
Comparing version 0.44.1 to 0.45.0
@@ -43,2 +43,3 @@ // Type definitions for daily-js | ||
| 'left-meeting' | ||
| 'call-instance-destroyed' | ||
| 'participant-joined' | ||
@@ -336,2 +337,3 @@ | 'participant-updated' | ||
receiveSettings?: DailyReceiveSettings; | ||
sendSettings?: DailySendSettings; | ||
inputSettings?: DailyInputSettings; | ||
@@ -611,2 +613,3 @@ userName?: string; | ||
| 'bandwidth-optimized' | ||
| 'bandwidth-and-quality-balanced' | ||
| 'quality-optimized'; | ||
@@ -806,2 +809,3 @@ | ||
| 'left-meeting' | ||
| 'call-instance-destroyed' | ||
| 'recording-stats' | ||
@@ -808,0 +812,0 @@ | 'recording-upload-completed' |
{ | ||
"name": "@daily-co/daily-js", | ||
"version": "0.44.1", | ||
"version": "0.45.0", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
@@ -10,66 +10,2 @@ # 🎥 Get started with Daily | ||
## 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. | ||
1. 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 | ||
``` | ||
2. 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 | ||
@@ -76,0 +12,0 @@ |
@@ -41,2 +41,4 @@ // | ||
'bandwidth-optimized'; | ||
export const MEDIUM_BANDWIDTH_VIDEO_SEND_SETTINGS_PRESET_KEY = | ||
'bandwidth-and-quality-balanced'; | ||
export const DEFAULT_VIDEO_SEND_SETTINGS_PRESET_KEY = 'default'; | ||
@@ -43,0 +45,0 @@ |
@@ -68,3 +68,4 @@ let deviceChangeListeners = new Map(); | ||
navigator.mediaDevices.removeEventListener('devicechange', systemListener); | ||
systemListener = null; | ||
} | ||
} |
// We need to mock the MediaStreamTrack class and the mediaDevices which are provided by the browser | ||
import { | ||
DEFAULT_VIDEO_SEND_SETTINGS_PRESET_KEY, | ||
HIGH_BANDWIDTH_VIDEO_SEND_SETTINGS_PRESET_KEY, | ||
LOW_BANDWIDTH_VIDEO_SEND_SETTINGS_PRESET_KEY, | ||
MEDIUM_BANDWIDTH_VIDEO_SEND_SETTINGS_PRESET_KEY, | ||
} from '../shared-with-pluot-core/CommonIncludes'; | ||
@@ -51,3 +53,3 @@ | ||
).toThrowError( | ||
'Video send settings should be either default, bandwidth-optimized or quality-optimized' | ||
'Video send settings should be either an object or one of the supported presets: default,bandwidth-optimized,bandwidth-and-quality-balanced,quality-optimized' | ||
); | ||
@@ -66,2 +68,14 @@ updateSendSettings = { | ||
).not.toThrow(); | ||
updateSendSettings = { | ||
video: MEDIUM_BANDWIDTH_VIDEO_SEND_SETTINGS_PRESET_KEY, | ||
}; | ||
expect(() => | ||
callObject.validateUpdateSendSettings(updateSendSettings) | ||
).not.toThrow(); | ||
updateSendSettings = { | ||
video: HIGH_BANDWIDTH_VIDEO_SEND_SETTINGS_PRESET_KEY, | ||
}; | ||
expect(() => | ||
callObject.validateUpdateSendSettings(updateSendSettings) | ||
).not.toThrow(); | ||
}); | ||
@@ -76,3 +90,3 @@ | ||
).toThrowError( | ||
'Video send settings should be either a preset (bandwidth-optimized, default, quality-optimized) or an object' | ||
'Video send settings should be either an object or one of the supported presets: default,bandwidth-optimized,bandwidth-and-quality-balanced,quality-optimized' | ||
); | ||
@@ -79,0 +93,0 @@ }); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
660660
44
9778
15