Skip to content

Commit 4143e78

Browse files
koumiGooglecopybara-github
authored andcommitted
fix: Update types
PiperOrigin-RevId: 723178043
1 parent 77f1378 commit 4143e78

File tree

2 files changed

+151
-75
lines changed

2 files changed

+151
-75
lines changed

web/types/mediatypes.d.ts

Lines changed: 145 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,82 @@ import {LogLevel} from './enums';
2828
import {Subscribable} from './subscribable';
2929

3030
/**
31-
* Media entry serves as the central relational object between the
31+
* Serves as the central relational object between the
3232
* participant, media canvas and meet stream. This object represents media in
3333
* a Meet call and holds metadata for the media.
3434
*/
3535
export interface MediaEntry {
36-
// We expect participant to be set once.
36+
/**
37+
* Participant abstraction associated with this media entry.
38+
* We expect participant to be set once.
39+
*/
3740
readonly participant: Subscribable<Participant | undefined>;
41+
/**
42+
* Whether this participant muted their audio stream.
43+
*/
3844
readonly audioMuted: Subscribable<boolean>;
45+
/**
46+
* Whether this participant muted their video stream.
47+
*/
3948
readonly videoMuted: Subscribable<boolean>;
49+
/**
50+
* Whether the current entry is a screenshare.
51+
*/
4052
readonly screenShare: Subscribable<boolean>;
53+
/**
54+
* Whether the current entry is a presenter self-view.
55+
*/
4156
readonly isPresenter: Subscribable<boolean>;
57+
/**
58+
* The media layout associated with this media entry.
59+
*/
4260
readonly mediaLayout: Subscribable<MediaLayout | undefined>;
61+
/**
62+
* The video meet stream track associated with this media entry. Contains the
63+
* webrtc media stream track.
64+
*/
4365
readonly videoMeetStreamTrack: Subscribable<MeetStreamTrack | undefined>;
66+
/**
67+
* The audio meet stream track associated with this media entry. Contains the
68+
* webrtc media stream track.
69+
*/
4470
readonly audioMeetStreamTrack: Subscribable<MeetStreamTrack | undefined>;
71+
/**
72+
* The session ID of the media entry.
73+
*
74+
* Format is
75+
* `participants/{participant}/participantSessions/{participant_session}`
76+
*
77+
* You can use this to retrieve additional information about
78+
* the participant session from the
79+
* {@link https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.participants.participantSessions | Meet REST API - ParticipantSessions} resource.
80+
*
81+
* `Note`: This has to be in the format of `conferenceRecords/{conference_record}/participants/{participant}/participantSessions/{participant_session}`.
82+
*
83+
* You can retrieve the conference record from the {@link https://developers.google.com/meet/api/guides/conferences | Meet REST API - Conferences} resource.
84+
*/
4585
sessionName?: string;
86+
/**
87+
* Participant session name. There should be a one to one mapping of session
88+
* to Media Entry. You can use this to retrieve additional information about
89+
* the participant session from the
90+
* {@link https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.participants.participantSessions | Meet REST API - ParticipantSessions} resource
91+
*
92+
* Format is
93+
* `conferenceRecords/{conference_record}/participants/{participant}/participantSessions/{participant_session}`
94+
* Unused for now. Use sessionName instead.
95+
*/
4696
session?: string;
4797
}
4898

4999
/**
50-
* Base participant type.
100+
* An abstraction that represents a participant in a Meet call. Contains
101+
* the participant object and the media entries associated with this participant.
51102
*/
52103
export interface Participant {
104+
/**
105+
* Participant abstraction associated with this participant.
106+
*/
53107
participant: BaseParticipant;
54108
/**
55109
* The media entries associated with this participant. These can be
@@ -59,68 +113,55 @@ export interface Participant {
59113
}
60114

61115
/**
62-
* Base participant type.
116+
* Base participant type. Only one of signedInUser, anonymousUser, or phoneUser
117+
* fields will be set to determine the type of participant.
63118
*/
64119
export interface BaseParticipant {
65-
// Resource name of the participant.
66-
// Format: `conferenceRecords/{conferenceRecord}/participants/{participant}`
120+
/**
121+
* Resource name of the participant.
122+
* Format: `conferenceRecords/{conferenceRecord}/participants/{participant}`
123+
*
124+
* You can use this to retrieve additional information about the participant
125+
* from the {@link https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.participants | Meet REST API - Participants} resource.
126+
*
127+
* Unused for now. Use participantKey instead.
128+
*/
67129
name?: string;
68-
// Participant key of associated participant. The user must construct the
69-
// resource name from this field to create an Meet API reference.
70-
// Format is `participants/{participant}`
71-
// You can retrieve the conference record from https://developers.google.com/meet/api/guides/conferences
72-
// and use the conference record to construct the participant name in the
73-
// format of
74-
// `conferenceRecords/{conference_record}/participants/{participant}`
130+
/**
131+
* Participant key of associated participant.
132+
* Format is `participants/{participant}`.
133+
*
134+
* You can use this to retrieve additional information about the participant
135+
* from the {@link https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.participants | Meet REST API - Participants} resource.
136+
*
137+
* `Note`: This has to be in the format of `conferenceRecords/{conference_record}/participants/{participant}`.
138+
*
139+
* You can retrieve the conference record from the {@link https://developers.google.com/meet/api/guides/conferences | Meet REST API - Conferences} resource.
140+
*
141+
*/
75142
participantKey?: string;
143+
/**
144+
* If set, the participant is a signed in user. Provides a unique ID and
145+
* display name.
146+
*/
76147
signedInUser?: SignedInUser;
148+
/**
149+
* If set, the participant is an anonymous user. Provides a display name.
150+
*/
77151
anonymousUser?: AnonymousUser;
152+
/**
153+
* If set, the participant is a dial-in user. Provides a partially redacted
154+
* phone number.
155+
*/
78156
phoneUser?: PhoneUser;
79157
}
80158

81-
/**
82-
* A signed in participant in a Meet call.
83-
*/
84-
export interface SignedInParticipant extends BaseParticipant {
85-
signedInUser: SignedInUser;
86-
anonymousUser?: never;
87-
phoneUser?: never;
88-
}
89-
90-
/**
91-
* An anonymous participant in a Meet call.
92-
*/
93-
export interface AnonymousParticipant extends BaseParticipant {
94-
signedInUser?: never;
95-
anonymousUser: AnonymousUser;
96-
phoneUser?: never;
97-
}
98-
99-
/**
100-
* A phone participant in a Meet call.
101-
*/
102-
export interface PhoneParticipant extends BaseParticipant {
103-
signedInUser?: never;
104-
anonymousUser?: never;
105-
phoneUser: PhoneUser;
106-
}
107-
108-
/**
109-
* A representation of a participant for a Media API client.
110-
* This maps to
111-
* https://developers.google.com/meet/api/reference/rest/v2/conferenceRecords.participants#Participant.
112-
*/
113-
export type ParticipantType =
114-
| SignedInParticipant
115-
| AnonymousParticipant
116-
| PhoneParticipant;
117-
118159
/**
119160
* A signed in user in a Meet call.
120161
*/
121162
export interface SignedInUser {
122163
/**
123-
* Unique ID of the user which is interoperable with Admin SDK API and People
164+
* Unique ID of the user which is interoperable with the Google Admin SDK API and People
124165
* API.
125166
*/
126167
readonly user: string;
@@ -152,7 +193,9 @@ export interface PhoneUser {
152193
* both audio and video tracks and their relationship to Media Entries.
153194
*/
154195
export interface MeetStreamTrack {
155-
/** WebRTC media stream track. */
196+
/**
197+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack | WebRTC MediaStreamTrack}
198+
*/
156199
readonly mediaStreamTrack: MediaStreamTrack;
157200
/**
158201
* The media entry associated with this track. This a one to one
@@ -162,57 +205,74 @@ export interface MeetStreamTrack {
162205
}
163206

164207
/**
165-
* The dimensions of the canvas.
208+
* The dimensions of the canvas for video streams.
166209
*/
167210
export interface CanvasDimensions {
168-
/** Width measured in pixels. This can be changed by the user. */
211+
/**
212+
* Width measured in pixels. This can be changed by the user.
213+
*/
169214
width: number;
170-
/** Height measured in pixels. This can be changed by the user. */
215+
/**
216+
* Height measured in pixels. This can be changed by the user.
217+
*/
171218
height: number;
172219
}
173220

174221
/**
175222
* A Media layout for the Media Api Web client. This must be created by the
176-
* Media API client to be valid.
223+
* Media API client to be valid. This is used to request a video stream.
177224
*/
178225
export interface MediaLayout {
179-
/** The dimensions of the layout. */
226+
/**
227+
* The dimensions of the layout.
228+
*/
180229
readonly canvasDimensions: CanvasDimensions;
181-
/** The media entry associated with this layout. */
230+
/**
231+
* The media entry associated with this layout.
232+
*/
182233
readonly mediaEntry: Subscribable<MediaEntry | undefined>;
183234
}
184235

185236
/**
186-
* A request for a MediaLayout. This is required to be able to request a video
187-
* stream. Can be used to request a presenter, direct or relevant media layout.
237+
* A request for a {@link MediaLayout}. This is required to be able to request a video
238+
* stream.
188239
*/
189-
export type MediaLayoutRequest =
190-
// Used to request or change the presenter stream if it exists.
191-
| {presenter: true; mediaLayout: MediaLayout; mediaEntry?: never}
192-
// Used to request a direct media layout. This can be any media entry in the
193-
// meeting.
194-
| {mediaEntry: MediaEntry; mediaLayout: MediaLayout; presenter?: never}
195-
// Used to request a relevant media layout. This is a media layout that
196-
// the backend determines is relevant to the user. This could be a current
197-
// loudest speaker, presenter, etc.
198-
| {mediaLayout: MediaLayout; mediaEntry?: never; presenter?: never};
240+
export interface MediaLayoutRequest {
241+
/**
242+
* The {@link MediaLayout} to request.
243+
*/
244+
mediaLayout: MediaLayout;
245+
}
199246

200247
/**
201-
* Required configuration for the MeetMediaApiClient.
248+
* Required configuration for the {@link MeetMediaApiClient}.
202249
*/
203250
export interface MeetMediaClientRequiredConfiguration {
251+
/**
252+
* The meeting space ID to connect to.
253+
*/
204254
meetingSpaceId: string;
255+
/**
256+
* The number of video streams to request.
257+
*/
205258
numberOfVideoStreams: number;
206-
/* Number of audio streams is not configurable. False maps to 0 and True maps
259+
/**
260+
* Number of audio streams is not configurable. False maps to 0 and True maps
207261
* to 3.
208262
*/
209263
enableAudioStreams: boolean;
264+
/**
265+
* The access token to use for authentication.
266+
*/
210267
accessToken: string;
268+
/**
269+
* The callback to use for logging events.
270+
*/
211271
logsCallback?: (logEvent: LogEvent) => void;
212272
}
213273

214274
/**
215-
* List of log source types
275+
* List of log source types.
216276
*/
217277
export type LogSourceType =
218278
| 'session-control'
@@ -225,9 +285,21 @@ export type LogSourceType =
225285
* Log event that is propagated to the callback.
226286
*/
227287
export interface LogEvent {
288+
/**
289+
* The level of the log event.
290+
*/
228291
level: LogLevel;
292+
/**
293+
* The log string of the event.
294+
*/
229295
logString: string;
296+
/**
297+
* The source type of the event.
298+
*/
230299
sourceType: LogSourceType;
300+
/**
301+
* The relevant object of the event.
302+
*/
231303
relevantObject?:
232304
| Error
233305
| DeletedResource

web/types/subscribable.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
* functions. Only the owner of the class can update the value.
2020
*/
2121

22+
/**
23+
* A helper class that can be used to get and subscribe to updates on a
24+
* value.
25+
*/
2226
export interface Subscribable<T> {
2327
/**
2428
* @return the current value.
@@ -28,14 +32,14 @@ export interface Subscribable<T> {
2832
/**
2933
* Allows a callback to be added. This callback will be called whenever the
3034
* value is updated.
31-
* @return an unsubscribe function
35+
* @return An unsubscribe function.
3236
*/
3337
subscribe(callback: (value: T) => void): () => void;
3438

3539
/**
3640
* Removes the callback from the list of subscribers. The original callback
3741
* instance must be passed in as an argument.
38-
* @return true if the callback was removed, false if it was not found.
42+
* @return True if the callback was removed, false if it was not found.
3943
*/
4044
unsubscribe(callback: (value: T) => void): boolean;
4145
}

0 commit comments

Comments
 (0)