quickom-sdk
v1.3.2
Published
Check if your browser support webrtc, if the result is false, we must alert user and stop ```js let supported = QuickomClient.isWebrtcSupported(); if (!supported) { alert('We\'re sorry, but this function is currently not supported in your browser. Pleas
Readme
Check if your browser support webrtc, if the result is false, we must alert user and stop
let supported = QuickomClient.isWebrtcSupported();
if (!supported) {
alert('We\'re sorry, but this function is currently not supported in your browser. Please update your browse, or use a different one');
return;
}Init Quickom Client
let quickomId = '57661562157491720';
let quickomClient = await QuickomClient.getInstance({
alias: quickomId,
});Listen error
quickomClient.on('error', (e) => {
console.error(e);
// Should destroy quickom client
quickomClient.destroy();
quickomClient = null;
});Listen local stream
quickomClient.on('localstream', stream => {
// Display your video
document.getElementsByTagName('video').srcObject = stream;
// document.getElementsByTagName('audio').srcObject = stream; // For audio only call
});Listen remote stream
quickomClient.on('remotestream', stream => {
// Display remote video
document.getElementsByTagName('video').srcObject = stream;
// document.getElementsByTagName('audio').srcObject = stream; // For audio only call
});Listen call hangup
quickomClient.on('hangup', () => {
});Listen call timeout
quickomClient.on('timeout', () => {
});Listen user busy
quickomClient.on('busy', () => {
});Make a call
let supportVideo = true; // false for audio only
let displayName = 'Peter';
quickomClient.startCalling(supportVideo, displayName);Request chat before sending any message
let displayName = 'Peter';
let rsp = await quickomClient.startChatting(displayName);Send text message
let textInput = 'hello';
await quickomClient.sendTextMessage(textInput);Send img message
let img = 'https://storage.googleapis.com/beowulf/media/Beowulf_Media_Kit/QUICKOM/QUICKOM_icon/QUICKOM_icon.jpg'; // base 64 img or img link
await quickomClient.sendImgMessage(img);Receive chat message
let onMessage = (msg) => {
console.log('msg');
};
quickomClient.on('message', onMessage);
// For stopping listening message
quickomClient.off('message', onMessage);Send msg status
quickomClient.on('message', (msg) => {
quickomClient.sendMessageStatus({
status: 'seen', // seen or delivered
msgId: msg.msgId,
});
});Hangup call
quickomClient.hangup();Destroy quickom client when we do not use it anymore
quickomClient.destroy();