1.4.0 • Published 2 years ago

@bleco/video-conferencing-service v1.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

video-conferencing-service

LoopBack

Various features of Video Conferencing Services:

  1. Schedule Meetings and Generate 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 third party. These events are used to store session attendees or store archive information. For Vonage, you need to add this microserivce 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 @bleco/video-conferencing-service

Usage

  • Create a new Loopback4 Application (If you don't have one already) lb4 testapp
  • Install the video conferencing service npm i @bleco/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
    });
  • Add the VideoConfServiceComponent to your Loopback4 Application (in application.ts).
    // import the component for VideoConfService
    import { VideoConfServiceComponent } from '@bleco/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.
  • Start the application npm start

Working and Flow

video

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
NameRequiredDefault ValueDescription
NODE_ENVYNode environment value, i.e. dev, test, prod
LOG_LEVELYLog level value, i.e. error, warn, info, verbose, debug
HOSTYHost for the service to run under, i.e. 0.0.0.0
PORTY3000Port for the service to listen on.
DB_HOSTYHostname for the database server.
DB_PORTYPort for the database server.
DB_USERYUser for the database.
DB_PASSWORDYPassword for the database user.
DB_DATABASEYDatabase to connect to on the database server.
DB_SCHEMAYpublicDatabase schema used for the data source. In PostgreSQL, this will be public unless a schema is made explicitly for the service.
JWT_SECRETYSymmetric signing key of the JWT token.
JWT_ISSUERYIssuer of the JWT token.

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 '@bleco/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 BLECO_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 database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the VIDEOCONF_MIGRATION_COPY or BLECO_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.

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.