@lyno/client-sdk
v2.10.5
Published
* State saved in react context * SDK should be based on hooks and not provide any frontend code
Downloads
6
Readme
Lyno Client SDK
State saved in react context
SDK should be based on hooks and not provide any frontend code
TODO: how to disconnect (connected variable and execute leave method on hangup?)
Notification should include user avatar with fallback to favicon
disconnect and reconnect if token has changed and already connected
electron events on leave to trigger window closing
Install
npm install react react-redux redux @lyno/client-sdk
# or
yarn add react react-redux redux @lyno/client-sdk
Usage
import { useLyno, Track, LynoProvider } from '@lyno/client-sdk';
const MyClient = () => {
const { connected, muted, setMuted, participants } = useLyno({
endpoint: process.env.JITSI_HOSTNAME,
token: 'hj85ingmg9950tjmmvdrpo90jgpo',
});
return connected ? (
<div>
{participants.map(({ avatar, tracks }) => (
<>
<image src={avatar} />
{tracks.map((track) => <Track track={track} />)}
</>
))}
<button onClick={() => setMuted(!muted)}>
{muted ? 'muted' : 'mute'}
</button>
</div>
): null;
};
const App = () => (
<LynoProvider>
<MyClient />
</LynoProvider>
);