Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@daily-co/daily-js

Package Overview
Dependencies
Maintainers
7
Versions
152
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daily-co/daily-js - npm Package Compare versions

Comparing version 0.9.992-beta.5 to 0.9.992-beta.6

wip-index.d.ts

2

package.json
{
"name": "@daily-co/daily-js",
"version": "0.9.992-beta.5",
"version": "0.9.992-beta.6",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=10.0.0"

import CallObjectLoader from "./CallObjectLoader";
import { callObjectBundleUrl } from "../utils";
const EMPTY_CALL_FRAME_ID = "";
function setUpDailyConfig() {

@@ -11,8 +13,22 @@ // The call object bundle expects a global _dailyConfig to already exist,

}
window._dailyConfig.callFrameId = "";
window._dailyConfig.callFrameId = EMPTY_CALL_FRAME_ID;
}
export default class CallObjectLoaderReactNative extends CallObjectLoader {
constructor() {
super();
this._callObjectScriptLoaded = false;
}
load(meetingUrl, _, callback) {
setUpDailyConfig();
// Call object script already loaded once, so no-op.
// This happens after leave()ing and join()ing again.
if (this._callObjectScriptLoaded) {
window._dailyCallObjectSetup(EMPTY_CALL_FRAME_ID);
callback(true); // true = "this load() was a no-op"
return;
}
// Load the call object
const url = callObjectBundleUrl(meetingUrl);

@@ -27,3 +43,4 @@ fetch(url)

.then(() => {
callback(false); // false = "wasn't no-op"
this._callObjectScriptLoaded = true;
callback(false); // false = "this load() wasn't a no-op"
})

@@ -30,0 +47,0 @@ .catch((e) => {

@@ -17,3 +17,3 @@ import CallObjectLoader from "./CallObjectLoader";

window._dailyCallObjectSetup(callFrameId);
callback(true); // true = "was no-op"
callback(true); // true = "this load() was a no-op"
} else {

@@ -23,3 +23,3 @@ // add a global callFrameId so we can have both iframes and one

if (!window._dailyConfig) {
window._dailyConfig = {}
window._dailyConfig = {};
}

@@ -32,3 +32,3 @@ window._dailyConfig.callFrameId = callFrameId;

this._callObjectScriptLoaded = true;
callback(false); // false = "wasn't no-op"
callback(false); // false = "this load() wasn't a no-op"
};

@@ -35,0 +35,0 @@ script.src = callObjectBundleUrl(meetingUrl);

@@ -162,10 +162,5 @@ import EventEmitter from 'events';

validate: (s, callObject) => {
if (!callObject._callObjectMode) {
return false;
}
callObject._preloadCache.subscribeToTracksAutomatically = s;
return true;
},
help: 'can only be used with the createCallObject() constructor',
},

@@ -217,5 +212,2 @@ // used internally

validate: (subs, callObject, participant) => {
if (!callObject._callObjectMode) {
return false;
}
if (callObject._preloadCache.subscribeToTracksAutomatically) {

@@ -227,2 +219,5 @@ return false;

}
if ([true, false, 'avatar'].includes(subs)) {
return true;
}
for (const s in subs) {

@@ -235,4 +230,4 @@ if (!(s === 'audio' || s === 'video' || s === 'screenVideo')) {

},
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] }'
help: 'setSubscribedTracks cannot be used on the local participant, cannot be used when setSubscribeToTracksAutomatically is enabled, and should be of the form: ' +
'true | \'avatar\' | false | { [audio: true|false], [video: true|false], [screenVideo: true|false] }'
},

@@ -253,3 +248,2 @@ setAudio: true, setVideo: true, eject: true,

static supportedBrowser() {
methodNotSupportedInReactNative();
return browserInfo();

@@ -263,3 +257,2 @@ }

static createCallObject(properties={}) {
methodNotSupportedInReactNative()
properties.layout = 'none';

@@ -369,3 +362,2 @@ return new DailyIframe(null, properties);

constructor(iframeish, properties={}) {
methodNotSupportedInReactNative()
super();

@@ -432,3 +424,2 @@ this._iframe = iframeish;

async destroy() {
methodNotSupportedInReactNative();
try {

@@ -463,3 +454,2 @@ if (this._meetingState === DAILY_STATE_JOINED) {

meetingState() {
methodNotSupportedInReactNative()
return this._meetingState;

@@ -469,3 +459,2 @@ }

participants() {
methodNotSupportedInReactNative();
return this._participants;

@@ -527,3 +516,2 @@ }

setLocalAudio(bool) {
methodNotSupportedInReactNative();
this.sendMessageToCallMachine({ action: DAILY_METHOD_LOCAL_AUDIO, state: bool });

@@ -534,3 +522,2 @@ return this;

setLocalVideo(bool) {
methodNotSupportedInReactNative();
this.sendMessageToCallMachine({ action: DAILY_METHOD_LOCAL_VIDEO, state: bool });

@@ -550,7 +537,7 @@ return this;

this.sendMessageToCallMachine({ action: DAILY_METHOD_SET_LANG, lang });
return this;
}
startCamera(properties={}) {
methodNotSupportedInReactNative();
return new Promise(async (resolve, reject) => {
return new Promise(async (resolve, _) => {
let k = (msg) => {

@@ -569,3 +556,2 @@ delete msg.action;

});
return this;
}

@@ -575,3 +561,3 @@

methodNotSupportedInReactNative();
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = (msg) => {

@@ -586,3 +572,3 @@ resolve({ device: msg.device });

methodNotSupportedInReactNative();
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = (msg) => {

@@ -668,3 +654,2 @@ resolve({ device: msg.device });

async load(properties) {
methodNotSupportedInReactNative()
if (properties) {

@@ -699,3 +684,3 @@ this.validateProperties(properties);

this._iframe.src = this.assembleMeetingUrl();
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
this._loadedCallback = () => {

@@ -717,3 +702,2 @@ this._meetingState = DAILY_STATE_LOADED;

async join(properties={}) {
methodNotSupportedInReactNative()
let newCss = false;

@@ -768,4 +752,3 @@ if (this.needsLoad()) {

async leave() {
methodNotSupportedInReactNative()
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = () => {

@@ -839,3 +822,3 @@ if (this._iframe) {

}
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = (msg) => {

@@ -871,6 +854,2 @@ resolve({ stats: msg.stats, ...this._network });

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) {

@@ -883,5 +862,6 @@ throw new Error('setSubscribeToTracksAutomatically() is only allowed while in a meeting');

});
return this;
}
async enumerateDevices(kind) {
async enumerateDevices() {
methodNotSupportedInReactNative();

@@ -893,7 +873,7 @@ if (this._callObjectMode) {

return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = (msg) => {
resolve({ devices: msg.devices });
}
this.sendMessageToCallMachine({ action: DAILY_METHOD_ENUMERATE_DEVICES, kind }, k);
this.sendMessageToCallMachine({ action: DAILY_METHOD_ENUMERATE_DEVICES }, k);
});

@@ -932,3 +912,3 @@ }

methodNotSupportedInReactNative();
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = (msg) => {

@@ -971,3 +951,3 @@ delete msg.action;

}
return new Promise((resolve, reject) => {
return new Promise((resolve, _) => {
let k = (msg) => {

@@ -984,3 +964,3 @@ delete msg.action;

methodNotSupportedInReactNative();
return new Promise(async (resolve, reject) => {
return new Promise(async (resolve, _) => {
try {

@@ -1024,3 +1004,2 @@ let url = 'https://gs.daily.co/_ks_/x-swsl/:';

on(eventName, k) {
methodNotSupportedInReactNative()
this._inputEventsOn[eventName] = {};

@@ -1037,3 +1016,2 @@ this.sendMessageToCallMachine({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER,

once(eventName, k) {
methodNotSupportedInReactNative();
this._inputEventsOn[eventName] = {};

@@ -1046,3 +1024,2 @@ this.sendMessageToCallMachine({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER,

off(eventName, k) {
methodNotSupportedInReactNative()
delete this._inputEventsOn[eventName];

@@ -1148,2 +1125,4 @@ this.sendMessageToCallMachine({ action: DAILY_METHOD_REGISTER_INPUT_HANDLER,

'screenVideoTrack');
this.maybeEventTrackStopped(this._participants[id], msg.participant,
'screenAudioTrack');
this.maybeEventTrackStarted(this._participants[id], msg.participant,

@@ -1155,2 +1134,4 @@ 'audioTrack');

'screenVideoTrack');
this.maybeEventTrackStarted(this._participants[id], msg.participant,
'screenAudioTrack');
} catch (e) {

@@ -1181,2 +1162,3 @@ console.error('track events error', e);

this.maybeEventTrackStopped(prevP, null, 'screenVideoTrack');
this.maybeEventTrackStopped(prevP, null, 'screenAudioTrack');
}

@@ -1338,3 +1320,5 @@ // delete from local cach

getVideoTracks()[0];
if (!p.screenVideoTrack) { p.screen = false };
p.screenAudioTrack = state.local.streams.screen.stream.
getAudioTracks()[0];
if (!(p.screenVideoTrack || p.screenAudioTrack)) { p.screen = false };
} catch (e) {}

@@ -1414,2 +1398,23 @@ }

}
// find screen-share audio track
if (p.screen &&
getLocalIsSubscribedToTrack(state, p.session_id, 'screen-audio')) {
let screenAudioTracks = orderBy(filter(allStreams, (s) => (
s.participantId === p.session_id &&
s.type === 'screen' &&
s.pendingTrack && s.pendingTrack.kind === 'audio'
)), 'starttime', 'desc');
if (screenAudioTracks && screenAudioTracks[0] &&
screenAudioTracks[0].pendingTrack) {
if (prevP && prevP.screenAudioTrack &&
prevP.screenAudioTrack.id ===
screenAudioTracks[0].pendingTrack.id) {
p.screenAudioTrack = screenAudioTracks[0].pendingTrack;
} else if (!screenAudioTracks[0].pendingTrack.muted) {
// otherwise, add the found track if it's not muted
p.screenAudioTrack = screenAudioTracks[0].pendingTrack;
}
}
}
// find screen-share video track

@@ -1431,7 +1436,14 @@ if (p.screen &&

// otherwise, add the found track if it's not muted
// note: there is an issue here with timing ... Chrome (and
// possibly other browsers), gets a video track that's initially
// not muted, for an audio-only screenshare. The track
// switches to muted fairly quickly, but we don't have any
// logic in place to respond to that. todo: fix this so that,
// at the very least we get a track-stopped event when the
// "empty" track switches to muted.
p.screenVideoTrack = screenVideoTracks[0].pendingTrack;
}
}
if (!p.screenVideoTrack) { p.screen = false };
}
if (!(p.screenVideoTrack || p.screenAudioTrack)) { p.screen = false };
} catch (e) {

@@ -1438,0 +1450,0 @@ console.error('unexpected error matching up tracks', e);

@@ -51,3 +51,3 @@ import ScriptMessageChannel from "./ScriptMessageChannel";

(!evt.data.from || evt.data.from === 'module') &&
(evt.data.callFrameId ? evt.data.callFrameId === callFrameId : true))) {
((evt.data.callFrameId && callFrameId) ? evt.data.callFrameId === callFrameId : true))) {
return;

@@ -54,0 +54,0 @@ }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc