@stream-io/video-client 0.0.1-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +219 -0
- package/README.md +14 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +14663 -0
- package/dist/index.js.map +1 -0
- package/dist/src/Batcher.d.ts +12 -0
- package/dist/src/CallDropScheduler.d.ts +44 -0
- package/dist/src/StreamSfuClient.d.ts +25 -0
- package/dist/src/StreamVideoClient.d.ts +145 -0
- package/dist/src/__tests__/StreamVideoClient.test.d.ts +1 -0
- package/dist/src/config/defaultConfigs.d.ts +2 -0
- package/dist/src/config/types.d.ts +29 -0
- package/dist/src/coordinator/StreamCoordinatorClient.d.ts +19 -0
- package/dist/src/coordinator/connection/base64.d.ts +2 -0
- package/dist/src/coordinator/connection/client.d.ts +174 -0
- package/dist/src/coordinator/connection/connection.d.ts +139 -0
- package/dist/src/coordinator/connection/connection_fallback.d.ts +38 -0
- package/dist/src/coordinator/connection/errors.d.ts +16 -0
- package/dist/src/coordinator/connection/events.d.ts +7 -0
- package/dist/src/coordinator/connection/insights.d.ts +58 -0
- package/dist/src/coordinator/connection/signing.d.ts +30 -0
- package/dist/src/coordinator/connection/token_manager.d.ts +39 -0
- package/dist/src/coordinator/connection/types.d.ts +96 -0
- package/dist/src/coordinator/connection/utils.d.ts +25 -0
- package/dist/src/devices.d.ts +79 -0
- package/dist/src/events/call.d.ts +26 -0
- package/dist/src/events/internal.d.ts +8 -0
- package/dist/src/events/participant.d.ts +21 -0
- package/dist/src/events/speaker.d.ts +10 -0
- package/dist/src/gen/coordinator/index.d.ts +1664 -0
- package/dist/src/gen/google/protobuf/descriptor.d.ts +1650 -0
- package/dist/src/gen/google/protobuf/duration.d.ts +113 -0
- package/dist/src/gen/google/protobuf/struct.d.ts +184 -0
- package/dist/src/gen/google/protobuf/timestamp.d.ts +158 -0
- package/dist/src/gen/video/coordinator/broadcast_v1/broadcast.d.ts +66 -0
- package/dist/src/gen/video/coordinator/call_v1/call.d.ts +254 -0
- package/dist/src/gen/video/coordinator/client_v1_rpc/client_rpc.client.d.ts +351 -0
- package/dist/src/gen/video/coordinator/client_v1_rpc/client_rpc.d.ts +1488 -0
- package/dist/src/gen/video/coordinator/client_v1_rpc/envelopes.d.ts +143 -0
- package/dist/src/gen/video/coordinator/client_v1_rpc/websocket.d.ts +292 -0
- package/dist/src/gen/video/coordinator/edge_v1/edge.d.ts +183 -0
- package/dist/src/gen/video/coordinator/event_v1/event.d.ts +411 -0
- package/dist/src/gen/video/coordinator/geofence_v1/geofence.d.ts +63 -0
- package/dist/src/gen/video/coordinator/member_v1/member.d.ts +59 -0
- package/dist/src/gen/video/coordinator/participant_v1/participant.d.ts +103 -0
- package/dist/src/gen/video/coordinator/push_v1/push.d.ts +240 -0
- package/dist/src/gen/video/coordinator/stat_v1/stat.d.ts +308 -0
- package/dist/src/gen/video/coordinator/user_v1/user.d.ts +112 -0
- package/dist/src/gen/video/coordinator/utils_v1/utils.d.ts +47 -0
- package/dist/src/gen/video/sfu/event/events.d.ts +736 -0
- package/dist/src/gen/video/sfu/models/models.d.ts +460 -0
- package/dist/src/gen/video/sfu/signal_rpc/signal.client.d.ts +89 -0
- package/dist/src/gen/video/sfu/signal_rpc/signal.d.ts +320 -0
- package/dist/src/helpers/browsers.d.ts +8 -0
- package/dist/src/helpers/sound-detector.d.ts +34 -0
- package/dist/src/rpc/createClient.d.ts +10 -0
- package/dist/src/rpc/index.d.ts +2 -0
- package/dist/src/rpc/latency.d.ts +9 -0
- package/dist/src/rtc/Call.d.ts +180 -0
- package/dist/src/rtc/CallMetadata.d.ts +9 -0
- package/dist/src/rtc/Dispatcher.d.ts +9 -0
- package/dist/src/rtc/IceTrickleBuffer.d.ts +11 -0
- package/dist/src/rtc/callEventHandlers.d.ts +5 -0
- package/dist/src/rtc/codecs.d.ts +2 -0
- package/dist/src/rtc/helpers/iceCandidate.d.ts +2 -0
- package/dist/src/rtc/helpers/tracks.d.ts +3 -0
- package/dist/src/rtc/publisher.d.ts +53 -0
- package/dist/src/rtc/signal.d.ts +5 -0
- package/dist/src/rtc/subscriber.d.ts +7 -0
- package/dist/src/rtc/types.d.ts +84 -0
- package/dist/src/rtc/videoLayers.d.ts +17 -0
- package/dist/src/stats/coordinator-stats-reporter.d.ts +10 -0
- package/dist/src/stats/state-store-stats-reporter.d.ts +57 -0
- package/dist/src/stats/types.d.ts +42 -0
- package/dist/src/store/index.d.ts +2 -0
- package/dist/src/store/rxUtils.d.ts +18 -0
- package/dist/src/store/stateStore.d.ts +182 -0
- package/generate-openapi.sh +32 -0
- package/index.ts +30 -0
- package/openapitools.json +7 -0
- package/package.json +54 -0
- package/rollup.config.mjs +48 -0
- package/src/Batcher.ts +43 -0
- package/src/CallDropScheduler.ts +192 -0
- package/src/StreamSfuClient.ts +185 -0
- package/src/StreamVideoClient.ts +487 -0
- package/src/__tests__/StreamVideoClient.test.ts +83 -0
- package/src/config/defaultConfigs.ts +15 -0
- package/src/config/types.ts +30 -0
- package/src/coordinator/StreamCoordinatorClient.ts +111 -0
- package/src/coordinator/connection/base64.ts +80 -0
- package/src/coordinator/connection/client.ts +815 -0
- package/src/coordinator/connection/connection.ts +750 -0
- package/src/coordinator/connection/connection_fallback.ts +239 -0
- package/src/coordinator/connection/errors.ts +70 -0
- package/src/coordinator/connection/events.ts +10 -0
- package/src/coordinator/connection/insights.ts +88 -0
- package/src/coordinator/connection/signing.ts +104 -0
- package/src/coordinator/connection/token_manager.ts +160 -0
- package/src/coordinator/connection/types.ts +120 -0
- package/src/coordinator/connection/utils.ts +148 -0
- package/src/devices.ts +266 -0
- package/src/events/call.ts +166 -0
- package/src/events/internal.ts +47 -0
- package/src/events/participant.ts +97 -0
- package/src/events/speaker.ts +62 -0
- package/src/gen/coordinator/index.ts +1653 -0
- package/src/gen/google/protobuf/descriptor.ts +3466 -0
- package/src/gen/google/protobuf/duration.ts +232 -0
- package/src/gen/google/protobuf/struct.ts +481 -0
- package/src/gen/google/protobuf/timestamp.ts +291 -0
- package/src/gen/video/coordinator/broadcast_v1/broadcast.ts +154 -0
- package/src/gen/video/coordinator/call_v1/call.ts +651 -0
- package/src/gen/video/coordinator/client_v1_rpc/client_rpc.client.ts +463 -0
- package/src/gen/video/coordinator/client_v1_rpc/client_rpc.ts +3819 -0
- package/src/gen/video/coordinator/client_v1_rpc/envelopes.ts +424 -0
- package/src/gen/video/coordinator/client_v1_rpc/websocket.ts +719 -0
- package/src/gen/video/coordinator/edge_v1/edge.ts +532 -0
- package/src/gen/video/coordinator/event_v1/event.ts +1171 -0
- package/src/gen/video/coordinator/geofence_v1/geofence.ts +128 -0
- package/src/gen/video/coordinator/member_v1/member.ts +138 -0
- package/src/gen/video/coordinator/participant_v1/participant.ts +261 -0
- package/src/gen/video/coordinator/push_v1/push.ts +651 -0
- package/src/gen/video/coordinator/stat_v1/stat.ts +656 -0
- package/src/gen/video/coordinator/user_v1/user.ts +277 -0
- package/src/gen/video/coordinator/utils_v1/utils.ts +98 -0
- package/src/gen/video/sfu/event/events.ts +1962 -0
- package/src/gen/video/sfu/models/models.ts +1062 -0
- package/src/gen/video/sfu/signal_rpc/signal.client.ts +108 -0
- package/src/gen/video/sfu/signal_rpc/signal.ts +906 -0
- package/src/helpers/browsers.ts +13 -0
- package/src/helpers/sound-detector.ts +85 -0
- package/src/rpc/createClient.ts +50 -0
- package/src/rpc/index.ts +2 -0
- package/src/rpc/latency.ts +43 -0
- package/src/rtc/Call.ts +585 -0
- package/src/rtc/CallMetadata.ts +24 -0
- package/src/rtc/Dispatcher.ts +46 -0
- package/src/rtc/IceTrickleBuffer.ts +21 -0
- package/src/rtc/callEventHandlers.ts +37 -0
- package/src/rtc/codecs.ts +61 -0
- package/src/rtc/helpers/iceCandidate.ts +16 -0
- package/src/rtc/helpers/tracks.ts +18 -0
- package/src/rtc/publisher.ts +305 -0
- package/src/rtc/signal.ts +34 -0
- package/src/rtc/subscriber.ts +85 -0
- package/src/rtc/types.ts +105 -0
- package/src/rtc/videoLayers.ts +103 -0
- package/src/stats/coordinator-stats-reporter.ts +167 -0
- package/src/stats/state-store-stats-reporter.ts +364 -0
- package/src/stats/types.ts +46 -0
- package/src/store/index.ts +2 -0
- package/src/store/rxUtils.ts +42 -0
- package/src/store/stateStore.ts +341 -0
- package/tsconfig.json +25 -0
- package/typedoc.json +11 -0
- package/vite.config.ts +11 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/// <reference types="ws" />
|
|
2
|
+
import { StableWSConnection } from './connection';
|
|
3
|
+
export type InsightTypes = 'ws_fatal' | 'ws_success_after_failure' | 'http_hi_failed';
|
|
4
|
+
export declare class InsightMetrics {
|
|
5
|
+
connectionStartTimestamp: number | null;
|
|
6
|
+
wsConsecutiveFailures: number;
|
|
7
|
+
wsTotalFailures: number;
|
|
8
|
+
instanceClientId: string;
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* postInsights is not supposed to be used by end users directly within chat application, and thus is kept isolated
|
|
13
|
+
* from all the client/connection code/logic.
|
|
14
|
+
*
|
|
15
|
+
* @param insightType
|
|
16
|
+
* @param insights
|
|
17
|
+
*/
|
|
18
|
+
export declare const postInsights: (insightType: InsightTypes, insights: Record<string, unknown>) => Promise<void>;
|
|
19
|
+
export declare function buildWsFatalInsight(connection: StableWSConnection, event: Record<string, unknown>): {
|
|
20
|
+
ready_state: 0 | 1 | 2 | 3 | undefined;
|
|
21
|
+
url: string;
|
|
22
|
+
api_key: string;
|
|
23
|
+
start_ts: number | null;
|
|
24
|
+
end_ts: number;
|
|
25
|
+
auth_type: string;
|
|
26
|
+
token: string | undefined;
|
|
27
|
+
user_id: string | undefined;
|
|
28
|
+
user_details: import("./types").UserResponse | import("./types").OwnUserResponse | undefined;
|
|
29
|
+
device: string;
|
|
30
|
+
client_id: string | undefined;
|
|
31
|
+
ws_details: import("ws") | undefined;
|
|
32
|
+
ws_consecutive_failures: number;
|
|
33
|
+
ws_total_failures: number;
|
|
34
|
+
request_id: string | undefined;
|
|
35
|
+
online: boolean | null;
|
|
36
|
+
user_agent: string | null;
|
|
37
|
+
instance_client_id: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function buildWsSuccessAfterFailureInsight(connection: StableWSConnection): {
|
|
40
|
+
ready_state: 0 | 1 | 2 | 3 | undefined;
|
|
41
|
+
url: string;
|
|
42
|
+
api_key: string;
|
|
43
|
+
start_ts: number | null;
|
|
44
|
+
end_ts: number;
|
|
45
|
+
auth_type: string;
|
|
46
|
+
token: string | undefined;
|
|
47
|
+
user_id: string | undefined;
|
|
48
|
+
user_details: import("./types").UserResponse | import("./types").OwnUserResponse | undefined;
|
|
49
|
+
device: string;
|
|
50
|
+
client_id: string | undefined;
|
|
51
|
+
ws_details: import("ws") | undefined;
|
|
52
|
+
ws_consecutive_failures: number;
|
|
53
|
+
ws_total_failures: number;
|
|
54
|
+
request_id: string | undefined;
|
|
55
|
+
online: boolean | null;
|
|
56
|
+
user_agent: string | null;
|
|
57
|
+
instance_client_id: string;
|
|
58
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Secret, SignOptions } from 'jsonwebtoken';
|
|
2
|
+
import { UR } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Creates the JWT token that can be used for a UserSession
|
|
5
|
+
* @method JWTUserToken
|
|
6
|
+
* @memberof signing
|
|
7
|
+
* @private
|
|
8
|
+
* @param {Secret} apiSecret - API Secret key
|
|
9
|
+
* @param {string} userId - The user_id key in the JWT payload
|
|
10
|
+
* @param {UR} [extraData] - Extra that should be part of the JWT token
|
|
11
|
+
* @param {SignOptions} [jwtOptions] - Options that can be past to jwt.sign
|
|
12
|
+
* @return {string} JWT Token
|
|
13
|
+
*/
|
|
14
|
+
export declare function JWTUserToken(apiSecret: Secret, userId: string, extraData?: UR, jwtOptions?: SignOptions): string;
|
|
15
|
+
export declare function JWTServerToken(apiSecret: Secret, jwtOptions?: SignOptions): string;
|
|
16
|
+
export declare function UserFromToken(token: string): string;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {string} userId the id of the user
|
|
20
|
+
* @return {string}
|
|
21
|
+
*/
|
|
22
|
+
export declare function DevToken(userId: string): string;
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param {string} body the signed message
|
|
26
|
+
* @param {string} secret the shared secret used to generate the signature (Stream API secret)
|
|
27
|
+
* @param {string} signature the signature to validate
|
|
28
|
+
* @return {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export declare function CheckSignature(body: string, secret: string, signature: string): boolean;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Secret } from 'jsonwebtoken';
|
|
2
|
+
import { TokenOrProvider, UserResponse } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* TokenManager
|
|
5
|
+
*
|
|
6
|
+
* Handles all the operations around user token.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TokenManager {
|
|
9
|
+
loadTokenPromise: Promise<string> | null;
|
|
10
|
+
type: 'static' | 'provider';
|
|
11
|
+
secret?: Secret;
|
|
12
|
+
token?: string;
|
|
13
|
+
tokenProvider?: TokenOrProvider;
|
|
14
|
+
user?: UserResponse;
|
|
15
|
+
/**
|
|
16
|
+
* Constructor
|
|
17
|
+
*
|
|
18
|
+
* @param {Secret} secret
|
|
19
|
+
*/
|
|
20
|
+
constructor(secret?: Secret);
|
|
21
|
+
/**
|
|
22
|
+
* Set the static string token or token provider.
|
|
23
|
+
* Token provider should return a token string or a promise which resolves to string token.
|
|
24
|
+
*
|
|
25
|
+
* @param {TokenOrProvider} tokenOrProvider
|
|
26
|
+
* @param {UserResponse} user
|
|
27
|
+
*/
|
|
28
|
+
setTokenOrProvider: (tokenOrProvider: TokenOrProvider, user: UserResponse) => Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Resets the token manager.
|
|
31
|
+
* Useful for client disconnection or switching user.
|
|
32
|
+
*/
|
|
33
|
+
reset: () => void;
|
|
34
|
+
validateToken: (tokenOrProvider: TokenOrProvider, user: UserResponse) => void;
|
|
35
|
+
tokenReady: () => Promise<string> | null;
|
|
36
|
+
loadToken: () => Promise<string>;
|
|
37
|
+
getToken: () => string | undefined;
|
|
38
|
+
isStatic: () => boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { EVENT_MAP } from './events';
|
|
3
|
+
import { StableWSConnection } from './connection';
|
|
4
|
+
export type UR = Record<string, unknown>;
|
|
5
|
+
export type User = {
|
|
6
|
+
id: string;
|
|
7
|
+
anon?: boolean;
|
|
8
|
+
name?: string;
|
|
9
|
+
role?: string;
|
|
10
|
+
teams?: string[];
|
|
11
|
+
username?: string;
|
|
12
|
+
};
|
|
13
|
+
export type UserResponse = User & {
|
|
14
|
+
banned?: boolean;
|
|
15
|
+
created_at?: string;
|
|
16
|
+
deactivated_at?: string;
|
|
17
|
+
deleted_at?: string;
|
|
18
|
+
last_active?: string;
|
|
19
|
+
online?: boolean;
|
|
20
|
+
revoke_tokens_issued_before?: string;
|
|
21
|
+
shadow_banned?: boolean;
|
|
22
|
+
updated_at?: string;
|
|
23
|
+
};
|
|
24
|
+
export type OwnUserBase = {
|
|
25
|
+
invisible?: boolean;
|
|
26
|
+
roles?: string[];
|
|
27
|
+
};
|
|
28
|
+
export type OwnUserResponse = UserResponse & OwnUserBase;
|
|
29
|
+
export type ConnectionOpen = {
|
|
30
|
+
connection_id: string;
|
|
31
|
+
cid?: string;
|
|
32
|
+
created_at?: string;
|
|
33
|
+
me?: OwnUserResponse;
|
|
34
|
+
type?: string;
|
|
35
|
+
};
|
|
36
|
+
export type ConnectAPIResponse = Promise<void | ConnectionOpen>;
|
|
37
|
+
export type LogLevel = 'info' | 'error' | 'warn';
|
|
38
|
+
type ErrorResponseDetails = {
|
|
39
|
+
code: number;
|
|
40
|
+
messages: string[];
|
|
41
|
+
};
|
|
42
|
+
export type APIErrorResponse = {
|
|
43
|
+
code: number;
|
|
44
|
+
duration: string;
|
|
45
|
+
message: string;
|
|
46
|
+
more_info: string;
|
|
47
|
+
StatusCode: number;
|
|
48
|
+
details?: ErrorResponseDetails;
|
|
49
|
+
};
|
|
50
|
+
export declare class ErrorFromResponse<T> extends Error {
|
|
51
|
+
code?: number;
|
|
52
|
+
response?: AxiosResponse<T>;
|
|
53
|
+
status?: number;
|
|
54
|
+
}
|
|
55
|
+
export type EventTypes = 'all' | keyof typeof EVENT_MAP;
|
|
56
|
+
export type Event = {
|
|
57
|
+
type: EventTypes;
|
|
58
|
+
received_at?: string | Date;
|
|
59
|
+
online?: boolean;
|
|
60
|
+
mode?: string;
|
|
61
|
+
};
|
|
62
|
+
export type EventHandler = (event: Event) => void;
|
|
63
|
+
export type Logger = (logLevel: LogLevel, message: string, extraData?: Record<string, unknown>) => void;
|
|
64
|
+
export type StreamClientOptions = Partial<AxiosRequestConfig> & {
|
|
65
|
+
/**
|
|
66
|
+
* Used to disable warnings that are triggered by using connectUser or connectAnonymousUser server-side.
|
|
67
|
+
*/
|
|
68
|
+
allowServerSideConnect?: boolean;
|
|
69
|
+
axiosRequestConfig?: AxiosRequestConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Base url to use for API
|
|
72
|
+
* such as https://chat-proxy-dublin.stream-io-api.com
|
|
73
|
+
*/
|
|
74
|
+
baseURL?: string;
|
|
75
|
+
browser?: boolean;
|
|
76
|
+
enableInsights?: boolean;
|
|
77
|
+
/** experimental feature, please contact support if you want this feature enabled for you */
|
|
78
|
+
enableWSFallback?: boolean;
|
|
79
|
+
logger?: Logger;
|
|
80
|
+
/**
|
|
81
|
+
* When true, user will be persisted on client. Otherwise if `connectUser` call fails, then you need to
|
|
82
|
+
* call `connectUser` again to retry.
|
|
83
|
+
* This is mainly useful for chat application working in offline mode, where you will need client.user to
|
|
84
|
+
* persist even if connectUser call fails.
|
|
85
|
+
*/
|
|
86
|
+
persistUserOnConnectionFailure?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The secret key for the API key. This is only needed for server side authentication.
|
|
89
|
+
*/
|
|
90
|
+
secret?: string;
|
|
91
|
+
warmUp?: boolean;
|
|
92
|
+
wsConnection?: StableWSConnection;
|
|
93
|
+
};
|
|
94
|
+
export type TokenProvider = () => Promise<string>;
|
|
95
|
+
export type TokenOrProvider = null | string | TokenProvider | undefined;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const sleep: (m: number) => Promise<void>;
|
|
2
|
+
export declare function isFunction<T>(value: Function | T): value is Function;
|
|
3
|
+
export declare const chatCodes: {
|
|
4
|
+
TOKEN_EXPIRED: number;
|
|
5
|
+
WS_CLOSED_SUCCESS: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* retryInterval - A retry interval which increases acc to number of failures
|
|
9
|
+
*
|
|
10
|
+
* @return {number} Duration to wait in milliseconds
|
|
11
|
+
*/
|
|
12
|
+
export declare function retryInterval(numberOfFailures: number): number;
|
|
13
|
+
export declare function randomId(): string;
|
|
14
|
+
export declare function generateUUIDv4(): string;
|
|
15
|
+
export declare function convertErrorToJson(err: Error): Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* isOnline safely return the navigator.online value for browser env
|
|
18
|
+
* if navigator is not in global object, it always return true
|
|
19
|
+
*/
|
|
20
|
+
export declare function isOnline(): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* listenForConnectionChanges - Adds an event listener fired on browser going online or offline
|
|
23
|
+
*/
|
|
24
|
+
export declare function addConnectionEventListeners(cb: (e: Event) => void): void;
|
|
25
|
+
export declare function removeConnectionEventListeners(cb: (e: Event) => void): void;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
/**
|
|
3
|
+
* [Tells if the browser supports audio output change on 'audio' elements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId).
|
|
4
|
+
*
|
|
5
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
6
|
+
*/
|
|
7
|
+
export declare const checkIfAudioOutputChangeSupported: () => boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audioinput' devices, if devices are added/removed the list is updated.
|
|
10
|
+
*
|
|
11
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare const getAudioDevices: () => Observable<MediaDeviceInfo[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Prompts the user for a permission to use video devices (if not already granted) and lists the available 'videoinput' devices, if devices are added/removed the list is updated.
|
|
17
|
+
*
|
|
18
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare const getVideoDevices: () => Observable<MediaDeviceInfo[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Prompts the user for a permission to use audio devices (if not already granted) and lists the available 'audiooutput' devices, if devices are added/removed the list is updated. Selecting 'audiooutput' device only makes sense if [the browser has support for changing audio output on 'audio' elements](#checkifaudiooutputchangesupported)
|
|
24
|
+
*
|
|
25
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
export declare const getAudioOutputDevices: () => Observable<MediaDeviceInfo[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Returns an 'audioinput' media stream with the given `deviceId`, if no `deviceId` is provided, it uses the first available device.
|
|
31
|
+
*
|
|
32
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
33
|
+
* @param deviceId
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
export declare const getAudioStream: (deviceId?: string) => Promise<MediaStream>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns a 'videoinput' media stream with the given `deviceId`, if no `deviceId` is provided, it uses the first available device.
|
|
39
|
+
*
|
|
40
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
41
|
+
* @param deviceId
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
export declare const getVideoStream: (deviceId?: string) => Promise<MediaStream>;
|
|
45
|
+
/**
|
|
46
|
+
* Prompts the user for a permission to share a screen.
|
|
47
|
+
* If the user grants the permission, a screen sharing stream is returned. Throws otherwise.
|
|
48
|
+
*
|
|
49
|
+
* The callers of this API are responsible to handle the possible errors.
|
|
50
|
+
*
|
|
51
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
52
|
+
*
|
|
53
|
+
* @param options any additional options to pass to the [`getDisplayMedia`](https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia) API.
|
|
54
|
+
*/
|
|
55
|
+
export declare const getScreenShareStream: (options?: Record<string, any>) => Promise<MediaStream>;
|
|
56
|
+
/**
|
|
57
|
+
* Notifies the subscriber if a given 'audioinput' device is disconnected
|
|
58
|
+
*
|
|
59
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
60
|
+
* @param deviceId$ an Observable that specifies which device to watch for
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
export declare const watchForDisconnectedAudioDevice: (deviceId$: Observable<string | undefined>) => Observable<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Notifies the subscriber if a given 'videoinput' device is disconnected
|
|
66
|
+
*
|
|
67
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
68
|
+
* @param deviceId$ an Observable that specifies which device to watch for
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
export declare const watchForDisconnectedVideoDevice: (deviceId$: Observable<string | undefined>) => Observable<boolean>;
|
|
72
|
+
/**
|
|
73
|
+
* Notifies the subscriber if a given 'audiooutput' device is disconnected
|
|
74
|
+
*
|
|
75
|
+
* @angular It's recommended to use the [`DeviceManagerService`](./DeviceManagerService.md) for a higher level API, use this low-level method only if the `DeviceManagerService` doesn't suit your requirements.
|
|
76
|
+
* @param deviceId$ an Observable that specifies which device to watch for
|
|
77
|
+
* @returns
|
|
78
|
+
*/
|
|
79
|
+
export declare const watchForDisconnectedAudioOutputDevice: (deviceId$: Observable<string | undefined>) => Observable<boolean>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StreamVideoWriteableStateStore } from '../store';
|
|
2
|
+
import { CallAccepted, CallCancelled, CallCreated, CallRejected } from '../gen/coordinator';
|
|
3
|
+
/**
|
|
4
|
+
* Event handler that watches the delivery of CallCreated Websocket event
|
|
5
|
+
* Updates the state store and notifies its subscribers that
|
|
6
|
+
* a new pending call has been initiated.
|
|
7
|
+
*/
|
|
8
|
+
export declare const watchCallCreated: (store: StreamVideoWriteableStateStore) => (event: CallCreated) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Event handler that watched the delivery of CallAccepted Websocket event
|
|
11
|
+
* Updates the state store and notifies its subscribers that
|
|
12
|
+
* the given user will be joining the call.
|
|
13
|
+
*/
|
|
14
|
+
export declare const watchCallAccepted: (store: StreamVideoWriteableStateStore) => (event: CallAccepted) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Event handler that watches delivery of CallRejected Websocket event.
|
|
17
|
+
* Updates the state store and notifies its subscribers that
|
|
18
|
+
* the given user will not be joining the call.
|
|
19
|
+
*/
|
|
20
|
+
export declare const watchCallRejected: (store: StreamVideoWriteableStateStore) => (event: CallRejected) => void;
|
|
21
|
+
/**
|
|
22
|
+
* Event handler that watches the delivery of CallCancelled Websocket event
|
|
23
|
+
* Updates the state store and notifies its subscribers that
|
|
24
|
+
* the call is now considered terminated.
|
|
25
|
+
*/
|
|
26
|
+
export declare const watchCallCancelled: (store: StreamVideoWriteableStateStore) => (event: CallCancelled) => void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dispatcher } from '../rtc/Dispatcher';
|
|
2
|
+
import { Call } from '../rtc/Call';
|
|
3
|
+
import { StreamVideoWriteableStateStore } from '../store';
|
|
4
|
+
/**
|
|
5
|
+
* An event responder which handles the `changePublishQuality` event.
|
|
6
|
+
*/
|
|
7
|
+
export declare const watchChangePublishQuality: (dispatcher: Dispatcher, call: Call) => () => void;
|
|
8
|
+
export declare const watchConnectionQualityChanged: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore) => () => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Batcher } from '../Batcher';
|
|
2
|
+
import { Dispatcher } from '../rtc/Dispatcher';
|
|
3
|
+
import { StreamVideoWriteableStateStore } from '../store';
|
|
4
|
+
/**
|
|
5
|
+
* An event responder which handles the `participantJoined` event.
|
|
6
|
+
*/
|
|
7
|
+
export declare const watchParticipantJoined: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore, userBatcher: Batcher<string>) => () => void;
|
|
8
|
+
/**
|
|
9
|
+
* An event responder which handles the `participantLeft` event.
|
|
10
|
+
*/
|
|
11
|
+
export declare const watchParticipantLeft: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore) => () => void;
|
|
12
|
+
/**
|
|
13
|
+
* An event responder which handles the `trackPublished` event.
|
|
14
|
+
* The SFU will send this event when a participant publishes a track.
|
|
15
|
+
*/
|
|
16
|
+
export declare const watchTrackPublished: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore) => () => void;
|
|
17
|
+
/**
|
|
18
|
+
* An event responder which handles the `trackUnpublished` event.
|
|
19
|
+
* The SFU will send this event when a participant unpublishes a track.
|
|
20
|
+
*/
|
|
21
|
+
export declare const watchTrackUnpublished: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore) => () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatcher } from '../rtc/Dispatcher';
|
|
2
|
+
import { StreamVideoWriteableStateStore } from '../store';
|
|
3
|
+
/**
|
|
4
|
+
* Watches for `dominantSpeakerChanged` events.
|
|
5
|
+
*/
|
|
6
|
+
export declare const watchDominantSpeakerChanged: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore) => () => void;
|
|
7
|
+
/**
|
|
8
|
+
* Watches for `audioLevelChanged` events.
|
|
9
|
+
*/
|
|
10
|
+
export declare const watchAudioLevelChanged: (dispatcher: Dispatcher, store: StreamVideoWriteableStateStore) => () => void;
|