-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "Revert Video Conference commits" This reverts commit 7415488. * [NEW] [VideoConference] Allow apps to end calls and add users (#516) * [NEW] [VideoConference] Allow apps to create new video conferences (#517) * Publish package when merging to new/videoconf (#518) * [NEW] Extra test for video conference builder * New space on readme file * [NEW] [Video Conference] Configure Provider Capabilities (#520) Co-authored-by: Thassio Victor <[email protected]>
- Loading branch information
1 parent
0fc04a2
commit a493a76
Showing
61 changed files
with
1,686 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { IVideoConfProvider } from '../videoConfProviders'; | ||
|
||
/** | ||
* This accessor provides methods for adding videoconf providers. | ||
* It is provided during the initialization of your App | ||
*/ | ||
|
||
export interface IVideoConfProvidersExtend { | ||
/** | ||
* Adds a videoconf provider | ||
* | ||
* @param provider the provider information | ||
*/ | ||
provideVideoConfProvider(provider: IVideoConfProvider): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { RocketChatAssociationModel } from '../metadata'; | ||
import { AppVideoConference } from '../videoConferences'; | ||
|
||
export interface IVideoConferenceBuilder { | ||
kind: RocketChatAssociationModel.VIDEO_CONFERENCE; | ||
|
||
setData(call: Partial<AppVideoConference>): IVideoConferenceBuilder; | ||
|
||
setRoomId(rid: string): IVideoConferenceBuilder; | ||
|
||
getRoomId(): string; | ||
|
||
setCreatedBy(userId: string): IVideoConferenceBuilder; | ||
|
||
getCreatedBy(): string; | ||
|
||
setProviderName(name: string): IVideoConferenceBuilder; | ||
|
||
getProviderName(): string; | ||
|
||
setProviderData(data: Record<string, any>): IVideoConferenceBuilder; | ||
|
||
getProviderData(): Record<string, any>; | ||
|
||
setTitle(name: string): IVideoConferenceBuilder; | ||
|
||
getTitle(): string; | ||
|
||
getVideoConference(): AppVideoConference; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { RocketChatAssociationModel } from '../metadata'; | ||
import { IVideoConferenceUser, VideoConference } from '../videoConferences'; | ||
import { VideoConferenceMember } from '../videoConferences/IVideoConference'; | ||
|
||
export interface IVideoConferenceExtender { | ||
kind: RocketChatAssociationModel.VIDEO_CONFERENCE; | ||
|
||
setProviderData(value: Record<string, any>): IVideoConferenceExtender; | ||
|
||
setStatus(value: VideoConference['status']): IVideoConferenceExtender; | ||
|
||
setEndedBy(value: IVideoConferenceUser['_id']): IVideoConferenceExtender; | ||
|
||
setEndedAt(value: VideoConference['endedAt']): IVideoConferenceExtender; | ||
|
||
addUser(userId: VideoConferenceMember['_id'], ts?: VideoConferenceMember['ts']): IVideoConferenceExtender; | ||
|
||
getVideoConference(): VideoConference; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { VideoConference } from '../videoConferences/IVideoConference'; | ||
|
||
/** | ||
* This accessor provides methods for accessing | ||
* video conferences in a read-only-fashion. | ||
*/ | ||
export interface IVideoConferenceRead { | ||
/** | ||
* Gets a video conference by an id. | ||
* | ||
* @param id the id of the video conference | ||
* @returns the video conference | ||
*/ | ||
getById(id: string): Promise<VideoConference | undefined>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { IVideoConferenceUser } from '../videoConferences/IVideoConferenceUser'; | ||
import { IVideoConferenceOptions } from './IVideoConferenceOptions'; | ||
import { VideoConfData, VideoConfDataExtended } from './VideoConfData'; | ||
|
||
/** | ||
* Represents a video conference provider | ||
*/ | ||
export interface IVideoConfProvider { | ||
name: string; | ||
|
||
capabilities?: { | ||
// Indicates if Rocket.Chat can determine if the user's microphone will start muted or not | ||
mic?: boolean; | ||
// Indicates if Rocket.Chat can determine if the user's camera will start turned on or not | ||
cam?: boolean; | ||
// Indicates if Rocket.Chat can send a custom title for the video conferences | ||
title?: boolean; | ||
}; | ||
|
||
// Optional function that can be used to determine if the provider is ready to use or still needs to be configured | ||
isFullyConfigured?(): Promise<boolean>; | ||
|
||
/** | ||
* The function which gets called when a new video conference url is requested | ||
*/ | ||
generateUrl(call: VideoConfData): Promise<string>; | ||
/** | ||
* The function which gets called whenever a user join url is requested | ||
*/ | ||
customizeUrl(call: VideoConfDataExtended, user?: IVideoConferenceUser, options?: IVideoConferenceOptions): Promise<string>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface IVideoConferenceOptions { | ||
mic?: boolean; | ||
cam?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import type { IGroupVideoConference, IVideoConference } from '../videoConferences/IVideoConference'; | ||
|
||
export type VideoConfData = Pick<IVideoConference, '_id' | 'type' | 'rid' | 'createdBy' | 'providerData'> & { title?: IGroupVideoConference['title'] }; | ||
|
||
export type VideoConfDataExtended = VideoConfData & Required<Pick<IVideoConference, 'url'>>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { IVideoConferenceOptions } from './IVideoConferenceOptions'; | ||
import { IVideoConfProvider } from './IVideoConfProvider'; | ||
import { VideoConfData, VideoConfDataExtended } from './VideoConfData'; | ||
|
||
export { | ||
IVideoConferenceOptions, | ||
IVideoConfProvider, | ||
VideoConfData, | ||
VideoConfDataExtended, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import type { IGroupVideoConference } from './IVideoConference'; | ||
|
||
// Type for video conferences being created by an app | ||
export type AppVideoConference = Pick<IGroupVideoConference, 'rid' | 'providerName' | 'providerData' | 'title'> & { createdBy: IGroupVideoConference['createdBy']['_id'] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { IVideoConferenceUser } from './IVideoConferenceUser'; | ||
|
||
export type VideoConferenceMember = IVideoConferenceUser & { | ||
ts: Date; | ||
}; | ||
|
||
export enum VideoConferenceStatus { | ||
CALLING = 0, | ||
STARTED = 1, | ||
ENDED = 2, | ||
} | ||
|
||
export interface IVideoConference { | ||
_id: string; | ||
_updatedAt: Date; | ||
type: 'direct' | 'videoconference' | 'livechat'; | ||
rid: string; | ||
users: Array<VideoConferenceMember>; | ||
status: VideoConferenceStatus; | ||
messages: { | ||
started?: string; | ||
ended?: string; | ||
}; | ||
url?: string; | ||
|
||
createdBy: IVideoConferenceUser; | ||
createdAt: Date; | ||
|
||
endedBy?: IVideoConferenceUser; | ||
endedAt?: Date; | ||
|
||
providerName: string; | ||
providerData?: Record<string, any>; | ||
} | ||
|
||
export interface IDirectVideoConference extends IVideoConference { | ||
type: 'direct'; | ||
} | ||
|
||
export interface IGroupVideoConference extends IVideoConference { | ||
type: 'videoconference'; | ||
anonymousUsers: number; | ||
title: string; | ||
} | ||
|
||
export interface ILivechatVideoConference extends IVideoConference { | ||
type: 'livechat'; | ||
} | ||
|
||
export type VideoConference = IDirectVideoConference | IGroupVideoConference | ILivechatVideoConference; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface IVideoConferenceUser { | ||
_id: string; | ||
username: string; | ||
name: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { AppVideoConference } from './AppVideoConference'; | ||
import { IDirectVideoConference, IGroupVideoConference, IVideoConference, VideoConference } from './IVideoConference'; | ||
import { IVideoConferenceUser } from './IVideoConferenceUser'; | ||
|
||
export { | ||
AppVideoConference, | ||
IDirectVideoConference, | ||
IGroupVideoConference, | ||
IVideoConference, | ||
IVideoConferenceUser, | ||
VideoConference, | ||
}; |
Oops, something went wrong.