@daily-co/daily-js
Advanced tools
Comparing version 0.9.992-beta.0 to 0.9.992-beta.1
{ | ||
"name": "@daily-co/daily-js", | ||
"version": "0.9.992-beta.0", | ||
"version": "0.9.992-beta.1", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
@@ -82,2 +82,4 @@ import EventEmitter from 'events'; | ||
DAILY_METHOD_SET_PLAY_DING, | ||
DAILY_METHOD_SET_SUBSCRIBE_TO_TRACKS_AUTOMATICALLY, | ||
DAILY_CUSTOM_TRACK, | ||
@@ -92,2 +94,5 @@ DAILY_UI_REQUEST_FULLSCREEN, | ||
import CallObjectLoaderReactNative from './call-object-loaders/CallObjectLoaderReactNative.js'; | ||
import { | ||
getLocalIsSubscribedToTrack, | ||
} from './shared-with-pluot-core/selectors'; | ||
@@ -152,2 +157,13 @@ | ||
}, | ||
subscribeToTracksAutomatically: { | ||
validate: (s, callObject) => { | ||
if (!callObject._callObjectMode) { | ||
return false; | ||
} | ||
callObject._preloadCache.subscribeToTracksAutomatically = s; | ||
return true; | ||
}, | ||
help: 'can only be used with the createCallObject() constructor', | ||
}, | ||
// used internally | ||
@@ -196,3 +212,24 @@ layout: { | ||
}, | ||
setAudio: true, setVideo: true, eject: true | ||
setSubscribedTracks: { | ||
validate: (subs, callObject, participant) => { | ||
if (!callObject._callObjectMode) { | ||
return false; | ||
} | ||
if (callObject._preloadCache.subscribeToTracksAutomatically) { | ||
return false; | ||
} | ||
if (participant.local) { | ||
return false; | ||
} | ||
for (const s in subs) { | ||
if (!(s === 'audio' || s === 'video' || s === 'screenVideo')) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
}, | ||
help: 'setSubscribedTracks can only be used in call object mode, cannot be used on the local participant, cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: ' + | ||
'true | false | { [audio: true|false], [video: true|false], [screenVideo: true|false] }' | ||
}, | ||
setAudio: true, setVideo: true, eject: true, | ||
}; | ||
@@ -293,3 +330,11 @@ | ||
} | ||
return new DailyIframe(iframeEl, properties); | ||
try { | ||
let callFrame = new DailyIframe(iframeEl, properties); | ||
return callFrame; | ||
} catch (e) { | ||
// something when wrong while constructing the object. so let's clean | ||
// up by removing ourselves from the page, then rethrow the error. | ||
parentEl.removeChild(iframeEl); | ||
throw e; | ||
} | ||
} | ||
@@ -432,3 +477,7 @@ | ||
if (PARTICIPANT_PROPS[prop].validate) { | ||
if (!PARTICIPANT_PROPS[prop].validate(properties[prop])) { | ||
if (!PARTICIPANT_PROPS[prop].validate( | ||
properties[prop], | ||
this, | ||
this._participants[sessionId] | ||
)) { | ||
throw new Error(PARTICIPANT_PROPS[prop].help); | ||
@@ -779,2 +828,22 @@ } | ||
subscribeToTracksAutomatically() { | ||
methodNotSupportedInReactNative(); | ||
return this._preloadCache.subscribeToTracksAutomatically; | ||
} | ||
setSubscribeToTracksAutomatically(enabled) { | ||
methodNotSupportedInReactNative(); | ||
// only support this feature in call object mode | ||
if (!this._callObjectMode) { | ||
throw new Error('setSubscribeToTracksAutomatically() is only allowed in call object mode'); | ||
} | ||
if (this._meetingState !== DAILY_STATE_JOINED) { | ||
throw new Error('setSubscribeToTracksAutomatically() is only allowed while in a meeting'); | ||
} | ||
this._preloadCache.subscribeToTracksAutomatically = enabled; | ||
this.sendMessageToCallMachine({ | ||
action: DAILY_METHOD_SET_SUBSCRIBE_TO_TRACKS_AUTOMATICALLY, enabled | ||
}); | ||
} | ||
async enumerateDevices(kind) { | ||
@@ -1253,3 +1322,4 @@ methodNotSupportedInReactNative(); | ||
// find audio track | ||
if (p.audio) { | ||
if (p.audio && | ||
getLocalIsSubscribedToTrack(state, p.session_id, 'cam-audio')) { | ||
let audioTracks = orderBy(filter(allStreams, (s) => ( | ||
@@ -1276,3 +1346,4 @@ s.participantId === p.session_id && | ||
// find video track | ||
if (p.video) { | ||
if (p.video && | ||
getLocalIsSubscribedToTrack(state, p.session_id, 'cam-video')) { | ||
let videoTracks = orderBy(filter(allStreams, (s) => ( | ||
@@ -1295,3 +1366,4 @@ s.participantId === p.session_id && | ||
// find screen-share video track | ||
if (p.screen) { | ||
if (p.screen && | ||
getLocalIsSubscribedToTrack(state, p.session_id, 'screen-video')) { | ||
let screenVideoTracks = orderBy(filter(allStreams, (s) => ( | ||
@@ -1390,2 +1462,3 @@ s.participantId === p.session_id && | ||
return { | ||
subscribeToTracksAutomatically: true, | ||
audioDeviceId: null, | ||
@@ -1392,0 +1465,0 @@ videoDeviceId: null, |
@@ -89,4 +89,7 @@ | ||
export const DAILY_METHOD_SET_PLAY_DING = 'daily-method-set-play-ding'; | ||
export const DAILY_METHOD_SET_SUBSCRIBE_TO_TRACKS_AUTOMATICALLY = | ||
'daily-method-subscribe-to-tracks-automatically'; | ||
export const DAILY_CUSTOM_TRACK = 'daily-custom-track'; | ||
export const DAILY_UI_REQUEST_FULLSCREEN = 'request-fullscreen'; | ||
export const DAILY_UI_EXIT_FULLSCREEN = 'request-exit-fullscreen'; |
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
362852
27
2478