Utility Methods

Utility Methods

Other App Utility Methods for meeting use-case

NameType
setDisplayName(displayName: string)FunctionSet the display name of the current user
changeAvatarUrl(avatarUrl: string)FunctionSet the avatar url of the current user
sendData(peerIds: [] | "*", data: unknown)FunctionSend data to the specified peerIds or all peers if '*' is passed as peerIds

Example

<script src="https://unpkg.com/@huddle01/web-core@latest/dist/index.js"></script>
 
<body>
 
    <input type="text" id="displayName" placeholder="Enter Display Name" />
    <button id="setDisplayName">Set Display Name</button>
    <input type="text" id="avatarUrl" placeholder="Enter Avatar Url" />
    <button id="setAvatarUrl">Set Avatar Url</button>
    <input type="text" id="data" placeholder="Enter data" />
    <button id="sendData">Send Data</button>
 
</body>
 
<script>
 
document.getElementById('setDisplayName').addEventListener('click', () => {
    const displayName = document.getElementById('displayName').value;
    huddleClient.setDisplayName(displayName);
});
 
document.getElementById('setAvatarUrl').addEventListener('click', () => {
    const avatarUrl = document.getElementById('avatarUrl').value;
    huddleClient.changeAvatarUrl(avatarUrl);
});
 
document.getElementById('sendData').addEventListener('click', () => {
    const data = document.getElementById('data').value;
    huddleClient.sendData('*', data);
});
 
</script>
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2022 Graphene 01, Inc. All Rights Reserved.