@daily-co/daily-js
Advanced tools
Comparing version 0.9.3-beta.9 to 0.9.4-beta.1
{ | ||
"name": "@daily-co/daily-js", | ||
"version": "0.9.3-beta.9", | ||
"version": "0.9.4-beta.1", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=10.0.0" |
@@ -38,2 +38,4 @@ | ||
'local-screen-share-stopped'; | ||
export const DAILY_EVENT_ACTIVE_SPEAKER_CHANGE = 'active-speaker-change'; | ||
export const DAILY_EVENT_NETWORK_QUALITY_CHANGE = 'network-quality-change'; | ||
@@ -40,0 +42,0 @@ export const DAILY_EVENT_ERROR = 'error'; |
@@ -39,2 +39,4 @@ import EventEmitter from 'events'; | ||
DAILY_EVENT_LOCAL_SCREEN_SHARE_STOPPED, | ||
DAILY_EVENT_NETWORK_QUALITY_CHANGE, | ||
DAILY_EVENT_ACTIVE_SPEAKER_CHANGE, | ||
@@ -259,3 +261,4 @@ // internals | ||
this._inputEventsOn = {}; // need to cache these until loaded | ||
this._network = { threshold: 'good', quality: 100 }; | ||
this._activeSpeaker = {}; | ||
this._messageCallbacks = {}; | ||
@@ -436,3 +439,7 @@ this._callFrameId = Date.now() + Math.random().toString(); | ||
this._meetingState = DAILY_STATE_LOADING; | ||
this.emit(DAILY_EVENT_LOADING, { action: DAILY_EVENT_LOADING }); | ||
try { | ||
this.emit(DAILY_EVENT_LOADING, { action: DAILY_EVENT_LOADING }); | ||
} catch (e) { | ||
console.log("could not emit 'loading'"); | ||
} | ||
@@ -491,4 +498,8 @@ // non-iframe, callObjectMode ... load call-machine using script tag | ||
this._meetingState = DAILY_STATE_JOINING; | ||
this.emit(DAILY_EVENT_JOINING_MEETING, | ||
{ action: DAILY_EVENT_JOINING_MEETING }); | ||
try { | ||
this.emit(DAILY_EVENT_JOINING_MEETING, | ||
{ action: DAILY_EVENT_JOINING_MEETING }); | ||
} catch (e) { | ||
console.log("could not emit 'joining-meeting'"); | ||
} | ||
this._sendIframeMsg({ | ||
@@ -527,3 +538,7 @@ action: DAILY_METHOD_JOIN, | ||
this._participants = {}; | ||
this.emit(DAILY_STATE_LEFT, { action: DAILY_STATE_LEFT }); | ||
try { | ||
this.emit(DAILY_STATE_LEFT, { action: DAILY_STATE_LEFT }); | ||
} catch (e) { | ||
console.log("could not emit 'left-meeting'"); | ||
} | ||
resolve(); | ||
@@ -555,3 +570,3 @@ } | ||
let k = (msg) => { | ||
resolve({ stats: msg.stats }); | ||
resolve({ stats: msg.stats, ...this._network }); | ||
} | ||
@@ -562,2 +577,6 @@ this._sendIframeMsg({ action: DAILY_METHOD_GET_CALC_STATS }, k); | ||
getActiveSpeaker() { | ||
return this._activeSpeaker; | ||
} | ||
enumerateDevices(kind) { | ||
@@ -660,3 +679,7 @@ return new Promise((resolve, reject) => { | ||
} | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
break; | ||
@@ -668,3 +691,7 @@ case DAILY_EVENT_JOINED_MEETING: | ||
} | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
break; | ||
@@ -681,3 +708,7 @@ case DAILY_EVENT_PARTICIPANT_JOINED: | ||
this._participants[id] = { ...msg.participant }; | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
} | ||
@@ -690,3 +721,7 @@ } | ||
delete this._participants[msg.participant.session_id]; | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
} | ||
@@ -698,3 +733,7 @@ break; | ||
this._meetingState = DAILY_STATE_ERROR; | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
break; | ||
@@ -705,3 +744,7 @@ case DAILY_EVENT_LEFT_MEETING: | ||
} | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
break; | ||
@@ -717,6 +760,35 @@ case DAILY_EVENT_INPUT_EVENT: | ||
} | ||
this.emit(msg.event.type, { action: msg.event.type, | ||
event: msg.event, | ||
participant: {...p} }); | ||
try { | ||
this.emit(msg.event.type, { action: msg.event.type, | ||
event: msg.event, | ||
participant: {...p} }); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
break; | ||
case DAILY_EVENT_NETWORK_QUALITY_CHANGE: | ||
let { threshold, quality } = msg; | ||
if (threshold !== this._network.threshold || | ||
quality !== this._network.quality) { | ||
this._network.quality = quality; | ||
this._network.threshold = threshold; | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
} | ||
break; | ||
case DAILY_EVENT_ACTIVE_SPEAKER_CHANGE: | ||
let { activeSpeaker } = msg; | ||
if (this._activeSpeaker.peerId !== activeSpeaker.peerId) { | ||
this._activeSpeaker.peerId = activeSpeaker.peerId; | ||
try { | ||
this.emit(msg.action, { action: msg.action, | ||
activeSpeaker: this._activeSpeaker }); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
} | ||
break; | ||
case DAILY_EVENT_RECORDING_STARTED: | ||
@@ -732,3 +804,7 @@ case DAILY_EVENT_RECORDING_STOPPED: | ||
case DAILY_EVENT_LOCAL_SCREEN_SHARE_STOPPED: | ||
this.emit(msg.action, msg); | ||
try { | ||
this.emit(msg.action, msg); | ||
} catch (e) { | ||
console.log('could not emit', msg); | ||
} | ||
break; | ||
@@ -735,0 +811,0 @@ default: // no op |
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
2355338
1513