Documentation Index
Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
Allow participants to share call invitations with others using the share invite feature.
By default, the share invite button is hidden. To show it:
const callSettings = {
hideShareInviteButton: false,
// ... other settings
};
Handle share invite button clicks to implement your sharing logic:
CometChatCalls.addEventListener("onShareInviteButtonClicked", () => {
console.log("Share invite button clicked");
// Implement your sharing logic
shareCallInvite();
});
Implementing Share Functionality
When the share invite button is clicked, you can implement various sharing methods:
Web Share API
Use the native Web Share API for mobile-friendly sharing:
async function shareCallInvite() {
const shareData = {
title: "Join my call",
text: "Click the link to join my video call",
url: `https://yourapp.com/call/${sessionId}`
};
if (navigator.share) {
try {
await navigator.share(shareData);
console.log("Shared successfully");
} catch (error) {
console.log("Share cancelled or failed");
}
} else {
// Fallback for browsers that don't support Web Share API
copyToClipboard(shareData.url);
}
}
Copy to Clipboard
Provide a simple copy-to-clipboard option:
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
console.log("Link copied to clipboard");
// Show a toast notification
}).catch(err => {
console.error("Failed to copy:", err);
});
}
Custom Share Dialog
Create a custom share dialog with multiple options:
function showShareDialog() {
const callLink = `https://yourapp.com/call/${sessionId}`;
// Show your custom dialog with options like:
// - Copy link
// - Share via email
// - Share via SMS
// - Share to social media
}