12.0.0 • Published 23 hours ago

@sourceloop/video-conferencing-service v12.0.0

Weekly downloads
151
License
MIT
Repository
-
Last release
23 hours ago

@sourceloop/video-conferencing-service

LoopBack

npm

node-current (scoped)

npm (prod) dependency version (scoped)

Overview

Various features of Video Conferencing Services:

  1. Schedule Meetings and Generate a Token Book on demand meetings or schedule meetings and generate token which is required for connection to a session/room on the client side.

  2. List Archives Get a specific archive or list a set of archives for the recorded meetings.

  3. Configure storage target Set Storage settings to store archives to custom s3 bucket or Microsoft Azure Storage.

  4. Webhook Events Webhook Events (such as session or webhook) when configured receive events from a third party. These events are used to store session attendees or store archive information. For Vonage, you need to add this microservice server url in your current vonage project so it will receive webhook events. See Vonage Documentation for more information.

You can see the database schema here.

To get started with a basic implementation of this service, see /sandbox/video-conferencing-ms-example.

Install

npm i @sourceloop/video-conferencing-service

Working and Flow

video

Usage

  • Create a new Loopback4 Application (If you don't have one already) lb4 testapp
  • Install the video conferencing service npm i @sourceloop/video-conferencing-service
  • Set the environment variables.
  • Run the migrations.
  • Bind Vonage config to the VonageBindings.Config key -

    this.bind(VonageBindings.Config).to({
      apiKey: process.env.VONAGE_API_KEY,
      apiSecret: process.env.VONAGE_API_SECRET,
      timeToStart: 0, // time in minutes, meeting can not be started 'timeToStart' minutes before the scheduled time
    });
  • For Twilio bind twilio config to the TwilioBindings.config key-

    this.bind(TwilioBindings.config).to({
      accountSid: process.env.TWILIO_ACCOUNT_SID,
      authToken: process.env.TWILIO_AUTH_TOKEN,
      apiSid: process.env.TWILIO_API_KEY,
      apiSecret: process.env.TWILIO_API_SECRET,
    });
  • Add the VideoConfServiceComponent to your Loopback4 Application (in application.ts)

    // import the component for VideoConfService
    import { VideoConfServiceComponent } from '@sourceloop/video-conferencing-service';
    ...
    // add VideoConfServiceComponent inside the application class
    this.component(VideoConfServiceComponent);
    ...
  • Set up a Loopback4 Datasource with dataSourceName property set to VideoConfDatasource. You can see an example datasource here.

  • Using with Sequelize

    This service supports Sequelize as the underlying ORM using @loopback/sequelize extension. And in order to use it, you'll need to do following changes.

    • To use Sequelize in your application, add following to application.ts:

      this.bind(VideoChatBindings.Config).to({
        useCustomSequence: false,
        useSequelize: true,
      });
    • Use the SequelizeDataSource in your audit datasource as the parent class. Refer this for more details.

  • Configurable Audit Logs

    To generate audit logs for video conferencing service, you'll have to set the env var ADD_AUDIT_LOG_MIXIN to true and configure a datasource for it like below:

    import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core';
    import {juggler} from '@loopback/repository';
    import {AuditDbSourceName} from '@sourceloop/audit-log';
    
    const config = {
      name: 'audit',
      connector: 'postgresql',
      url: '',
      host: '',
      port: 0,
      user: '',
      password: '',
      database: '',
    };
    
    @lifeCycleObserver('datasource')
    export class AuditDataSource
      extends juggler.DataSource
      implements LifeCycleObserver
    {
      static dataSourceName = AuditDbSourceName;
      static readonly defaultConfig = config;
    
      constructor(
        @inject('datasources.config.audit', {optional: true})
        dsConfig: object = config,
      ) {
        const auditEnvConfig = {
          host: process.env.AUDIT_DB_HOST,
          port: process.env.AUDIT_DB_PORT,
          user: process.env.AUDIT_DB_USER,
          password: process.env.AUDIT_DB_PASSWORD,
          database: process.env.AUDIT_DB_DATABASE,
          schema: process.env.AUDIT_DB_SCHEMA,
        };
        Object.assign(dsConfig, auditEnvConfig);
        super(dsConfig);
      }
    }

    Configure .env of application in index.ts before exporting application like follows

    import * as dotenv from 'dotenv';
    dotenv.config();
    
    import {
      ApplicationConfig,
      VideoConferencingExampleApplication,
    } from './application';
    export * from './application';
    //...
  • Start the application npm start

Environment Variables

Do not forget to set Environment variables. The examples below show a common configuration for a PostgreSQL Database running locally.

NODE_ENV=dev
LOG_LEVEL=DEBUG
HOST=0.0.0.0
PORT=3000
DB_HOST=localhost
DB_PORT=5432
DB_USER=pg_service_user
DB_PASSWORD=pg_service_user_password
DB_DATABASE=video_conferencing_db
DB_SCHEMA=public
JWT_SECRET=super_secret_string
JWT_ISSUER=https://authentication.service

Setting up a DataSource

Here is a sample Implementation DataSource implementation using environment variables and PostgreSQL as the data source.

import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core';
import {juggler} from '@loopback/repository';
import {VideoConfDatasource} from '@sourceloop/video-conferencing-service';

const config = {
  name: VideoConfDatasource,
  connector: 'postgresql',
  url: '',
  host: process.env.DB_HOST,
  port: process.env.DB_PORT,
  user: process.env.DB_USER,
  password: process.env.DB_PASSWORD,
  database: process.env.DB_DATABASE,
  schema: process.env.DB_SCHEMA,
};

@lifeCycleObserver('datasource')
export class VideoDbDataSource
  extends juggler.DataSource
  implements LifeCycleObserver
{
  static dataSourceName = VideoConfDatasource;
  static readonly defaultConfig = config;

  constructor(
    @inject(`datasources.config.${VideoConfDatasource}`, {optional: true})
    dsConfig: object = config,
  ) {
    super(dsConfig);
  }
}

Database Schema

canva-photo-editor

Migrations

The migrations required for this service are processed during the installation automatically if you set the VIDEOCONF_MIGRATION or SOURCELOOP_MIGRATION env variable. The migrations use db-migrate with db-migrate-pg driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or databases, they may be affected. In such a scenario, it is advised that you copy the migration files in your project root, using the VIDEOCONF_MIGRATION_COPY or SOURCELOOP_MIGRATION_COPY env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB.

Additionally, there is now an option to choose between SQL migration or PostgreSQL migration. NOTE : For @sourceloop/cli users, this choice can be specified during the scaffolding process by selecting the "type of datasource" option.

API's Details

Visit the OpenAPI spec docs

Feedback

If you've noticed a bug or have a question or have a feature request, search the issue tracker to see if someone else in the community has already created a ticket. If not, go ahead and make one! All feature requests are welcome. Implementation time may vary. Feel free to contribute the same, if you can. If you think this extension is useful, please star it. Appreciation really helps in keeping this project alive.

12.0.0

23 hours ago

11.0.1

1 month ago

11.0.0

1 month ago

10.0.5

2 months ago

10.0.4

2 months ago

10.0.3

3 months ago

10.0.2

4 months ago

10.0.1

4 months ago

10.0.0

4 months ago

9.0.0

4 months ago

8.0.1

5 months ago

8.0.0

5 months ago

7.0.0

5 months ago

6.1.0

5 months ago

5.0.7

7 months ago

5.0.6

8 months ago

5.0.5

9 months ago

5.0.4

10 months ago

5.0.3

10 months ago

5.0.2

10 months ago

6.0.0

6 months ago

4.2.0

1 year ago

5.0.1

11 months ago

5.0.0

11 months ago

4.3.1

12 months ago

4.3.0

1 year ago

4.1.16

1 year ago

4.1.17

1 year ago

4.1.18

1 year ago

4.1.14

1 year ago

4.1.15

1 year ago

4.1.10

1 year ago

4.1.11

1 year ago

4.1.12

1 year ago

4.1.13

1 year ago

4.1.8

2 years ago

4.1.9

1 year ago

4.1.7

2 years ago

4.0.10

2 years ago

4.1.4

2 years ago

4.1.3

2 years ago

4.1.6

2 years ago

4.1.5

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.0.5

2 years ago

4.0.4

2 years ago

4.0.7

2 years ago

4.0.6

2 years ago

4.0.3

2 years ago

4.0.8

2 years ago

4.0.1

2 years ago

4.0.2

2 years ago

3.1.6

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.1

2 years ago

2.0.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

1.3.0

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

1.0.0-alpha.31

3 years ago

1.0.0-alpha.30

3 years ago

1.0.0-alpha.29

3 years ago

1.0.0-alpha.28

3 years ago

1.0.0-alpha.27

3 years ago

1.0.0-alpha.26

3 years ago

1.0.0-alpha.25

3 years ago

1.0.0-alpha.24

3 years ago

1.0.0-alpha.23

3 years ago

1.0.0-alpha.22

3 years ago

1.0.0-alpha.21

3 years ago

1.0.0-alpha.20

3 years ago

1.0.0-alpha.19

3 years ago

1.0.0-alpha.18

3 years ago

1.0.0-alpha.17

4 years ago

1.0.0-alpha.16

4 years ago

1.0.0-alpha.15

4 years ago

1.0.0-alpha.14

4 years ago

1.0.0-alpha.12

4 years ago

1.0.0-alpha.11

4 years ago

1.0.0-alpha.10

4 years ago

1.0.0-alpha.9

4 years ago

1.0.0-alpha.8

4 years ago

1.0.0-alpha.7

4 years ago

1.0.0-alpha.6

4 years ago

1.0.0-alpha.5

4 years ago

1.0.0-alpha.4

4 years ago

1.0.0-alpha.3

4 years ago

1.0.0-alpha.2

4 years ago

1.0.0-alpha.0

4 years ago