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

@100mslive/hms-video-store

Package Overview
Dependencies
Maintainers
13
Versions
730
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@100mslive/hms-video-store - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

dist/test/fakeStore.d.ts

6

dist/core/hmsSDKStore/HMSSDKActions.d.ts

@@ -48,2 +48,3 @@ import { HMSMessage } from '../schema';

private stopScreenShare;
private attachVideoInternal;
private setEnabledTrack;

@@ -76,3 +77,8 @@ /**

private getMediaSettings;
/**
* Tells if the trackID is for local peer and video unmute is in process
* @private
*/
private localAndVideoUnmuting;
private logPossibleInconsistency;
}

2

dist/core/selectors/selectors.d.ts
import { HMSMessage, HMSPeer, HMSPeerID, HMSRoom, HMSStore } from '../schema';
export declare const selectRoom: (store: HMSStore) => HMSRoom;
export declare const selectPeersMap: (store: HMSStore) => Record<HMSPeerID, HMSPeer>;

@@ -8,2 +9,3 @@ export declare const selectMessagesMap: (store: HMSStore) => Record<string, HMSMessage>;

export declare const selectMaxTilesCount: import("reselect").OutputSelector<HMSStore, number | undefined, (res: import("../schema").HMSMediaSettings) => number | undefined>;
export declare const selectSpeakers: (store: HMSStore) => Record<string, import("../schema").HMSSpeaker>;
export declare const selectIsConnectedToRoom: import("reselect").OutputSelector<HMSStore, boolean | undefined, (res: HMSRoom) => boolean | undefined>;

@@ -10,0 +12,0 @@ export declare const selectPeers: import("reselect").OutputSelector<HMSStore, HMSPeer[], (res1: HMSRoom, res2: Record<string, HMSPeer>) => HMSPeer[]>;

2

dist/hms-video-store.cjs.production.min.js

@@ -1,2 +0,2 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("reselect"),r=require("@100mslive/hms-video"),n=e(require("zustand/vanilla")),o=require("zustand/middleware"),i=e(require("immer"));function a(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)}))}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d,f,h=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new T(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=S(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function f(){}function h(){}var p={};p[o]=function(){return this};var v=Object.getPrototypeOf,y=v&&v(v(w([])));y&&y!==t&&r.call(y,o)&&(p=y);var g=h.prototype=d.prototype=Object.create(p);function m(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,s){var c=u(e[o],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function S(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function w(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return f.prototype=g.constructor=h,h.constructor=f,f.displayName=s(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,a,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},m(k.prototype),k.prototype[i]=function(){return this},e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},m(g),s(g,a,"Generator"),g[o]=function(){return this},g.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=w,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:w(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(f={exports:{}}),f.exports);(exports.HMSMessageType||(exports.HMSMessageType={})).CHAT="chat",function(e){e[e.PEER_JOINED=0]="PEER_JOINED",e[e.PEER_LEFT=1]="PEER_LEFT",e[e.AUDIO_TOGGLED=2]="AUDIO_TOGGLED",e[e.VIDEO_TOGGLED=3]="VIDEO_TOGGLED",e[e.BECAME_DOMINANT_SPEAKER=4]="BECAME_DOMINANT_SPEAKER",e[e.RESIGNED_DOMINANT_SPEAKER=5]="RESIGNED_DOMINANT_SPEAKER",e[e.STARTED_SPEAKING=6]="STARTED_SPEAKING",e[e.STOPPED_SPEAKING=7]="STOPPED_SPEAKING"}(d||(d={}));var p=function(){function e(){}return e.convertPeer=function(e){var t,r;return{id:e.peerId,name:e.name,role:e.role,isLocal:e.isLocal,videoTrack:null==(t=e.videoTrack)?void 0:t.trackId,audioTrack:null==(r=e.audioTrack)?void 0:r.trackId,auxiliaryTracks:e.auxiliaryTracks.map((function(e){return e.trackId}))}},e.convertTrack=function(e){return{id:e.trackId,source:e.source,type:e.type,enabled:e.enabled,displayEnabled:e.enabled}},e.convertRoom=function(e){return{id:e.id,name:e.name,hasWaitingRoom:e.hasWaitingRoom,shareableLink:e.shareableLink}},e.convertMessage=function(e){return{sender:e.sender,time:e.time,type:e.type,message:e.message}},e}();function v(e,t){return t&&t.auxiliaryTracks.some((function(t){return!(!t||!e.tracks[t])&&y(e.tracks[t])}))}function y(e){return e&&"video"===e.type&&"screen"===e.source}function g(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].enabled}var m=function(e){return e.room},k=function(e){return e.peers},S=function(e){return e.messages.byID},b=function(e){return e.messages.allIDs},x=function(e){return e.tracks},T=function(e){return e.settings},w=t.createSelector(T,(function(e){return e.maxTileCount})),I=function(e){return e.speakers},E=t.createSelector([m],(function(e){return e&&e.isConnected})),D=t.createSelector([m,k],(function(e,t){return e.peers.map((function(e){return t[e]}))})),L=t.createSelector(D,(function(e){return e.filter((function(e){return e.isLocal}))[0]})),P=t.createSelector(L,(function(e){return e.id})),M=t.createSelector(L,(function(e){return null==e?void 0:e.audioTrack})),A=t.createSelector(L,(function(e){return null==e?void 0:e.videoTrack})),O=t.createSelector(D,(function(e){return e.filter((function(e){return!e.isLocal}))})),_=t.createSelector(k,I,(function(e,t){var r=Object.entries(t).sort((function(e,t){var r,n,o=(null==(r=e[1])?void 0:r.audioLevel)||0;return((null==(n=t[1])?void 0:n.audioLevel)||0)>o?1:-1}));if(r.length>0&&r[0][1].audioLevel&&r[0][1].audioLevel>0){var n=r[0][0];if(n in e)return e[n].name}return null})),R=function(e){var t=L(e);return g(e,null==t?void 0:t.audioTrack)},N=function(e){var t=L(e);return g(e,null==t?void 0:t.videoTrack)},j=function(e){return v(e,L(e))},K=t.createSelector(b,(function(e){return e.length})),C=t.createSelector(S,(function(e){return Object.values(e).filter((function(e){return!e.read})).length})),G=t.createSelector(b,S,(function(e,t){var r=[];return e.forEach((function(e){r.push(t[e])})),r}));function H(e){return function(t){return function(r){return e(r,t)}}}var U=t.createSelector([k,function(e,t){return t}],(function(e,t){return t?e[t]:null})),J=H(U),V=H(t.createSelector(U,(function(e){return null==e?void 0:e.name}))),F=H(t.createSelector((function(e,t){return t?e.speakers[t]:null}),(function(e){return(null==e?void 0:e.audioLevel)||0}))),B=H((function(e,t){var r=U(e,t);if(r&&v(e,r)){var n=null==r?void 0:r.auxiliaryTracks.find((function(t){return y(e.tracks[t])}));return n?e.tracks[n]:void 0}})),W=H((function(e,t){var r=U(e,t);if(r&&r.videoTrack&&""!==r.videoTrack)return e.tracks[r.videoTrack]})),q=H((function(e,t){var r=U(e,t);return g(e,null==r?void 0:r.audioTrack)})),Y=H((function(e,t){var r=U(e,t);return g(e,null==r?void 0:r.videoTrack)})),z=t.createSelector([k,x],(function(e,t){return Object.values(e).map((function(e){var r;return{peer:e,isAudioEnabled:!!e.audioTrack&&(null==(r=t[e.audioTrack])?void 0:r.enabled)}}))})),$="HMS-Store:",Q=function(){function e(){}return e.d=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).debug.apply(e,[$].concat(r))},e.i=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).log.apply(e,[$].concat(r))},e.w=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).warn.apply(e,[$].concat(r))},e.e=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).error.apply(e,[$].concat(r))},e}(),X=function(e,t){return e&&t},Z=function(e,t){return e&&!t},ee=function(e,t){return!e&&t},te=function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},re=function(e,t){for(var r,n=new Set,o=l(e);!(r=o()).done;)n.add(r.value);for(var i,a=l(t);!(i=a()).done;)n.add(i.value);return Array.from(n)};function ne(e,t,r,n){e.isLocal&&e.videoTrack&&t.videoTrack&&e.videoTrack!==t.videoTrack&&(n[e.videoTrack]=n[t.videoTrack],delete n[t.videoTrack],r[e.videoTrack]=r[t.videoTrack],r[e.videoTrack].id=e.videoTrack,delete r[t.videoTrack],t.videoTrack=e.videoTrack)}var oe=function(){function e(e,t){this.hmsSDKTracks={},this.isRoomJoinCalled=!1,this.store=e,this.sdk=t}var t=e.prototype;return t.join=function(e){if(this.isRoomJoinCalled)this.logPossibleInconsistency("room join is called again");else try{this.sdkJoinWithListeners(e),this.isRoomJoinCalled=!0}catch(e){throw this.isRoomJoinCalled=!1,Q.e("Failed to connect to room - ",e),e}},t.leave=function(){var e=s(h.mark((function e(){var t=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState(E)){e.next=4;break}return this.logPossibleInconsistency("room leave is called when no room is connected"),e.abrupt("return");case 4:return e.abrupt("return",this.sdk.leave().then((function(){t.resetState(),Q.i("left room")})).catch((function(e){Q.e("error in leaving room - ",e)})));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setScreenShareEnabled=function(){var e=s(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,this.startScreenShare();case 3:e.next=7;break;case 5:return e.next=7,this.stopScreenShare();case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalAudioEnabled=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(M))){e.next=6;break}return this.store.getState(R)===t&&this.logPossibleInconsistency("local audio track muted states."),e.next=6,this.setEnabledTrack(r,t);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalVideoEnabled=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(A))){e.next=6;break}return this.store.getState(N)===t&&this.logPossibleInconsistency("local video track muted states."),e.next=6,this.setEnabledTrack(r,t);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setAudioSettings=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(M))){e.next=5;break}return e.next=4,this.setSDKLocalAudioTrackSettings(r,t);case 4:this.syncPeers();case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setVideoSettings=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(A))){e.next=5;break}return e.next=4,this.setSDKLocalVideoTrackSettings(r,t);case 4:this.syncPeers();case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.sendMessage=function(e){if(""!==e.trim()){var t=this.sdk.sendMessage(exports.HMSMessageType.CHAT,e),r=p.convertMessage(t);r.read=!0,r.senderName="You",this.onHMSMessage(r)}else Q.d("Ignoring empty message send")},t.setMessageRead=function(e,t){var r=this;this.store.setState((function(n){t?n.messages.byID[t]?n.messages.byID[t].read=e:r.logPossibleInconsistency("no message with id is found"):n.messages.allIDs.forEach((function(t){n.messages.byID[t].read=e}))}))},t.attachVideo=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=6;break}return e.next=4,n.addSink(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("no video track found to add sink");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.detachVideo=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=6;break}return e.next=4,n.removeSink(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("no video track found to remove sink");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.resetState=function(){this.store.setState((function(e){Object.assign(e,{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1},peers:{},tracks:{},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:"",maxTileCount:9}})})),this.isRoomJoinCalled=!1,this.hmsSDKTracks={}},t.sdkJoinWithListeners=function(e){this.sdk.join(e,{onJoin:this.onJoin.bind(this),onRoomUpdate:this.onRoomUpdate.bind(this),onPeerUpdate:this.onPeerUpdate.bind(this),onTrackUpdate:this.onTrackUpdate.bind(this),onMessageReceived:this.onMessageReceived.bind(this),onError:this.onError.bind(this)}),this.sdk.addAudioListener({onAudioLevelUpdate:this.onAudioLevelUpdate.bind(this)})},t.startScreenShare=function(){var e=s(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState(j)){e.next=7;break}return e.next=4,this.sdk.startScreenShare(this.syncPeers.bind(this));case 4:this.syncPeers(),e.next=8;break;case 7:this.logPossibleInconsistency("start screenshare is called while it's on");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.stopScreenShare=function(){var e=s(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.store.getState(j)){e.next=7;break}return e.next=4,this.sdk.stopScreenShare();case 4:this.syncPeers(),e.next=8;break;case 7:this.logPossibleInconsistency("stop screenshare is called while it's not on");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setEnabledTrack=function(){var e=s(h.mark((function e(t,r){var n=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.store.setState((function(e){e.tracks[t]?e.tracks[t].displayEnabled=r:n.logPossibleInconsistency("track id not found for setEnabled")})),e.prev=1,e.next=4,this.setEnabledSDKTrack(t,r);case 4:this.syncPeers(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),this.store.setState((function(e){e.tracks[t].displayEnabled=!r}));case 10:case"end":return e.stop()}}),e,this,[[1,7]])})));return function(t,r){return e.apply(this,arguments)}}(),t.syncPeers=function(){for(var e,t=this,r={},n=[],o={},i={},a={},s=l(this.sdk.getPeers());!(e=s()).done;){var c=e.value,u=p.convertPeer(c);r[u.id]=u,n.push(u.id);for(var d,f=l([c.audioTrack,c.videoTrack].concat(c.auxiliaryTracks));!(d=f()).done;){var h=d.value;if(h){var v=p.convertTrack(h);this.enrichHMSTrack(v,h),o[v.id]=v,i[h.trackId]=h}}u.isLocal&&Object.assign(a,this.getMediaSettings(c))}this.store.setState((function(e){e.room.peers=n;var s=e.tracks;!function(e,t,r,n){for(var o,i=l(re(Object.keys(e),Object.keys(t)));!(o=i()).done;){var a=o.value,s=e[a],c=t[a];X(s,c)?(te(s.auxiliaryTracks,c.auxiliaryTracks)&&(c.auxiliaryTracks=s.auxiliaryTracks),ne(s,c,r,n),Object.assign(s,c)):Z(s,c)?delete e[a]:ee(s,c)&&(e[a]=c)}}(e.peers,r,o,i),function(e,t){for(var r,n=l(re(Object.keys(e),Object.keys(t)));!(r=n()).done;){var o=r.value,i=e[o],a=t[o];X(i,a)?Object.assign(i,a):Z(i,a)?delete e[o]:ee(i,a)&&(e[o]=a)}}(s,o),Object.assign(e.settings,a),t.hmsSDKTracks=i}))},t.onJoin=function(e){this.store.setState((function(t){Object.assign(t.room,p.convertRoom(e)),t.room.isConnected=!0})),this.syncPeers()},t.onRoomUpdate=function(){this.syncPeers()},t.onPeerUpdate=function(e){e!==d.BECAME_DOMINANT_SPEAKER&&e!==d.RESIGNED_DOMINANT_SPEAKER&&this.syncPeers()},t.onTrackUpdate=function(){this.syncPeers()},t.onMessageReceived=function(e){var t=p.convertMessage(e);t.read=!1,t.senderName=this.store.getState(V(t.sender)),this.onHMSMessage(t)},t.onHMSMessage=function(e){var t=this;this.store.setState((function(r){e.id=String(t.store.getState(K)+1),r.messages.byID[e.id]=e,r.messages.allIDs.push(e.id)}))},t.onAudioLevelUpdate=function(e){this.store.setState((function(t){var r={};e.forEach((function(e){r[e.peerId]=e.audioLevel,t.speakers[e.peerId]||(t.speakers[e.peerId]={})}));for(var n=0,o=Object.entries(t.speakers);n<o.length;n++){var i=o[n],a=i[0],s=i[1];s.audioLevel=r[a]||0,0===s.audioLevel&&delete t.speakers[a]}}))},t.onError=function(e){1===Math.floor(e.code/1e3)&&this.leave().then((function(){return console.log("error from SDK, left room.")})),Q.e("received error from sdk",e)},t.setEnabledSDKTrack=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setEnabled(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("track "+t+" not present, unable to enabled/disable");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalVideoTrackSettings=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalAudioTrackSettings=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.enrichHMSTrack=function(e,t){var r=t.getMediaTrackSettings();e.height=r.height,e.width=r.width},t.getMediaSettings=function(e){var t,r,n,o;return{audioInputDeviceId:null==(t=e.audioTrack)||null==(r=t.settings)?void 0:r.deviceId,videoInputDeviceId:null==(n=e.audioTrack)||null==(o=n.settings)?void 0:o.deviceId}},t.logPossibleInconsistency=function(e){Q.w("possible inconsistency detected - ",e)},e}();exports.HMSReactiveStore=function(){function e(t,n){this.store=t||e.createNewHMSStore(),this.hmsActions=n||new oe(this.store,new r.HMSSdk)}var t=e.prototype;return t.getStore=function(){return c({},this.store,{setState:function(){throw new Error("Mutating store is not allowed")}})},t.getHMSActions=function(){return this.hmsActions},t.onNotification=function(){throw new Error("Not yet implemented")},e.createNewHMSStore=function(){var t=n(o.devtools(e.immerMiddleware((function(){return{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1},peers:{},tracks:{},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:"",maxTileCount:9}}})),"HMSStore")),r=t.setState;t.setState=function(e){return r(i(e))};var a=t.getState;return t.getState=function(e){return e?e(a()):a()},t},e.immerMiddleware=function(e){return function(t,r,n){return e((function(e){return t(i(e))}),r,n)}},e}(),exports.HMSSDKActions=oe,exports.createDefaultStoreState=function(){return{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1},peers:{},tracks:{},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:"",maxTileCount:9}}},exports.selectCameraStreamByPeerID=W,exports.selectDominantSpeakerName=_,exports.selectHMSMessages=G,exports.selectHMSMessagesCount=K,exports.selectIsConnectedToRoom=E,exports.selectIsLocalAudioEnabled=R,exports.selectIsLocalScreenShared=j,exports.selectIsLocalVideoDisplayEnabled=function(e){var t=L(e);return function(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].displayEnabled}(e,null==t?void 0:t.videoTrack)},exports.selectIsLocalVideoEnabled=N,exports.selectIsPeerAudioEnabled=q,exports.selectIsPeerVideoEnabled=Y,exports.selectIsSomeoneScreenSharing=function(e){return D(e).some((function(t){return v(e,t)}))},exports.selectLocalAudioTrackID=M,exports.selectLocalMediaSettings=T,exports.selectLocalPeer=L,exports.selectLocalPeerID=P,exports.selectLocalVideoTrackID=A,exports.selectMaxTilesCount=w,exports.selectMessageIDsInOrder=b,exports.selectMessagesMap=S,exports.selectPeerAudioByID=F,exports.selectPeerByID=J,exports.selectPeerNameByID=V,exports.selectPeerScreenSharing=function(e){return D(e).find((function(t){return v(e,t)}))},exports.selectPeers=D,exports.selectPeersMap=k,exports.selectPeersWithAudioStatus=z,exports.selectRemotePeers=O,exports.selectScreenShareByPeerID=B,exports.selectTracksMap=x,exports.selectUnreadHMSMessagesCount=C;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("reselect"),r=require("@100mslive/hms-video"),n=e(require("zustand/vanilla")),o=require("zustand/middleware"),i=e(require("immer"));function a(e,t,r,n,o,i,a){try{var s=e[i](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,o)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)}))}}function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function l(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return u(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var d,f,h=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new w(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=S(a,r);if(s){if(s===l)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function f(){}function h(){}var p={};p[o]=function(){return this};var v=Object.getPrototypeOf,g=v&&v(v(T([])));g&&g!==t&&r.call(g,o)&&(p=g);var y=h.prototype=d.prototype=Object.create(p);function k(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(o,i){function a(){return new t((function(n,a){!function n(o,i,a,s){var c=u(e[o],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(d).then((function(e){l.value=e,a(l)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}}function S(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,S(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function w(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function T(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:I}}function I(){return{value:void 0,done:!0}}return f.prototype=y.constructor=h,h.constructor=f,f.displayName=s(h,a,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,s(e,a,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},k(m.prototype),m.prototype[i]=function(){return this},e.AsyncIterator=m,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new m(c(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},k(y),s(y,a,"Generator"),y[o]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=T,w.prototype={constructor:w,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(s&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;x(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(f={exports:{}}),f.exports);(exports.HMSMessageType||(exports.HMSMessageType={})).CHAT="chat",function(e){e[e.PEER_JOINED=0]="PEER_JOINED",e[e.PEER_LEFT=1]="PEER_LEFT",e[e.AUDIO_TOGGLED=2]="AUDIO_TOGGLED",e[e.VIDEO_TOGGLED=3]="VIDEO_TOGGLED",e[e.BECAME_DOMINANT_SPEAKER=4]="BECAME_DOMINANT_SPEAKER",e[e.RESIGNED_DOMINANT_SPEAKER=5]="RESIGNED_DOMINANT_SPEAKER",e[e.STARTED_SPEAKING=6]="STARTED_SPEAKING",e[e.STOPPED_SPEAKING=7]="STOPPED_SPEAKING"}(d||(d={}));var p=function(){function e(){}return e.convertPeer=function(e){var t,r;return{id:e.peerId,name:e.name,role:e.role,isLocal:e.isLocal,videoTrack:null==(t=e.videoTrack)?void 0:t.trackId,audioTrack:null==(r=e.audioTrack)?void 0:r.trackId,auxiliaryTracks:e.auxiliaryTracks.map((function(e){return e.trackId}))}},e.convertTrack=function(e){return{id:e.trackId,source:e.source,type:e.type,enabled:e.enabled,displayEnabled:e.enabled}},e.convertRoom=function(e){return{id:e.id,name:e.name,hasWaitingRoom:e.hasWaitingRoom,shareableLink:e.shareableLink}},e.convertMessage=function(e){return{sender:e.sender,time:e.time,type:e.type,message:e.message}},e}();function v(e,t){return t&&t.auxiliaryTracks.some((function(t){return!(!t||!e.tracks[t])&&g(e.tracks[t])}))}function g(e){return e&&"video"===e.type&&"screen"===e.source}function y(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].enabled}var k=function(e){return e.room},m=function(e){return e.peers},S=function(e){return e.messages.byID},b=function(e){return e.messages.allIDs},x=function(e){return e.tracks},w=function(e){return e.settings},T=t.createSelector(w,(function(e){return e.maxTileCount})),I=function(e){return e.speakers},E=t.createSelector([k],(function(e){return e&&e.isConnected})),D=t.createSelector([k,m],(function(e,t){return e.peers.map((function(e){return t[e]}))})),L=t.createSelector(D,(function(e){return e.filter((function(e){return e.isLocal}))[0]})),P=t.createSelector(L,(function(e){return e.id})),M=t.createSelector(L,(function(e){return null==e?void 0:e.audioTrack})),A=t.createSelector(L,(function(e){return null==e?void 0:e.videoTrack})),O=t.createSelector(D,(function(e){return e.filter((function(e){return!e.isLocal}))})),_=t.createSelector(m,I,(function(e,t){var r=Object.entries(t).sort((function(e,t){var r,n,o=(null==(r=e[1])?void 0:r.audioLevel)||0;return((null==(n=t[1])?void 0:n.audioLevel)||0)>o?1:-1}));if(r.length>0&&r[0][1].audioLevel&&r[0][1].audioLevel>0){var n=r[0][0];if(n in e)return e[n].name}return null})),R=function(e){var t=L(e);return y(e,null==t?void 0:t.audioTrack)},N=function(e){var t=L(e);return y(e,null==t?void 0:t.videoTrack)},j=function(e){var t=L(e);return function(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].displayEnabled}(e,null==t?void 0:t.videoTrack)},K=function(e){return v(e,L(e))},C=t.createSelector(b,(function(e){return e.length})),G=t.createSelector(S,(function(e){return Object.values(e).filter((function(e){return!e.read})).length})),H=t.createSelector(b,S,(function(e,t){var r=[];return e.forEach((function(e){r.push(t[e])})),r}));function U(e){return function(t){return function(r){return e(r,t)}}}var V=t.createSelector([m,function(e,t){return t}],(function(e,t){return t?e[t]:null})),J=U(V),F=U(t.createSelector(V,(function(e){return null==e?void 0:e.name}))),B=U(t.createSelector((function(e,t){return t?e.speakers[t]:null}),(function(e){return(null==e?void 0:e.audioLevel)||0}))),W=U((function(e,t){var r=V(e,t);if(r&&v(e,r)){var n=null==r?void 0:r.auxiliaryTracks.find((function(t){return g(e.tracks[t])}));return n?e.tracks[n]:void 0}})),q=U((function(e,t){var r=V(e,t);if(r&&r.videoTrack&&""!==r.videoTrack)return e.tracks[r.videoTrack]})),Y=U((function(e,t){var r=V(e,t);return y(e,null==r?void 0:r.audioTrack)})),z=U((function(e,t){var r=V(e,t);return y(e,null==r?void 0:r.videoTrack)})),$=t.createSelector([m,x],(function(e,t){return Object.values(e).map((function(e){var r;return{peer:e,isAudioEnabled:!!e.audioTrack&&(null==(r=t[e.audioTrack])?void 0:r.enabled)}}))})),Q="HMS-Store:",X=function(){function e(){}return e.d=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).debug.apply(e,[Q].concat(r))},e.i=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).log.apply(e,[Q].concat(r))},e.w=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).warn.apply(e,[Q].concat(r))},e.e=function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=console).error.apply(e,[Q].concat(r))},e}(),Z=function(e,t){return e&&t},ee=function(e,t){return e&&!t},te=function(e,t){return!e&&t},re=function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},ne=function(e,t){for(var r,n=new Set,o=l(e);!(r=o()).done;)n.add(r.value);for(var i,a=l(t);!(i=a()).done;)n.add(i.value);return Array.from(n)};function oe(e,t,r,n){e.isLocal&&e.videoTrack&&t.videoTrack&&e.videoTrack!==t.videoTrack&&(n[e.videoTrack]=n[t.videoTrack],delete n[t.videoTrack],r[e.videoTrack]=r[t.videoTrack],r[e.videoTrack].id=e.videoTrack,delete r[t.videoTrack],t.videoTrack=e.videoTrack)}var ie=function(){function e(e,t){this.hmsSDKTracks={},this.isRoomJoinCalled=!1,this.store=e,this.sdk=t}var t=e.prototype;return t.join=function(e){if(this.isRoomJoinCalled)this.logPossibleInconsistency("room join is called again");else try{this.sdkJoinWithListeners(e),this.isRoomJoinCalled=!0}catch(e){throw this.isRoomJoinCalled=!1,X.e("Failed to connect to room - ",e),e}},t.leave=function(){var e=s(h.mark((function e(){var t=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState(E)){e.next=4;break}return this.logPossibleInconsistency("room leave is called when no room is connected"),e.abrupt("return");case 4:return e.abrupt("return",this.sdk.leave().then((function(){t.resetState(),X.i("left room")})).catch((function(e){X.e("error in leaving room - ",e)})));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setScreenShareEnabled=function(){var e=s(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,this.startScreenShare();case 3:e.next=7;break;case 5:return e.next=7,this.stopScreenShare();case 7:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalAudioEnabled=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(M))){e.next=6;break}return this.store.getState(R)===t&&this.logPossibleInconsistency("local audio track muted states."),e.next=6,this.setEnabledTrack(r,t);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalVideoEnabled=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(A))){e.next=6;break}return this.store.getState(N)===t&&this.logPossibleInconsistency("local video track muted states."),e.next=6,this.setEnabledTrack(r,t);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setAudioSettings=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(M))){e.next=5;break}return e.next=4,this.setSDKLocalAudioTrackSettings(r,t);case 4:this.syncPeers();case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setVideoSettings=function(){var e=s(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(A))){e.next=5;break}return e.next=4,this.setSDKLocalVideoTrackSettings(r,t);case 4:this.syncPeers();case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.sendMessage=function(e){if(""!==e.trim()){var t=this.sdk.sendMessage(exports.HMSMessageType.CHAT,e),r=p.convertMessage(t);r.read=!0,r.senderName="You",this.onHMSMessage(r)}else X.d("Ignoring empty message send")},t.setMessageRead=function(e,t){var r=this;this.store.setState((function(n){t?n.messages.byID[t]?n.messages.byID[t].read=e:r.logPossibleInconsistency("no message with id is found"):n.messages.allIDs.forEach((function(t){n.messages.byID[t].read=e}))}))},t.attachVideo=function(){var e=s(h.mark((function e(t,r){var n=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.localAndVideoUnmuting(t)){e.next=4;break}return e.abrupt("return",new Promise((function(e){var o=n.store.subscribe(function(){var i=s(h.mark((function i(a){return h.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!a){i.next=5;break}return i.next=3,n.attachVideoInternal(t,r);case 3:o(),e();case 5:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}(),N)})));case 4:return e.next=6,this.attachVideoInternal(t,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.detachVideo=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=6;break}return e.next=4,n.removeSink(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("no video track found to remove sink");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.resetState=function(){this.store.setState((function(e){Object.assign(e,{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1},peers:{},tracks:{},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:"",maxTileCount:9}})})),this.isRoomJoinCalled=!1,this.hmsSDKTracks={}},t.sdkJoinWithListeners=function(e){this.sdk.join(e,{onJoin:this.onJoin.bind(this),onRoomUpdate:this.onRoomUpdate.bind(this),onPeerUpdate:this.onPeerUpdate.bind(this),onTrackUpdate:this.onTrackUpdate.bind(this),onMessageReceived:this.onMessageReceived.bind(this),onError:this.onError.bind(this)}),this.sdk.addAudioListener({onAudioLevelUpdate:this.onAudioLevelUpdate.bind(this)})},t.startScreenShare=function(){var e=s(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState(K)){e.next=7;break}return e.next=4,this.sdk.startScreenShare(this.syncPeers.bind(this));case 4:this.syncPeers(),e.next=8;break;case 7:this.logPossibleInconsistency("start screenshare is called while it's on");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.stopScreenShare=function(){var e=s(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.store.getState(K)){e.next=7;break}return e.next=4,this.sdk.stopScreenShare();case 4:this.syncPeers(),e.next=8;break;case 7:this.logPossibleInconsistency("stop screenshare is called while it's not on");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.attachVideoInternal=function(){var e=s(h.mark((function e(t,r){var n,o,i;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=11;break}if(!(null!==(o=r.srcObject)&&o instanceof MediaStream)){e.next=7;break}if((null==(i=o.getVideoTracks()[0])?void 0:i.id)!==n.trackId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,n.addSink(r);case 9:e.next=12;break;case 11:this.logPossibleInconsistency("no video track found to add sink");case 12:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setEnabledTrack=function(){var e=s(h.mark((function e(t,r){var n=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.store.setState((function(e){e.tracks[t]?e.tracks[t].displayEnabled=r:n.logPossibleInconsistency("track id not found for setEnabled")})),e.prev=1,e.next=4,this.setEnabledSDKTrack(t,r);case 4:this.syncPeers(),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),this.store.setState((function(e){e.tracks[t].displayEnabled=!r}));case 10:case"end":return e.stop()}}),e,this,[[1,7]])})));return function(t,r){return e.apply(this,arguments)}}(),t.syncPeers=function(){for(var e,t=this,r={},n=[],o={},i={},a={},s=l(this.sdk.getPeers());!(e=s()).done;){var c=e.value,u=p.convertPeer(c);r[u.id]=u,n.push(u.id);for(var d,f=l([c.audioTrack,c.videoTrack].concat(c.auxiliaryTracks));!(d=f()).done;){var h=d.value;if(h){var v=p.convertTrack(h);this.enrichHMSTrack(v,h),o[v.id]=v,i[h.trackId]=h}}u.isLocal&&Object.assign(a,this.getMediaSettings(c))}this.store.setState((function(e){e.room.peers=n;var s=e.tracks;!function(e,t,r,n){for(var o,i=l(ne(Object.keys(e),Object.keys(t)));!(o=i()).done;){var a=o.value,s=e[a],c=t[a];Z(s,c)?(re(s.auxiliaryTracks,c.auxiliaryTracks)&&(c.auxiliaryTracks=s.auxiliaryTracks),oe(s,c,r,n),Object.assign(s,c)):ee(s,c)?delete e[a]:te(s,c)&&(e[a]=c)}}(e.peers,r,o,i),function(e,t){for(var r,n=l(ne(Object.keys(e),Object.keys(t)));!(r=n()).done;){var o=r.value,i=e[o],a=t[o];Z(i,a)?Object.assign(i,a):ee(i,a)?delete e[o]:te(i,a)&&(e[o]=a)}}(s,o),Object.assign(e.settings,a),t.hmsSDKTracks=i}))},t.onJoin=function(e){this.store.setState((function(t){Object.assign(t.room,p.convertRoom(e)),t.room.isConnected=!0})),this.syncPeers()},t.onRoomUpdate=function(){this.syncPeers()},t.onPeerUpdate=function(e){e!==d.BECAME_DOMINANT_SPEAKER&&e!==d.RESIGNED_DOMINANT_SPEAKER&&this.syncPeers()},t.onTrackUpdate=function(){this.syncPeers()},t.onMessageReceived=function(e){var t=p.convertMessage(e);t.read=!1,t.senderName=this.store.getState(F(t.sender)),this.onHMSMessage(t)},t.onHMSMessage=function(e){var t=this;this.store.setState((function(r){e.id=String(t.store.getState(C)+1),r.messages.byID[e.id]=e,r.messages.allIDs.push(e.id)}))},t.onAudioLevelUpdate=function(e){this.store.setState((function(t){var r={};e.forEach((function(e){r[e.peerId]=e.audioLevel,t.speakers[e.peerId]||(t.speakers[e.peerId]={})}));for(var n=0,o=Object.entries(t.speakers);n<o.length;n++){var i=o[n],a=i[0],s=i[1];s.audioLevel=r[a]||0,0===s.audioLevel&&delete t.speakers[a]}}))},t.onError=function(e){1===Math.floor(e.code/1e3)&&this.leave().then((function(){return console.log("error from SDK, left room.")})),X.e("received error from sdk",e)},t.setEnabledSDKTrack=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setEnabled(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("track "+t+" not present, unable to enabled/disable");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalVideoTrackSettings=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalAudioTrackSettings=function(){var e=s(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.enrichHMSTrack=function(e,t){var r=t.getMediaTrackSettings();e.height=r.height,e.width=r.width},t.getMediaSettings=function(e){var t,r,n,o;return{audioInputDeviceId:null==(t=e.audioTrack)||null==(r=t.settings)?void 0:r.deviceId,videoInputDeviceId:null==(n=e.audioTrack)||null==(o=n.settings)?void 0:o.deviceId}},t.localAndVideoUnmuting=function(e){if(this.store.getState(L).videoTrack!==e)return!1;var t=this.store.getState(j),r=this.store.getState(N);return t&&!r},t.logPossibleInconsistency=function(e){X.w("possible inconsistency detected - ",e)},e}();exports.HMSReactiveStore=function(){function e(t,n){this.store=t||e.createNewHMSStore(),this.hmsActions=n||new ie(this.store,new r.HMSSdk)}var t=e.prototype;return t.getStore=function(){return c({},this.store,{setState:function(){throw new Error("Mutating store is not allowed")}})},t.getHMSActions=function(){return this.hmsActions},t.onNotification=function(){throw new Error("Not yet implemented")},e.createNewHMSStore=function(){var t=n(o.devtools(e.immerMiddleware((function(){return{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1},peers:{},tracks:{},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:"",maxTileCount:9}}})),"HMSStore")),r=t.setState;t.setState=function(e){return r(i(e))};var a=t.getState;return t.getState=function(e){return e?e(a()):a()},t},e.immerMiddleware=function(e){return function(t,r,n){return e((function(e){return t(i(e))}),r,n)}},e}(),exports.HMSSDKActions=ie,exports.createDefaultStoreState=function(){return{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1},peers:{},tracks:{},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:"",maxTileCount:9}}},exports.selectCameraStreamByPeerID=q,exports.selectDominantSpeakerName=_,exports.selectHMSMessages=H,exports.selectHMSMessagesCount=C,exports.selectIsConnectedToRoom=E,exports.selectIsLocalAudioEnabled=R,exports.selectIsLocalScreenShared=K,exports.selectIsLocalVideoDisplayEnabled=j,exports.selectIsLocalVideoEnabled=N,exports.selectIsPeerAudioEnabled=Y,exports.selectIsPeerVideoEnabled=z,exports.selectIsSomeoneScreenSharing=function(e){return D(e).some((function(t){return v(e,t)}))},exports.selectLocalAudioTrackID=M,exports.selectLocalMediaSettings=w,exports.selectLocalPeer=L,exports.selectLocalPeerID=P,exports.selectLocalVideoTrackID=A,exports.selectMaxTilesCount=T,exports.selectMessageIDsInOrder=b,exports.selectMessagesMap=S,exports.selectPeerAudioByID=B,exports.selectPeerByID=J,exports.selectPeerNameByID=F,exports.selectPeerScreenSharing=function(e){return D(e).find((function(t){return v(e,t)}))},exports.selectPeers=D,exports.selectPeersMap=m,exports.selectPeersWithAudioStatus=$,exports.selectRemotePeers=O,exports.selectRoom=k,exports.selectScreenShareByPeerID=W,exports.selectSpeakers=I,exports.selectTracksMap=x,exports.selectUnreadHMSMessagesCount=G;
//# sourceMappingURL=hms-video-store.cjs.production.min.js.map
{
"version": "0.1.11",
"version": "0.1.12",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

# 100ms Reactive Store
[![NPM](https://badgen.net/npm/v/@100mslive/hms-video-store?color=green)](https://www.npmjs.com/package/@100mslive/hms-video-store)
![Test](https://github.com/100mslive/hms-video-store/actions/workflows/main.yaml/badge.svg)
![Size](https://github.com/100mslive/hms-video-store/actions/workflows/size.yml/badge.svg)
[![Publish](https://github.com/100mslive/hms-video-store/actions/workflows/npm-publish.yml/badge.svg)](https://www.npmjs.com/package/@100mslive/hms-video-store)
[![Bundle Size](https://badgen.net/bundlephobia/minzip/@100mslive/hms-video-store)](https://bundlephobia.com/result?p=@100mslive/hms-video-store)

@@ -19,4 +18,4 @@ ![Tree shaking](https://badgen.net/bundlephobia/tree-shaking/@100mslive/hms-video-store)

itself can be taken from multiple different places in the UI or even by a remote
participant. Local states and improper handling of actions or missing corner cases,
state duplication etc. have a high potential to make the data mutually inconsistent
participant. Local states and improper handling of actions or missing corner cases,
state duplication etc. have a high potential to make the data mutually inconsistent
and out of sync with the source of truth.

@@ -29,18 +28,18 @@

There are two important pieces, store for what you want to show and actions for what
you want to do -
There are two important pieces, store for what you want to show and actions for what
you want to do -
1. Store - The core store interface for reading data usually using selectors. The store
acts as a single source of truth for any data related to the room. There are two exposed
functions -
functions -
* getState(selector) -> get the current state of the UI, true at the time of function call
* subscribe(callback, selector) -> subscribe to a portion of the state selected by the
passed in selector such that whenever the portion changes, the passed in callback is notified.
passed in selector such that whenever the portion changes, the passed in callback is notified.
2. Actions - The actions interface for dispatching actions which in turn may reach
out to server and update the store. Check the interface with detailed doc
[here](src/core/IHMSActions.ts).
out to server and update the store. Check the interface with detailed doc
[here](src/core/IHMSActions.ts).
We also provide optimized and efficient selectors for most common use cases. These are
available in [this folder](src/core/selectors).
Important Note: The data received from either getState or Subscribe is immutable, the
Important Note: The data received from either getState or Subscribe is immutable, the
object received is frozen, and it is not allowed to mutate it. You'll get an error

@@ -85,9 +84,9 @@ if you try to mutate this data in any way. Immutability of the store is how we ensure

const hmsActions = useHMSActions();
return <>
{
!isConnected &&
!isConnected &&
<Button onClick={hmsActions.join()}>Join</Button>
}
</>
</>
}

@@ -94,0 +93,0 @@ ```

@@ -0,0 +0,0 @@ const HMS_STORE_TAG = 'HMS-Store:';

@@ -0,0 +0,0 @@ import { HMSPeer, HMSMessage, HMSTrack, HMSRoom } from '../schema';

@@ -0,0 +0,0 @@ import { IHMSActions } from '../IHMSActions';

@@ -23,2 +23,4 @@ import {

selectIsConnectedToRoom,
selectIsLocalVideoDisplayEnabled,
selectLocalPeer,
} from '../selectors';

@@ -176,7 +178,15 @@ import { HMSLogger } from '../../common/ui-logger';

async attachVideo(trackID: string, videoElement: HTMLVideoElement) {
const sdkTrack = this.hmsSDKTracks[trackID];
if (sdkTrack && sdkTrack.type === 'video') {
await (sdkTrack as SDKHMSVideoTrack).addSink(videoElement);
if (this.localAndVideoUnmuting(trackID)) {
// wait till video unmute has finished
return new Promise<void>(resolve => {
const unsub = this.store.subscribe(async enabled => {
if (enabled) {
await this.attachVideoInternal(trackID, videoElement);
unsub();
resolve();
}
}, selectIsLocalVideoEnabled);
});
} else {
this.logPossibleInconsistency('no video track found to add sink');
await this.attachVideoInternal(trackID, videoElement);
}

@@ -236,2 +246,19 @@ }

private async attachVideoInternal(trackID: string, videoElement: HTMLVideoElement) {
const sdkTrack = this.hmsSDKTracks[trackID];
if (sdkTrack && sdkTrack.type === 'video') {
const srcObject = videoElement.srcObject;
if (srcObject !== null && srcObject instanceof MediaStream) {
const existingTrackID = srcObject.getVideoTracks()[0]?.id;
if (existingTrackID === sdkTrack.trackId) {
// it's already attached, attaching again would just cause flickering
return;
}
}
await (sdkTrack as SDKHMSVideoTrack).addSink(videoElement);
} else {
this.logPossibleInconsistency('no video track found to add sink');
}
}
private async setEnabledTrack(trackID: string, enabled: boolean) {

@@ -434,2 +461,16 @@ this.store.setState(store => {

/**
* Tells if the trackID is for local peer and video unmute is in process
* @private
*/
private localAndVideoUnmuting(trackID: string) {
const localPeer = this.store.getState(selectLocalPeer);
if (localPeer.videoTrack !== trackID) {
return false;
}
const displayEnabled = this.store.getState(selectIsLocalVideoDisplayEnabled);
const actuallyEnabled = this.store.getState(selectIsLocalVideoEnabled);
return displayEnabled && !actuallyEnabled;
}
private logPossibleInconsistency(inconsistency: string) {

@@ -436,0 +477,0 @@ HMSLogger.w('possible inconsistency detected - ', inconsistency);

@@ -0,0 +0,0 @@ import HMSPeer from '@100mslive/hms-video/dist/interfaces/hms-peer';

@@ -0,0 +0,0 @@ import { HMSPeer, HMSPeerID, HMSTrack, HMSTrackID } from '../../schema';

@@ -0,0 +0,0 @@ import { HMSAudioTrackSettings, HMSVideoTrackSettings } from './hmsSDKStore/sdkTypes';

@@ -0,0 +0,0 @@ import { HMSStore } from './schema';

@@ -0,0 +0,0 @@ export { IHMSStore, IHMSStoreReadOnly } from './IHMSStore';

@@ -0,0 +0,0 @@ export * from './schema';

@@ -0,0 +0,0 @@ import { HMSPeerID } from './peer';

@@ -0,0 +0,0 @@ export type HMSPeerID = string;

@@ -0,0 +0,0 @@ import { HMSPeerID } from './peer';

@@ -0,0 +0,0 @@ import { HMSPeer, HMSPeerID, HMSTrackID, HMSTrack, HMSSpeaker } from './peer';

@@ -0,0 +0,0 @@ export interface HMSMediaSettings {

@@ -0,0 +0,0 @@ export interface HMSComponentsStyle {

@@ -0,0 +0,0 @@ import { HMSPeer } from '../schema';

export * from './selectors';
export * from './selectorsByID';
export * from './derivedSelectors';

@@ -5,3 +5,3 @@ import { HMSMessage, HMSPeer, HMSPeerID, HMSRoom, HMSStore } from '../schema';

const selectRoom = (store: HMSStore): HMSRoom => store.room;
export const selectRoom = (store: HMSStore): HMSRoom => store.room;
export const selectPeersMap = (store: HMSStore): Record<HMSPeerID, HMSPeer> => store.peers;

@@ -20,3 +20,3 @@

const selectSpeakers = (store: HMSStore) => {
export const selectSpeakers = (store: HMSStore) => {
return store.speakers;

@@ -23,0 +23,0 @@ };

@@ -0,0 +0,0 @@ import { createSelector } from 'reselect';

@@ -0,0 +0,0 @@ import { HMSPeer, HMSStore, HMSTrack } from '../schema';

export * from './core';

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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