@unwanted/matrix-sdk-mini 34.12.0-1 → 34.12.0-2
Sign up to get free protection for your applications and to get access to all the features.
- package/git-revision.txt +1 -1
- package/lib/@types/event.d.ts +0 -19
- package/lib/@types/event.d.ts.map +1 -1
- package/lib/@types/event.js.map +1 -1
- package/lib/client.d.ts +2 -50
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +391 -501
- package/lib/client.js.map +1 -1
- package/lib/embedded.d.ts.map +1 -1
- package/lib/embedded.js +0 -1
- package/lib/embedded.js.map +1 -1
- package/lib/matrix.d.ts +0 -6
- package/lib/matrix.d.ts.map +1 -1
- package/lib/matrix.js +1 -5
- package/lib/matrix.js.map +1 -1
- package/package.json +1 -1
- package/src/@types/event.ts +2 -36
- package/src/client.ts +1 -150
- package/src/embedded.ts +0 -2
- package/src/matrix.ts +0 -13
- package/lib/matrixrtc/CallMembership.d.ts +0 -66
- package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
- package/lib/matrixrtc/CallMembership.js +0 -197
- package/lib/matrixrtc/CallMembership.js.map +0 -1
- package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
- package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
- package/lib/matrixrtc/LivekitFocus.js +0 -20
- package/lib/matrixrtc/LivekitFocus.js.map +0 -1
- package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
- package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
- package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
- package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
- package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
- package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
- package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
- package/lib/matrixrtc/focus.d.ts +0 -10
- package/lib/matrixrtc/focus.d.ts.map +0 -1
- package/lib/matrixrtc/focus.js +0 -1
- package/lib/matrixrtc/focus.js.map +0 -1
- package/lib/matrixrtc/index.d.ts +0 -7
- package/lib/matrixrtc/index.d.ts.map +0 -1
- package/lib/matrixrtc/index.js +0 -21
- package/lib/matrixrtc/index.js.map +0 -1
- package/lib/matrixrtc/types.d.ts +0 -19
- package/lib/matrixrtc/types.d.ts.map +0 -1
- package/lib/matrixrtc/types.js +0 -1
- package/lib/matrixrtc/types.js.map +0 -1
- package/lib/webrtc/audioContext.d.ts +0 -15
- package/lib/webrtc/audioContext.d.ts.map +0 -1
- package/lib/webrtc/audioContext.js +0 -46
- package/lib/webrtc/audioContext.js.map +0 -1
- package/lib/webrtc/call.d.ts +0 -560
- package/lib/webrtc/call.d.ts.map +0 -1
- package/lib/webrtc/call.js +0 -2541
- package/lib/webrtc/call.js.map +0 -1
- package/lib/webrtc/callEventHandler.d.ts +0 -37
- package/lib/webrtc/callEventHandler.d.ts.map +0 -1
- package/lib/webrtc/callEventHandler.js +0 -344
- package/lib/webrtc/callEventHandler.js.map +0 -1
- package/lib/webrtc/callEventTypes.d.ts +0 -73
- package/lib/webrtc/callEventTypes.d.ts.map +0 -1
- package/lib/webrtc/callEventTypes.js +0 -13
- package/lib/webrtc/callEventTypes.js.map +0 -1
- package/lib/webrtc/callFeed.d.ts +0 -128
- package/lib/webrtc/callFeed.d.ts.map +0 -1
- package/lib/webrtc/callFeed.js +0 -289
- package/lib/webrtc/callFeed.js.map +0 -1
- package/lib/webrtc/groupCall.d.ts +0 -323
- package/lib/webrtc/groupCall.d.ts.map +0 -1
- package/lib/webrtc/groupCall.js +0 -1337
- package/lib/webrtc/groupCall.js.map +0 -1
- package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
- package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
- package/lib/webrtc/groupCallEventHandler.js +0 -178
- package/lib/webrtc/groupCallEventHandler.js.map +0 -1
- package/lib/webrtc/mediaHandler.d.ts +0 -89
- package/lib/webrtc/mediaHandler.d.ts.map +0 -1
- package/lib/webrtc/mediaHandler.js +0 -437
- package/lib/webrtc/mediaHandler.js.map +0 -1
- package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
- package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
- package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
- package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
- package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
- package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
- package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
- package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
- package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
- package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
- package/lib/webrtc/stats/connectionStats.d.ts +0 -28
- package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStats.js +0 -26
- package/lib/webrtc/stats/connectionStats.js.map +0 -1
- package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
- package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
- package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
- package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
- package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
- package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
- package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
- package/lib/webrtc/stats/groupCallStats.js +0 -78
- package/lib/webrtc/stats/groupCallStats.js.map +0 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
- package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
- package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
- package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
- package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
- package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
- package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
- package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
- package/lib/webrtc/stats/statsReport.d.ts +0 -99
- package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
- package/lib/webrtc/stats/statsReport.js +0 -32
- package/lib/webrtc/stats/statsReport.js.map +0 -1
- package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
- package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
- package/lib/webrtc/stats/statsReportEmitter.js +0 -33
- package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
- package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
- package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
- package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
- package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
- package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
- package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/transportStats.d.ts +0 -11
- package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
- package/lib/webrtc/stats/transportStats.js +0 -1
- package/lib/webrtc/stats/transportStats.js.map +0 -1
- package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
- package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
- package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
- package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
- package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
- package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
- package/lib/webrtc/stats/valueFormatter.js +0 -25
- package/lib/webrtc/stats/valueFormatter.js.map +0 -1
- package/src/matrixrtc/CallMembership.ts +0 -247
- package/src/matrixrtc/LivekitFocus.ts +0 -39
- package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
- package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
- package/src/matrixrtc/focus.ts +0 -25
- package/src/matrixrtc/index.ts +0 -22
- package/src/matrixrtc/types.ts +0 -36
- package/src/webrtc/audioContext.ts +0 -44
- package/src/webrtc/call.ts +0 -3074
- package/src/webrtc/callEventHandler.ts +0 -425
- package/src/webrtc/callEventTypes.ts +0 -93
- package/src/webrtc/callFeed.ts +0 -364
- package/src/webrtc/groupCall.ts +0 -1735
- package/src/webrtc/groupCallEventHandler.ts +0 -234
- package/src/webrtc/mediaHandler.ts +0 -484
- package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
- package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
- package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
- package/src/webrtc/stats/connectionStats.ts +0 -47
- package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
- package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
- package/src/webrtc/stats/groupCallStats.ts +0 -93
- package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
- package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
- package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
- package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
- package/src/webrtc/stats/statsReport.ts +0 -133
- package/src/webrtc/stats/statsReportEmitter.ts +0 -49
- package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
- package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
- package/src/webrtc/stats/transportStats.ts +0 -26
- package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
- package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1,166 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
import { logger as rootLogger } from "../logger.ts";
|
18
|
-
import { MatrixClient, ClientEvent } from "../client.ts";
|
19
|
-
import { TypedEventEmitter } from "../models/typed-event-emitter.ts";
|
20
|
-
import { Room, RoomEvent } from "../models/room.ts";
|
21
|
-
import { RoomState, RoomStateEvent } from "../models/room-state.ts";
|
22
|
-
import { MatrixEvent } from "../models/event.ts";
|
23
|
-
import { MatrixRTCSession } from "./MatrixRTCSession.ts";
|
24
|
-
import { EventType } from "../@types/event.ts";
|
25
|
-
|
26
|
-
const logger = rootLogger.getChild("MatrixRTCSessionManager");
|
27
|
-
|
28
|
-
export enum MatrixRTCSessionManagerEvents {
|
29
|
-
// A member has joined the MatrixRTC session, creating an active session in a room where there wasn't previously
|
30
|
-
SessionStarted = "session_started",
|
31
|
-
// All participants have left a given MatrixRTC session.
|
32
|
-
SessionEnded = "session_ended",
|
33
|
-
}
|
34
|
-
|
35
|
-
type EventHandlerMap = {
|
36
|
-
[MatrixRTCSessionManagerEvents.SessionStarted]: (roomId: string, session: MatrixRTCSession) => void;
|
37
|
-
[MatrixRTCSessionManagerEvents.SessionEnded]: (roomId: string, session: MatrixRTCSession) => void;
|
38
|
-
};
|
39
|
-
|
40
|
-
/**
|
41
|
-
* Holds all active MatrixRTC session objects and creates new ones as events arrive.
|
42
|
-
* This interface is UNSTABLE and may change without warning.
|
43
|
-
*/
|
44
|
-
export class MatrixRTCSessionManager extends TypedEventEmitter<MatrixRTCSessionManagerEvents, EventHandlerMap> {
|
45
|
-
// All the room-scoped sessions we know about. This will include any where the app
|
46
|
-
// has queried for the MatrixRTC sessions in a room, whether it's ever had any members
|
47
|
-
// or not). We keep a (lazily created) session object for every room to ensure that there
|
48
|
-
// is only ever one single room session object for any given room for the lifetime of the
|
49
|
-
// client: that way there can never be any code holding onto a stale object that is no
|
50
|
-
// longer the correct session object for the room.
|
51
|
-
private roomSessions = new Map<string, MatrixRTCSession>();
|
52
|
-
|
53
|
-
public constructor(private client: MatrixClient) {
|
54
|
-
super();
|
55
|
-
}
|
56
|
-
|
57
|
-
public start(): void {
|
58
|
-
// We shouldn't need to null-check here, but matrix-client.spec.ts mocks getRooms
|
59
|
-
// returning nothing, and breaks tests if you change it to return an empty array :'(
|
60
|
-
for (const room of this.client.getRooms() ?? []) {
|
61
|
-
const session = MatrixRTCSession.roomSessionForRoom(this.client, room);
|
62
|
-
if (session.memberships.length > 0) {
|
63
|
-
this.roomSessions.set(room.roomId, session);
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
this.client.on(ClientEvent.Room, this.onRoom);
|
68
|
-
this.client.on(RoomEvent.Timeline, this.onTimeline);
|
69
|
-
this.client.on(RoomStateEvent.Events, this.onRoomState);
|
70
|
-
}
|
71
|
-
|
72
|
-
public stop(): void {
|
73
|
-
for (const sess of this.roomSessions.values()) {
|
74
|
-
sess.stop();
|
75
|
-
}
|
76
|
-
this.roomSessions.clear();
|
77
|
-
|
78
|
-
this.client.off(ClientEvent.Room, this.onRoom);
|
79
|
-
this.client.off(RoomEvent.Timeline, this.onTimeline);
|
80
|
-
this.client.off(RoomStateEvent.Events, this.onRoomState);
|
81
|
-
}
|
82
|
-
|
83
|
-
/**
|
84
|
-
* Gets the main MatrixRTC session for a room, or undefined if there is
|
85
|
-
* no current session
|
86
|
-
*/
|
87
|
-
public getActiveRoomSession(room: Room): MatrixRTCSession | undefined {
|
88
|
-
return this.roomSessions.get(room.roomId)!;
|
89
|
-
}
|
90
|
-
|
91
|
-
/**
|
92
|
-
* Gets the main MatrixRTC session for a room, returning an empty session
|
93
|
-
* if no members are currently participating
|
94
|
-
*/
|
95
|
-
public getRoomSession(room: Room): MatrixRTCSession {
|
96
|
-
if (!this.roomSessions.has(room.roomId)) {
|
97
|
-
this.roomSessions.set(room.roomId, MatrixRTCSession.roomSessionForRoom(this.client, room));
|
98
|
-
}
|
99
|
-
|
100
|
-
return this.roomSessions.get(room.roomId)!;
|
101
|
-
}
|
102
|
-
|
103
|
-
private async consumeCallEncryptionEvent(event: MatrixEvent, isRetry = false): Promise<void> {
|
104
|
-
await this.client.decryptEventIfNeeded(event);
|
105
|
-
if (event.isDecryptionFailure()) {
|
106
|
-
if (!isRetry) {
|
107
|
-
logger.warn(
|
108
|
-
`Decryption failed for event ${event.getId()}: ${event.decryptionFailureReason} will retry once only`,
|
109
|
-
);
|
110
|
-
// retry after 1 second. After this we give up.
|
111
|
-
setTimeout(() => this.consumeCallEncryptionEvent(event, true), 1000);
|
112
|
-
} else {
|
113
|
-
logger.warn(`Decryption failed for event ${event.getId()}: ${event.decryptionFailureReason}`);
|
114
|
-
}
|
115
|
-
return;
|
116
|
-
} else if (isRetry) {
|
117
|
-
logger.info(`Decryption succeeded for event ${event.getId()} after retry`);
|
118
|
-
}
|
119
|
-
|
120
|
-
if (event.getType() !== EventType.CallEncryptionKeysPrefix) return Promise.resolve();
|
121
|
-
|
122
|
-
const room = this.client.getRoom(event.getRoomId());
|
123
|
-
if (!room) {
|
124
|
-
logger.error(`Got room state event for unknown room ${event.getRoomId()}!`);
|
125
|
-
return Promise.resolve();
|
126
|
-
}
|
127
|
-
|
128
|
-
this.getRoomSession(room).onCallEncryption(event);
|
129
|
-
}
|
130
|
-
private onTimeline = (event: MatrixEvent): void => {
|
131
|
-
this.consumeCallEncryptionEvent(event);
|
132
|
-
};
|
133
|
-
|
134
|
-
private onRoom = (room: Room): void => {
|
135
|
-
this.refreshRoom(room);
|
136
|
-
};
|
137
|
-
|
138
|
-
private onRoomState = (event: MatrixEvent, _state: RoomState): void => {
|
139
|
-
const room = this.client.getRoom(event.getRoomId());
|
140
|
-
if (!room) {
|
141
|
-
logger.error(`Got room state event for unknown room ${event.getRoomId()}!`);
|
142
|
-
return;
|
143
|
-
}
|
144
|
-
|
145
|
-
if (event.getType() == EventType.GroupCallMemberPrefix) {
|
146
|
-
this.refreshRoom(room);
|
147
|
-
}
|
148
|
-
};
|
149
|
-
|
150
|
-
private refreshRoom(room: Room): void {
|
151
|
-
const isNewSession = !this.roomSessions.has(room.roomId);
|
152
|
-
const sess = this.getRoomSession(room);
|
153
|
-
|
154
|
-
const wasActiveAndKnown = sess.memberships.length > 0 && !isNewSession;
|
155
|
-
|
156
|
-
sess.onMembershipUpdate();
|
157
|
-
|
158
|
-
const nowActive = sess.memberships.length > 0;
|
159
|
-
|
160
|
-
if (wasActiveAndKnown && !nowActive) {
|
161
|
-
this.emit(MatrixRTCSessionManagerEvents.SessionEnded, room.roomId, this.roomSessions.get(room.roomId)!);
|
162
|
-
} else if (!wasActiveAndKnown && nowActive) {
|
163
|
-
this.emit(MatrixRTCSessionManagerEvents.SessionStarted, room.roomId, this.roomSessions.get(room.roomId)!);
|
164
|
-
}
|
165
|
-
}
|
166
|
-
}
|
package/src/matrixrtc/focus.ts
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
/**
|
18
|
-
* Information about a MatrixRTC conference focus. The only attribute that
|
19
|
-
* the js-sdk (currently) knows about is the type: applications can extend
|
20
|
-
* this class for different types of focus.
|
21
|
-
*/
|
22
|
-
export interface Focus {
|
23
|
-
type: string;
|
24
|
-
[key: string]: unknown;
|
25
|
-
}
|
package/src/matrixrtc/index.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2024 The Matrix.org Foundation C.I.C.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
export * from "./CallMembership.ts";
|
18
|
-
export type * from "./focus.ts";
|
19
|
-
export * from "./LivekitFocus.ts";
|
20
|
-
export * from "./MatrixRTCSession.ts";
|
21
|
-
export * from "./MatrixRTCSessionManager.ts";
|
22
|
-
export type * from "./types.ts";
|
package/src/matrixrtc/types.ts
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2023 The Matrix.org Foundation C.I.C.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
import { IMentions } from "../matrix.ts";
|
17
|
-
export interface EncryptionKeyEntry {
|
18
|
-
index: number;
|
19
|
-
key: string;
|
20
|
-
}
|
21
|
-
|
22
|
-
export interface EncryptionKeysEventContent {
|
23
|
-
keys: EncryptionKeyEntry[];
|
24
|
-
device_id: string;
|
25
|
-
call_id: string;
|
26
|
-
sent_ts?: number;
|
27
|
-
}
|
28
|
-
|
29
|
-
export type CallNotifyType = "ring" | "notify";
|
30
|
-
|
31
|
-
export interface ICallNotifyContent {
|
32
|
-
"application": string;
|
33
|
-
"m.mentions": IMentions;
|
34
|
-
"notify_type": CallNotifyType;
|
35
|
-
"call_id": string;
|
36
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright 2022 The Matrix.org Foundation C.I.C.
|
3
|
-
|
4
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
7
|
-
|
8
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
|
-
*/
|
16
|
-
|
17
|
-
let audioContext: AudioContext | null = null;
|
18
|
-
let refCount = 0;
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Acquires a reference to the shared AudioContext.
|
22
|
-
* It's highly recommended to reuse this AudioContext rather than creating your
|
23
|
-
* own, because multiple AudioContexts can be problematic in some browsers.
|
24
|
-
* Make sure to call releaseContext when you're done using it.
|
25
|
-
* @returns The shared AudioContext
|
26
|
-
*/
|
27
|
-
export const acquireContext = (): AudioContext => {
|
28
|
-
if (audioContext === null) audioContext = new AudioContext();
|
29
|
-
refCount++;
|
30
|
-
return audioContext;
|
31
|
-
};
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Signals that one of the references to the shared AudioContext has been
|
35
|
-
* released, allowing the context and associated hardware resources to be
|
36
|
-
* cleaned up if nothing else is using it.
|
37
|
-
*/
|
38
|
-
export const releaseContext = (): void => {
|
39
|
-
refCount--;
|
40
|
-
if (refCount === 0) {
|
41
|
-
audioContext?.close();
|
42
|
-
audioContext = null;
|
43
|
-
}
|
44
|
-
};
|