@100mslive/hms-video-store
Advanced tools
Comparing version 0.12.11 to 0.12.12-alpha.0
@@ -55,3 +55,3 @@ import { LocalAudioTrackAnalytics, LocalBaseSample, LocalVideoSample, LocalVideoTrackAnalytics, PublishAnalyticPayload, RemoteAudioSample, RemoteAudioTrackAnalytics, RemoteVideoSample, RemoteVideoTrackAnalytics, SubscribeAnalyticPayload } from './interfaces'; | ||
protected abstract toAnalytics: () => LocalAudioTrackAnalytics | LocalVideoTrackAnalytics | RemoteAudioTrackAnalytics | RemoteVideoTrackAnalytics; | ||
protected getLatestStat(): TempStats; | ||
getLatestStat(): TempStats; | ||
protected getFirstStat(): TempStats; | ||
@@ -58,0 +58,0 @@ protected calculateSum(key: keyof TempStats): number | undefined; |
import { TranscriptionConfig } from './interfaces/transcription-config'; | ||
import { FindPeerByNameRequestParams } from './signal/interfaces'; | ||
import { HLSConfig, HLSTimedMetadata, HMSAudioPlugin, HMSAudioTrackSettings, HMSConfig, HMSInteractivityCenter as IHMSInteractivityCenter, HMSLogLevel, HMSMediaStreamPlugin, HMSMidCallPreviewConfig, HMSPlaylistSettings, HMSPluginSupportResult, HMSPreferredSimulcastLayer, HMSPreviewConfig, HMSScreenShareConfig, HMSTrack, HMSVideoPlugin, HMSVideoTrackSettings, RTMPRecordingConfig, TokenRequest, TokenRequestOptions } from './internal'; | ||
@@ -474,2 +475,7 @@ import { HMSChangeMultiTrackStateParams, HMSGenericTypes, HMSMessageID, HMSPeer, HMSPeerID, HMSPeerListIterator, HMSPeerListIteratorOptions, HMSRoleName, HMSTrackID, HMSTrackSource, IHMSPlaylistActions, IHMSSessionStoreActions } from './schema'; | ||
getPeer(peerId: string): Promise<HMSPeer | undefined>; | ||
findPeerByName(options: FindPeerByNameRequestParams): Promise<{ | ||
offset: number; | ||
eof?: boolean; | ||
peers: HMSPeer[]; | ||
}>; | ||
/** | ||
@@ -476,0 +482,0 @@ * Method to override the default settings for playlist tracks |
import InitialSettings from './settings'; | ||
export declare type HMSICEServer = { | ||
urls: string[]; | ||
userName?: string; | ||
password?: string; | ||
}; | ||
/** | ||
@@ -7,7 +12,2 @@ * the config object tells the SDK options you want to join with | ||
*/ | ||
export declare type HMSICEServer = { | ||
urls: string[]; | ||
userName?: string; | ||
password?: string; | ||
}; | ||
export interface HMSConfig { | ||
@@ -14,0 +14,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { HMSTranscriptionMode } from './room'; | ||
import { SimulcastLayers } from './simulcast-layers'; | ||
@@ -23,2 +24,3 @@ export declare type HMSRoleName = string; | ||
whiteboard?: Array<HMSPermissionType>; | ||
transcriptions?: Record<HMSTranscriptionMode, Array<HMSPermissionType>>; | ||
}; | ||
@@ -25,0 +27,0 @@ priority: number; |
@@ -39,2 +39,8 @@ import { VideoTrackLayerUpdate } from '../connection/channel-messages'; | ||
} | ||
export interface FindPeerByNameInfo { | ||
name: string; | ||
peer_id: string; | ||
role: string; | ||
type: HMSPeerType; | ||
} | ||
export declare enum HMSRecordingState { | ||
@@ -72,2 +78,12 @@ NONE = "none", | ||
} | ||
interface TranscriptionPluginPermissions { | ||
permissions?: { | ||
admin?: Array<string>; | ||
}; | ||
mode: HMSTranscriptionMode; | ||
} | ||
export declare enum Plugins { | ||
WHITEBOARD = "whiteboard", | ||
TRANSCRIPTIONS = "transcriptions" | ||
} | ||
export interface PolicyParams { | ||
@@ -79,3 +95,4 @@ name: string; | ||
plugins: { | ||
[plugin in 'whiteboard']?: PluginPermissions; | ||
[Plugins.WHITEBOARD]?: PluginPermissions; | ||
[Plugins.TRANSCRIPTIONS]?: TranscriptionPluginPermissions[]; | ||
}; | ||
@@ -82,0 +99,0 @@ template_id: string; |
@@ -15,2 +15,6 @@ import * as sdkTypes from '../../internal'; | ||
export declare const POLL_NOTIFICATION_TYPES: PollNotificationMap; | ||
declare type TranscriptionNotificationMap = { | ||
[key in sdkTypes.HMSRoomUpdate.TRANSCRIPTION_STATE_UPDATED]: HMSNotificationTypes; | ||
}; | ||
export declare const TRANSCRIPTION_NOTIFICATION_TYPES: TranscriptionNotificationMap; | ||
export {}; |
@@ -26,4 +26,5 @@ import { IHMSStore } from '../IHMSStore'; | ||
sendPollUpdate(type: sdkTypes.HMSPollsUpdate, pollID: string): void; | ||
sendTranscriptionUpdate(transcriptions?: sdkTypes.HMSTranscriptionInfo[]): void; | ||
private emitEvent; | ||
private createNotification; | ||
} |
@@ -10,2 +10,3 @@ import { HMSNotifications } from './HMSNotifications'; | ||
import { HMSRoleChangeRequest } from '../selectors'; | ||
import { FindPeerByNameRequestParams } from '../signal/interfaces'; | ||
/** | ||
@@ -94,2 +95,7 @@ * This class implements the IHMSActions interface for 100ms SDK. It connects with SDK | ||
getPeer(peerId: string): Promise<HMSPeer | undefined>; | ||
findPeerByName(options: FindPeerByNameRequestParams): Promise<{ | ||
offset: number; | ||
eof: boolean | undefined; | ||
peers: HMSPeer[]; | ||
}>; | ||
getPeerListIterator(options?: HMSPeerListIteratorOptions): { | ||
@@ -96,0 +102,0 @@ hasNext: () => boolean; |
@@ -7,3 +7,3 @@ import { HMSDeviceChangeEvent } from './device-change'; | ||
import { HMSChangeMultiTrackStateRequest, HMSChangeTrackStateRequest, HMSLeaveRoomRequest } from './requests'; | ||
import { HMSPoll } from '../internal'; | ||
import { HMSPoll, HMSTranscriptionInfo } from '../internal'; | ||
interface BaseNotification { | ||
@@ -63,3 +63,7 @@ id: number; | ||
} | ||
export declare type HMSNotification = HMSPeerNotification | HMSPeerListNotification | HMSTrackNotification | HMSMessageNotification | HMSExceptionNotification | HMSChangeTrackStateRequestNotification | HMSChangeMultiTrackStateRequestNotification | HMSLeaveRoomRequestNotification | HMSDeviceChangeEventNotification | HMSReconnectionNotification | HMSPlaylistItemNotification<any>; | ||
export interface HMSTranscriptionNotification extends BaseNotification { | ||
type: HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED; | ||
data: HMSTranscriptionInfo[]; | ||
} | ||
export declare type HMSNotification = HMSPeerNotification | HMSPeerListNotification | HMSTrackNotification | HMSMessageNotification | HMSExceptionNotification | HMSChangeTrackStateRequestNotification | HMSChangeMultiTrackStateRequestNotification | HMSLeaveRoomRequestNotification | HMSDeviceChangeEventNotification | HMSReconnectionNotification | HMSTranscriptionNotification | HMSPlaylistItemNotification<any>; | ||
export declare enum HMSNotificationSeverity { | ||
@@ -98,3 +102,4 @@ INFO = "info", | ||
POLLS_LIST = "POLLS_LIST", | ||
HAND_RAISE_CHANGED = "HAND_RAISE_CHANGED" | ||
HAND_RAISE_CHANGED = "HAND_RAISE_CHANGED", | ||
TRANSCRIPTION_STATE_UPDATED = "TRANSCRIPTION_STATE_UPDATED" | ||
} | ||
@@ -132,2 +137,3 @@ export declare type HMSNotificationMapping<T extends HMSNotificationTypes, C = any> = { | ||
[HMSNotificationTypes.HAND_RAISE_CHANGED]: HMSPeerNotification; | ||
[HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED]: HMSTranscriptionNotification; | ||
}[T]; | ||
@@ -134,0 +140,0 @@ export declare type MappedNotifications<Type extends HMSNotificationTypes[]> = { |
@@ -17,2 +17,3 @@ import { HMSLocalPeer } from './models/peer'; | ||
import { InteractivityCenter } from '../session-store/interactivity-center'; | ||
import { FindPeerByNameRequestParams } from '../signal/interfaces'; | ||
import { HMSLogLevel } from '../utils/logger'; | ||
@@ -86,2 +87,11 @@ export declare class HMSSdk implements HMSInterface { | ||
getPeer(peerId: string): Promise<import("./models/peer").HMSRemotePeer | undefined>; | ||
findPeerByName({ query, limit, offset }: FindPeerByNameRequestParams): Promise<{ | ||
offset: number; | ||
eof: boolean; | ||
peers: import("./models/peer").HMSRemotePeer[]; | ||
} | { | ||
offset: number; | ||
peers: never[]; | ||
eof?: undefined; | ||
}>; | ||
private sendMessageInternal; | ||
@@ -88,0 +98,0 @@ startScreenShare(onStop: () => void, config?: HMSScreenShareConfig): Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import { HMSRole, HMSWhiteboard } from '../internal'; | ||
import { HMSRole, HMSTranscriptionMode, HMSWhiteboard } from '../internal'; | ||
import { HMSException, HMSMessage, HMSPeer, HMSPeerID, HMSRoom, HMSRoomState, HMSStore, HMSVideoTrack } from '../schema'; | ||
@@ -404,2 +404,3 @@ /** | ||
whiteboard?: import("../internal").HMSPermissionType[] | undefined; | ||
transcriptions?: Record<HMSTranscriptionMode, import("../internal").HMSPermissionType[]> | undefined; | ||
} | undefined, (res: HMSRole | null) => { | ||
@@ -417,2 +418,3 @@ endRoom: boolean; | ||
whiteboard?: import("../internal").HMSPermissionType[] | undefined; | ||
transcriptions?: Record<HMSTranscriptionMode, import("../internal").HMSPermissionType[]> | undefined; | ||
} | undefined>; | ||
@@ -419,0 +421,0 @@ export declare const selectRecordingState: import("reselect").OutputSelector<HMSStore<{ |
@@ -0,1 +1,2 @@ | ||
import { HMSTranscriptionMode } from '../internal'; | ||
import { HMSAudioTrack, HMSGenericTypes, HMSPeer, HMSPeerID, HMSRoleName, HMSScreenVideoTrack, HMSStore, HMSTrack, HMSVideoTrack } from '../schema'; | ||
@@ -36,3 +37,3 @@ /** | ||
sessionStore: Record<string, any>; | ||
}>, import("..").HMSPeerType | undefined>; | ||
}>, import("../internal").HMSPeerType | undefined>; | ||
/** | ||
@@ -204,3 +205,3 @@ * Select the {@link HMSTrack} object given a track ID. | ||
sessionStore: Record<string, any>; | ||
}>, import("../schema").HMSSimulcastLayer | undefined>; | ||
}>, import("../internal").HMSSimulcastLayer | undefined>; | ||
export declare const selectBroadcastMessages: import("reselect").OutputSelector<HMSStore<{ | ||
@@ -256,5 +257,8 @@ sessionStore: Record<string, any>; | ||
sessionStore: Record<string, any>; | ||
}>, import("..").HMSPoll | null>; | ||
}>, import("../internal").HMSPoll | null>; | ||
export declare const selectMessageByMessageID: (id: string) => import("reselect").OutputSelector<HMSStore<{ | ||
sessionStore: Record<string, any>; | ||
}>, import("../schema").HMSMessage, (res: Record<string, import("../schema").HMSMessage>) => import("../schema").HMSMessage>; | ||
export declare const selectIsTranscriptionAllowedByMode: (mode: HMSTranscriptionMode) => import("reselect").OutputSelector<HMSStore<{ | ||
sessionStore: Record<string, any>; | ||
}>, boolean, (res: import("../internal").HMSRole | null) => boolean>; |
import { HMSPermissionType } from '../../interfaces'; | ||
import { PeerNotificationInfo } from '../../notification-manager'; | ||
import { FindPeerByNameInfo, PeerNotificationInfo } from '../../notification-manager'; | ||
export interface BroadcastResponse { | ||
@@ -29,2 +29,9 @@ timestamp: number; | ||
} | ||
export interface FindPeerByNameResponse { | ||
count: number; | ||
limit: number; | ||
offset: number; | ||
eof: boolean; | ||
peers: FindPeerByNameInfo[]; | ||
} | ||
export interface CreateWhiteboardResponse { | ||
@@ -31,0 +38,0 @@ id: string; |
@@ -74,6 +74,6 @@ import { HMSTrackSource, HMSTranscriptionMode } from '../..'; | ||
} | ||
export interface getPeerRequestParams { | ||
export interface GetPeerRequestParams { | ||
peer_id: string; | ||
} | ||
export interface findPeersRequestParams { | ||
export interface FindPeersRequestParams { | ||
peers?: string[]; | ||
@@ -84,5 +84,10 @@ role?: string; | ||
} | ||
export interface peerIterRequestParams { | ||
export interface FindPeerByNameRequestParams { | ||
query?: string; | ||
limit?: number; | ||
offset?: number; | ||
} | ||
export interface PeerIterRequestParams { | ||
iterator: string; | ||
limit: number; | ||
} |
@@ -5,3 +5,3 @@ import AnalyticsEvent from '../../analytics/AnalyticsEvent'; | ||
import { Queue } from '../../utils/queue'; | ||
import { AcceptRoleChangeParams, BroadcastResponse, CreateWhiteboardResponse, findPeersRequestParams, getPeerRequestParams, GetSessionMetadataResponse, GetWhiteboardResponse, HLSRequestParams, HLSTimedMetadataParams, HMSPermissionType, HMSWhiteboardCreateOptions, JoinLeaveGroupResponse, MultiTrackUpdateRequestParams, peerIterRequestParams, PeersIterationResponse, PollInfoGetParams, PollInfoSetParams, PollLeaderboardGetParams, PollLeaderboardGetResponse, PollListParams, PollListResponse, PollQuestionsGetParams, PollQuestionsGetResponse, PollQuestionsSetParams, PollQuestionsSetResponse, PollResponseSetParams, PollResponseSetResponse, PollResponsesGetParams, PollResponsesGetResponse, PollResultParams, PollResultResponse, PollStartParams, PollStartResponse, PollStopParams, RemovePeerRequest, RequestForBulkRoleChangeParams, RequestForRoleChangeParams, SetSessionMetadataParams, SetSessionMetadataResponse, StartRTMPOrRecordingRequestParams, StartTranscriptionRequestParams, Track, TrackUpdateRequestParams, UpdatePeerRequestParams } from '../interfaces'; | ||
import { AcceptRoleChangeParams, BroadcastResponse, CreateWhiteboardResponse, FindPeerByNameRequestParams, FindPeerByNameResponse, FindPeersRequestParams, GetPeerRequestParams, GetSessionMetadataResponse, GetWhiteboardResponse, HLSRequestParams, HLSTimedMetadataParams, HMSPermissionType, HMSWhiteboardCreateOptions, JoinLeaveGroupResponse, MultiTrackUpdateRequestParams, PeerIterRequestParams, PeersIterationResponse, PollInfoGetParams, PollInfoSetParams, PollLeaderboardGetParams, PollLeaderboardGetResponse, PollListParams, PollListResponse, PollQuestionsGetParams, PollQuestionsGetResponse, PollQuestionsSetParams, PollQuestionsSetResponse, PollResponseSetParams, PollResponseSetResponse, PollResponsesGetParams, PollResponsesGetResponse, PollResultParams, PollResultResponse, PollStartParams, PollStartResponse, PollStopParams, RemovePeerRequest, RequestForBulkRoleChangeParams, RequestForRoleChangeParams, SetSessionMetadataParams, SetSessionMetadataResponse, StartRTMPOrRecordingRequestParams, StartTranscriptionRequestParams, Track, TrackUpdateRequestParams, UpdatePeerRequestParams } from '../interfaces'; | ||
import { ISignalEventsObserver } from '../ISignalEventsObserver'; | ||
@@ -59,3 +59,3 @@ export default class JsonRpcSignal { | ||
updatePeer(params: UpdatePeerRequestParams): Promise<void>; | ||
getPeer(params: getPeerRequestParams): Promise<PeerNotificationInfo | undefined>; | ||
getPeer(params: GetPeerRequestParams): Promise<PeerNotificationInfo | undefined>; | ||
joinGroup(name: string): Promise<JoinLeaveGroupResponse>; | ||
@@ -65,4 +65,5 @@ leaveGroup(name: string): Promise<JoinLeaveGroupResponse>; | ||
removeFromGroup(peerId: string, name: string): Promise<void>; | ||
peerIterNext(params: peerIterRequestParams): Promise<PeersIterationResponse>; | ||
findPeers(params: findPeersRequestParams): Promise<PeersIterationResponse>; | ||
peerIterNext(params: PeerIterRequestParams): Promise<PeersIterationResponse>; | ||
findPeers(params: FindPeersRequestParams): Promise<PeersIterationResponse>; | ||
findPeerByName(params: FindPeerByNameRequestParams): Promise<FindPeerByNameResponse>; | ||
setSessionMetadata(params: SetSessionMetadataParams): Promise<SetSessionMetadataResponse>; | ||
@@ -69,0 +70,0 @@ listenMetadataChange(keys: string[]): Promise<void>; |
@@ -58,2 +58,3 @@ import { HMSAction } from '../../error/HMSAction'; | ||
FIND_PEER = "find-peer", | ||
SEARCH_BY_NAME = "peer-name-search", | ||
PEER_ITER_NEXT = "peer-iter-next", | ||
@@ -60,0 +61,0 @@ GROUP_JOIN = "group-join", |
{ | ||
"version": "0.12.11", | ||
"version": "0.12.12-alpha.0", | ||
"license": "MIT", | ||
@@ -76,3 +76,3 @@ "repository": { | ||
], | ||
"gitHead": "29f7d58a447423b3eaab77ef94e843aafe23995a" | ||
"gitHead": "5e32c0c62aba5aa7786a01912511da6ac33461a2" | ||
} |
@@ -157,3 +157,3 @@ import { | ||
protected getLatestStat() { | ||
getLatestStat() { | ||
return this.tempStats[this.tempStats.length - 1]; | ||
@@ -160,0 +160,0 @@ } |
@@ -53,12 +53,20 @@ import { | ||
Object.keys(remoteTracksStats).forEach(trackID => { | ||
const track = this.store.getTrackById(trackID); | ||
const trackStats = remoteTracksStats[trackID]; | ||
const track = this.store.getTrackById(trackID); | ||
const prevTrackStats = this.trackAnalytics.get(trackID)?.getLatestStat(); | ||
const getCalculatedJitterBufferDelay = (trackStats: HMSTrackStats) => | ||
trackStats.jitterBufferDelay && | ||
trackStats.jitterBufferEmittedCount && | ||
(trackStats.jitterBufferDelay / trackStats.jitterBufferEmittedCount) * 1000; | ||
// eslint-disable-next-line complexity | ||
const getCalculatedJitterBufferDelay = (trackStats: HMSTrackStats, prevTrackStats?: TempStats) => { | ||
const prevJBDelay = prevTrackStats?.jitterBufferDelay || 0; | ||
const prevJBEmittedCount = prevTrackStats?.jitterBufferEmittedCount || 0; | ||
const currentJBDelay = (trackStats?.jitterBufferDelay || 0) - prevJBDelay; | ||
const currentJBEmittedCount = (trackStats?.jitterBufferEmittedCount || 0) - prevJBEmittedCount; | ||
const calculatedJitterBufferDelay = getCalculatedJitterBufferDelay(trackStats); | ||
return currentJBEmittedCount > 0 | ||
? (currentJBDelay * 1000) / currentJBEmittedCount | ||
: prevTrackStats?.calculatedJitterBufferDelay || 0; | ||
}; | ||
const calculatedJitterBufferDelay = getCalculatedJitterBufferDelay(trackStats, prevTrackStats); | ||
const avSync = this.calculateAvSyncForStat(trackStats, hmsStats); | ||
@@ -65,0 +73,0 @@ const newTempStat: TempStats = { ...trackStats, calculatedJitterBufferDelay, avSync }; |
import { TranscriptionConfig } from './interfaces/transcription-config'; | ||
import { FindPeerByNameRequestParams } from './signal/interfaces'; | ||
import { | ||
@@ -564,2 +565,3 @@ HLSConfig, | ||
getPeer(peerId: string): Promise<HMSPeer | undefined>; | ||
findPeerByName(options: FindPeerByNameRequestParams): Promise<{ offset: number; eof?: boolean; peers: HMSPeer[] }>; | ||
/** | ||
@@ -566,0 +568,0 @@ * Method to override the default settings for playlist tracks |
import InitialSettings from './settings'; | ||
export type HMSICEServer = { | ||
urls: string[]; | ||
userName?: string; | ||
password?: string; | ||
}; | ||
/** | ||
@@ -9,8 +15,2 @@ * the config object tells the SDK options you want to join with | ||
export type HMSICEServer = { | ||
urls: string[]; | ||
userName?: string; | ||
password?: string; | ||
}; | ||
export interface HMSConfig { | ||
@@ -17,0 +17,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
import { HMSTranscriptionMode } from './room'; | ||
import { SimulcastLayers } from './simulcast-layers'; | ||
@@ -26,2 +27,3 @@ | ||
whiteboard?: Array<HMSPermissionType>; | ||
transcriptions?: Record<HMSTranscriptionMode, Array<HMSPermissionType>>; | ||
}; | ||
@@ -28,0 +30,0 @@ priority: number; |
@@ -46,2 +46,9 @@ import { VideoTrackLayerUpdate } from '../connection/channel-messages'; | ||
export interface FindPeerByNameInfo { | ||
name: string; | ||
peer_id: string; | ||
role: string; | ||
type: HMSPeerType; | ||
} | ||
export enum HMSRecordingState { | ||
@@ -83,2 +90,15 @@ NONE = 'none', | ||
interface TranscriptionPluginPermissions { | ||
permissions?: { | ||
// list of roles | ||
admin?: Array<string>; | ||
}; | ||
mode: HMSTranscriptionMode; | ||
} | ||
export enum Plugins { | ||
WHITEBOARD = 'whiteboard', | ||
TRANSCRIPTIONS = 'transcriptions', | ||
} | ||
export interface PolicyParams { | ||
@@ -90,3 +110,4 @@ name: string; | ||
plugins: { | ||
[plugin in 'whiteboard']?: PluginPermissions; | ||
[Plugins.WHITEBOARD]?: PluginPermissions; | ||
[Plugins.TRANSCRIPTIONS]?: TranscriptionPluginPermissions[]; | ||
}; | ||
@@ -93,0 +114,0 @@ template_id: string; |
@@ -221,2 +221,3 @@ import { HMSAction } from '../../error/HMSAction'; | ||
private convertHls(hlsNotification?: HLSNotification) { | ||
// only checking for zeroth variant intialized | ||
const isInitialised = | ||
@@ -223,0 +224,0 @@ hlsNotification?.variants && hlsNotification.variants.length > 0 |
@@ -35,1 +35,9 @@ import * as sdkTypes from '../../internal'; | ||
}; | ||
type TranscriptionNotificationMap = { | ||
[key in sdkTypes.HMSRoomUpdate.TRANSCRIPTION_STATE_UPDATED]: HMSNotificationTypes; | ||
}; | ||
export const TRANSCRIPTION_NOTIFICATION_TYPES: TranscriptionNotificationMap = { | ||
[sdkTypes.HMSRoomUpdate.TRANSCRIPTION_STATE_UPDATED]: HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED, | ||
}; |
import { EventEmitter2 as EventEmitter } from 'eventemitter2'; | ||
import { PEER_NOTIFICATION_TYPES, POLL_NOTIFICATION_TYPES, TRACK_NOTIFICATION_TYPES } from './common/mapping'; | ||
import { | ||
PEER_NOTIFICATION_TYPES, | ||
POLL_NOTIFICATION_TYPES, | ||
TRACK_NOTIFICATION_TYPES, | ||
TRANSCRIPTION_NOTIFICATION_TYPES, | ||
} from './common/mapping'; | ||
import { IHMSStore } from '../IHMSStore'; | ||
@@ -175,2 +180,10 @@ import * as sdkTypes from '../internal'; | ||
sendTranscriptionUpdate(transcriptions?: sdkTypes.HMSTranscriptionInfo[]) { | ||
const notification = this.createNotification( | ||
TRANSCRIPTION_NOTIFICATION_TYPES[sdkTypes.HMSRoomUpdate.TRANSCRIPTION_STATE_UPDATED], | ||
transcriptions, | ||
HMSNotificationSeverity.INFO, | ||
); | ||
this.emitEvent(notification); | ||
} | ||
private emitEvent(notification: HMSNotification) { | ||
@@ -194,2 +207,3 @@ this.eventEmitter.emit(HMS_NOTIFICATION_EVENT, notification); | ||
| sdkTypes.HMSPoll | ||
| sdkTypes.HMSTranscriptionInfo[] | ||
| null, | ||
@@ -196,0 +210,0 @@ severity?: HMSNotificationSeverity, |
@@ -91,2 +91,3 @@ import { PEER_NOTIFICATION_TYPES, POLL_NOTIFICATION_TYPES, TRACK_NOTIFICATION_TYPES } from './common/mapping'; | ||
} from '../selectors'; | ||
import { FindPeerByNameRequestParams } from '../signal/interfaces'; | ||
@@ -612,2 +613,7 @@ /** | ||
async findPeerByName(options: FindPeerByNameRequestParams) { | ||
const { offset, peers, eof } = await this.sdk.findPeerByName(options); | ||
return { offset, eof, peers: peers.map(peer => SDKToHMS.convertPeer(peer) as HMSPeer) }; | ||
} | ||
getPeerListIterator(options?: HMSPeerListIteratorOptions) { | ||
@@ -1101,2 +1107,5 @@ const iterator = this.sdk.getPeerListIterator(options); | ||
}, type); | ||
if (type === sdkTypes.HMSRoomUpdate.TRANSCRIPTION_STATE_UPDATED) { | ||
this.hmsNotifications.sendTranscriptionUpdate(room.transcriptions); | ||
} | ||
} | ||
@@ -1103,0 +1112,0 @@ |
@@ -7,3 +7,3 @@ import { HMSDeviceChangeEvent } from './device-change'; | ||
import { HMSChangeMultiTrackStateRequest, HMSChangeTrackStateRequest, HMSLeaveRoomRequest } from './requests'; | ||
import { HMSPoll } from '../internal'; | ||
import { HMSPoll, HMSTranscriptionInfo } from '../internal'; | ||
@@ -82,2 +82,6 @@ interface BaseNotification { | ||
export interface HMSTranscriptionNotification extends BaseNotification { | ||
type: HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED; | ||
data: HMSTranscriptionInfo[]; | ||
} | ||
export type HMSNotification = | ||
@@ -94,2 +98,3 @@ | HMSPeerNotification | ||
| HMSReconnectionNotification | ||
| HMSTranscriptionNotification | ||
| HMSPlaylistItemNotification<any>; | ||
@@ -132,2 +137,3 @@ | ||
HAND_RAISE_CHANGED = 'HAND_RAISE_CHANGED', | ||
TRANSCRIPTION_STATE_UPDATED = 'TRANSCRIPTION_STATE_UPDATED', | ||
} | ||
@@ -166,2 +172,3 @@ | ||
[HMSNotificationTypes.HAND_RAISE_CHANGED]: HMSPeerNotification; | ||
[HMSNotificationTypes.TRANSCRIPTION_STATE_UPDATED]: HMSTranscriptionNotification; | ||
}[T]; | ||
@@ -168,0 +175,0 @@ |
@@ -62,3 +62,8 @@ import HMSRoom from './models/HMSRoom'; | ||
} from '../media/tracks'; | ||
import { HMSNotificationMethod, PeerLeaveRequestNotification, SendMessage } from '../notification-manager'; | ||
import { | ||
HMSNotificationMethod, | ||
PeerLeaveRequestNotification, | ||
PeerNotificationInfo, | ||
SendMessage, | ||
} from '../notification-manager'; | ||
import { createRemotePeer } from '../notification-manager/managers/utils'; | ||
@@ -70,2 +75,3 @@ import { NotificationManager } from '../notification-manager/NotificationManager'; | ||
import { | ||
FindPeerByNameRequestParams, | ||
HLSRequestParams, | ||
@@ -723,7 +729,7 @@ HLSTimedMetadataParams, | ||
if (isLargeRoom) { | ||
const { peers } = await this.transport.signal.findPeers({ peers: [peerId], limit: 1 }); | ||
if (peers.length === 0) { | ||
const peer = await this.transport.signal.getPeer({ peer_id: peerId }); | ||
if (!peer) { | ||
throw ErrorFactory.GenericErrors.ValidationFailed('Invalid peer - peer not present in the room', peerId); | ||
} | ||
recipientPeer = createRemotePeer(peers[0], this.store); | ||
recipientPeer = createRemotePeer(peer, this.store); | ||
} else { | ||
@@ -745,2 +751,36 @@ throw ErrorFactory.GenericErrors.ValidationFailed('Invalid peer - peer not present in the room', peerId); | ||
async findPeerByName({ query, limit = 10, offset }: FindPeerByNameRequestParams) { | ||
if (!query) { | ||
throw ErrorFactory.GenericErrors.ValidationFailed('Invalid query'); | ||
} | ||
const { | ||
peers, | ||
offset: responseOffset, | ||
eof, | ||
} = await this.transport.signal.findPeerByName({ query: query.toLowerCase(), limit, offset }); | ||
if (peers.length > 0) { | ||
return { | ||
offset: responseOffset, | ||
eof, | ||
peers: peers.map(peerInfo => { | ||
return createRemotePeer( | ||
{ | ||
peer_id: peerInfo.peer_id, | ||
role: peerInfo.role, | ||
groups: [], | ||
info: { | ||
name: peerInfo.name, | ||
data: '', | ||
user_id: '', | ||
type: peerInfo.type, | ||
}, | ||
} as PeerNotificationInfo, | ||
this.store, | ||
); | ||
}), | ||
}; | ||
} | ||
return { offset: responseOffset, peers: [] }; | ||
} | ||
private async sendMessageInternal({ recipientRoles, recipientPeer, type = 'chat', message }: HMSMessageInput) { | ||
@@ -747,0 +787,0 @@ if (message.replace(/\u200b/g, ' ').trim() === '') { |
@@ -6,3 +6,11 @@ import { KnownRoles, TrackStateEntry } from './StoreInterfaces'; | ||
import { HMSAction } from '../../error/HMSAction'; | ||
import { HMSConfig, HMSFrameworkInfo, HMSPermissionType, HMSPoll, HMSSpeaker, HMSWhiteboard } from '../../interfaces'; | ||
import { | ||
HMSConfig, | ||
HMSFrameworkInfo, | ||
HMSPermissionType, | ||
HMSPoll, | ||
HMSSpeaker, | ||
HMSTranscriptionMode, | ||
HMSWhiteboard, | ||
} from '../../interfaces'; | ||
import { SelectedDevices } from '../../interfaces/devices'; | ||
@@ -27,3 +35,3 @@ import { IErrorListener } from '../../interfaces/error-listener'; | ||
} from '../../media/tracks'; | ||
import { PolicyParams } from '../../notification-manager'; | ||
import { Plugins, PolicyParams } from '../../notification-manager'; | ||
import HMSLogger from '../../utils/logger'; | ||
@@ -425,2 +433,3 @@ import { ENV } from '../../utils/support'; | ||
permission: HMSPermissionType, | ||
mode?: HMSTranscriptionMode, | ||
) => { | ||
@@ -432,6 +441,14 @@ if (!this.knownRoles[role]) { | ||
const rolePermissions = this.knownRoles[role].permissions; | ||
if (!rolePermissions[pluginName]) { | ||
rolePermissions[pluginName] = []; | ||
if (pluginName === Plugins.TRANSCRIPTIONS && mode) { | ||
// currently only admin is allowed, so no issue | ||
rolePermissions[pluginName] = { | ||
...rolePermissions[pluginName], | ||
[mode]: [permission], | ||
}; | ||
} else if (pluginName === Plugins.WHITEBOARD) { | ||
if (!rolePermissions[pluginName]) { | ||
rolePermissions[pluginName] = []; | ||
} | ||
rolePermissions[pluginName]?.push(permission); | ||
} | ||
rolePermissions[pluginName]?.push(permission); | ||
}; | ||
@@ -444,7 +461,15 @@ | ||
} | ||
const permissions = plugins[pluginName].permissions; | ||
permissions?.admin?.forEach(role => addPermissionToRole(role, pluginName, 'admin')); | ||
permissions?.reader?.forEach(role => addPermissionToRole(role, pluginName, 'read')); | ||
permissions?.writer?.forEach(role => addPermissionToRole(role, pluginName, 'write')); | ||
if (pluginName === Plugins.WHITEBOARD) { | ||
const permissions = plugins[pluginName]?.permissions; | ||
permissions?.admin?.forEach(role => addPermissionToRole(role, pluginName, 'admin')); | ||
permissions?.reader?.forEach(role => addPermissionToRole(role, pluginName, 'read')); | ||
permissions?.writer?.forEach(role => addPermissionToRole(role, pluginName, 'write')); | ||
} else if (pluginName === Plugins.TRANSCRIPTIONS) { | ||
const transcriptionPlugins = plugins[pluginName] || []; | ||
for (const transcription of transcriptionPlugins) { | ||
transcription.permissions?.admin?.forEach(role => | ||
addPermissionToRole(role, pluginName, 'admin', transcription.mode), | ||
); | ||
} | ||
} | ||
}); | ||
@@ -451,0 +476,0 @@ } |
@@ -7,2 +7,3 @@ import { createSelector } from 'reselect'; | ||
selectLocalPeerID, | ||
selectLocalPeerRole, | ||
selectMessagesMap, | ||
@@ -23,2 +24,3 @@ selectPeers, | ||
import { HMSLogger } from '../common/ui-logger'; | ||
import { HMSTranscriptionMode } from '../internal'; | ||
import { | ||
@@ -534,1 +536,10 @@ HMSAudioTrack, | ||
}); | ||
export const selectIsTranscriptionAllowedByMode = (mode: HMSTranscriptionMode) => | ||
createSelector(selectLocalPeerRole, role => { | ||
if (!role?.permissions.transcriptions) { | ||
return false; | ||
} | ||
// only one admin permission | ||
return role.permissions.transcriptions[mode].length > 0; | ||
}); |
import { HMSPermissionType } from '../../interfaces'; | ||
import { PeerNotificationInfo } from '../../notification-manager'; | ||
import { FindPeerByNameInfo, PeerNotificationInfo } from '../../notification-manager'; | ||
@@ -35,2 +35,10 @@ export interface BroadcastResponse { | ||
export interface FindPeerByNameResponse { | ||
count: number; | ||
limit: number; | ||
offset: number; | ||
eof: boolean; | ||
peers: FindPeerByNameInfo[]; | ||
} | ||
export interface CreateWhiteboardResponse { | ||
@@ -37,0 +45,0 @@ id: string; |
@@ -87,7 +87,7 @@ import { HMSTrackSource, HMSTranscriptionMode } from '../..'; | ||
export interface getPeerRequestParams { | ||
export interface GetPeerRequestParams { | ||
peer_id: string; | ||
} | ||
export interface findPeersRequestParams { | ||
export interface FindPeersRequestParams { | ||
peers?: string[]; | ||
@@ -99,5 +99,11 @@ role?: string; | ||
export interface peerIterRequestParams { | ||
export interface FindPeerByNameRequestParams { | ||
query?: string; | ||
limit?: number; | ||
offset?: number; | ||
} | ||
export interface PeerIterRequestParams { | ||
iterator: string; | ||
limit: number; | ||
} |
@@ -23,4 +23,6 @@ import { v4 as uuid } from 'uuid'; | ||
CreateWhiteboardResponse, | ||
findPeersRequestParams, | ||
getPeerRequestParams, | ||
FindPeerByNameRequestParams, | ||
FindPeerByNameResponse, | ||
FindPeersRequestParams, | ||
GetPeerRequestParams, | ||
GetSessionMetadataResponse, | ||
@@ -34,3 +36,3 @@ GetWhiteboardResponse, | ||
MultiTrackUpdateRequestParams, | ||
peerIterRequestParams, | ||
PeerIterRequestParams, | ||
PeersIterationResponse, | ||
@@ -386,3 +388,3 @@ PollInfoGetParams, | ||
async getPeer(params: getPeerRequestParams): Promise<PeerNotificationInfo | undefined> { | ||
async getPeer(params: GetPeerRequestParams): Promise<PeerNotificationInfo | undefined> { | ||
return await this.call(HMSSignalMethod.GET_PEER, { ...params }); | ||
@@ -407,10 +409,14 @@ } | ||
async peerIterNext(params: peerIterRequestParams): Promise<PeersIterationResponse> { | ||
async peerIterNext(params: PeerIterRequestParams): Promise<PeersIterationResponse> { | ||
return await this.call(HMSSignalMethod.PEER_ITER_NEXT, params); | ||
} | ||
async findPeers(params: findPeersRequestParams): Promise<PeersIterationResponse> { | ||
async findPeers(params: FindPeersRequestParams): Promise<PeersIterationResponse> { | ||
return await this.call(HMSSignalMethod.FIND_PEER, params); | ||
} | ||
async findPeerByName(params: FindPeerByNameRequestParams): Promise<FindPeerByNameResponse> { | ||
return await this.call(HMSSignalMethod.SEARCH_BY_NAME, params); | ||
} | ||
setSessionMetadata(params: SetSessionMetadataParams) { | ||
@@ -417,0 +423,0 @@ if (!this.isConnected) { |
@@ -61,2 +61,3 @@ import { HMSAction } from '../../error/HMSAction'; | ||
FIND_PEER = 'find-peer', | ||
SEARCH_BY_NAME = 'peer-name-search', | ||
PEER_ITER_NEXT = 'peer-iter-next', | ||
@@ -63,0 +64,0 @@ GROUP_JOIN = 'group-join', |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4473497
38521