@teaminua/collabsdk
v0.0.21
Published
## Prerequisites ### 1. Familiarize yourself with Agora by reading the guide on [how to get started with Agora](https://www.agora.io/en/blog/how-to-get-started-with-agora/).
Downloads
143
Keywords
Readme
Getting started
Before you start integrating Agora into your Angular application, follow these steps to set up and use the Collabora SDK effectively.
Prerequisites
1. Familiarize yourself with Agora by reading the guide on how to get started with Agora.
Setup Instructions
Import CollaboraModule
In your Angular application, import
CollaboraModule
into yourapp.module.ts
:import { CollaboraModule } from '@teaminua/collabsdk'; @NgModule({ imports:[ CollaboraModule ] })
Utilize CollaboraService in Your Component
Import CollaboraService in your component and configure it with your Agora credentials:
// Import CollaboraService import { CollaboraService } from '@teaminua/collabsdk'; // Example initialization in your component this.collaboraService.init(); this.collaboraService.agoraAppId = '<your_agora_app_id>'; this.collaboraService.agoraToken = '<your_agora_token>'; this.collaboraService.agoraChannel = '<your_agora_channel>'; this.collaboraService.userId = '<user_id>'; this.collaboraService.usersInfo = <ICollaboraUser>{ uid: '<user_uid>', image: '<user_image>', name: '<user_name>', backgroundColor: '<color>' }; this.collaboraService.join();
ICollaboraUser
interface representation:interface ICollaboraUser { uid: string; image: string; name: string; backgroundColor: string; }
token
should be obtained from your backend. Learn how to obtain an Agora token from your backend
How to Obtain an Agora Token
Instructions are provided for Node.js, but you can also refer to the official Agora documentation for Node.js or GoLang for more details.
- Install
agora-access-token
packagenpm i agora-access-token
- Implement token generation in your project::
Learn how to generate an AGORA_APP_CERTIFICATE in your Agora console by following this guide.const { RtcTokenBuilder, RtcRole } = require('agora-access-token'); const appID = process.env.AGORA_APP_ID; const appCertificate = process.env.AGORA_APP_CERTIFICATE; const role = RtcRole.PUBLISHER; const createAgoraToken = (uid, channelName) => { const expirationTimeInSeconds = 3600; const currentTimestamp = Math.floor(Date.now() / 1000); const privilegeExpiredTs = currentTimestamp + expirationTimeInSeconds; return RtcTokenBuilder.buildTokenWithAccount(appID, appCertificate, channelName, uid, role, privilegeExpiredTs); } const getAgoraAppId = () => appID; module.exports = { createAgoraToken, getAgoraAppId };
- User collabsdk in your html
or if you want use sidebar<collabora></collabora>
<collabora-sidebar></collabora-sidebar>