0.0.24 • Published 1 month ago

@teaminua/collabsdk v0.0.24

Weekly downloads
-
License
-
Repository
-
Last release
1 month ago

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

  1. Import CollaboraModule

    In your Angular application, import CollaboraModule into your app.module.ts:

    import { CollaboraModule } from '@teaminua/collabsdk';
    @NgModule({
        imports:[
            CollaboraModule
        ]
    })
  2. 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.

  1. Install agora-access-token package
    npm i agora-access-token
  2. Implement token generation in your project::

    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
    };

    Learn how to generate an AGORA_APP_CERTIFICATE in your Agora console by following this guide.

  3. User collabsdk in your html

    <collabora></collabora>

    or if you want use sidebar

    <collabora-sidebar></collabora-sidebar>
0.0.23

3 months ago

0.0.24

1 month ago

0.0.22

12 months ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.3

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago