@mentra/miniapp 3.2.0-dev.116 → 3.2.0-dev.120
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/dist/background/index.d.ts +3 -1
- package/dist/background/index.d.ts.map +1 -1
- package/dist/background/index.js +1 -0
- package/dist/background/index.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/events.d.ts +8 -0
- package/dist/modules/events.d.ts.map +1 -1
- package/dist/modules/events.js.map +1 -1
- package/dist/modules/meeting.d.ts +88 -0
- package/dist/modules/meeting.d.ts.map +1 -0
- package/dist/modules/meeting.js +157 -0
- package/dist/modules/meeting.js.map +1 -0
- package/dist/modules/stream.d.ts +5 -0
- package/dist/modules/stream.d.ts.map +1 -1
- package/dist/modules/stream.js +2 -0
- package/dist/modules/stream.js.map +1 -1
- package/dist/protocol.d.ts +15 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +14 -0
- package/dist/protocol.js.map +1 -1
- package/dist/session.d.ts +14 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +29 -0
- package/dist/session.js.map +1 -1
- package/package.json +2 -2
- package/src/background/index.ts +13 -0
- package/src/index.ts +13 -0
- package/src/modules/events.ts +8 -0
- package/src/modules/meeting.ts +237 -0
- package/src/modules/stream.ts +7 -0
- package/src/protocol.ts +16 -0
- package/src/session.ts +38 -0
package/src/session.ts
CHANGED
|
@@ -45,6 +45,7 @@ import {SystemModule} from "./modules/system"
|
|
|
45
45
|
import {MiniappsModule} from "./modules/miniapps"
|
|
46
46
|
import {ActionsModule} from "./modules/actions"
|
|
47
47
|
import {BlobModule} from "./modules/blob"
|
|
48
|
+
import {MeetingModule, parseMeetingMediaSource, parseMeetingParticipants} from "./modules/meeting"
|
|
48
49
|
|
|
49
50
|
// ---------------------------------------------------------------------------
|
|
50
51
|
// Public types
|
|
@@ -105,6 +106,13 @@ export interface ConnectAckPayload {
|
|
|
105
106
|
permissions?: PermissionRecord
|
|
106
107
|
/** Miniapp-scoped backend auth. Never a Core or runtime token. */
|
|
107
108
|
auth?: MiniappAuthState
|
|
109
|
+
/** Host-advertised optional features. Absent on older Mentra Apps. */
|
|
110
|
+
hostFeatures?: HostFeatures
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface HostFeatures {
|
|
114
|
+
/** Host honors `startStream({captureAudio})` for the lifetime of a WHIP session. */
|
|
115
|
+
captureAudio?: boolean
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
export interface MiniappAuthState {
|
|
@@ -191,6 +199,7 @@ type SessionEmitterEvents = {
|
|
|
191
199
|
colorScheme: (scheme: MiniappColorScheme) => void
|
|
192
200
|
permissions: (perms: PermissionRecord) => void
|
|
193
201
|
speakerState: (event: import("./modules/speaker").SpeakerStateEvent) => void
|
|
202
|
+
meetingState: (event: import("./modules/meeting").MeetingState) => void
|
|
194
203
|
auth: (auth: MiniappAuthState) => void
|
|
195
204
|
}
|
|
196
205
|
|
|
@@ -211,6 +220,7 @@ export class MiniappSession<TChannels extends object = any> {
|
|
|
211
220
|
*/
|
|
212
221
|
public readonly events: EventManager
|
|
213
222
|
public readonly speaker: SpeakerModule
|
|
223
|
+
public readonly meeting: MeetingModule
|
|
214
224
|
public readonly camera: CameraModule
|
|
215
225
|
public readonly cloud: CloudModule
|
|
216
226
|
public readonly dashboard: DashboardAPI
|
|
@@ -256,6 +266,11 @@ export class MiniappSession<TChannels extends object = any> {
|
|
|
256
266
|
|
|
257
267
|
/** Phone-declared glasses capabilities. Null until CONNECT_ACK arrives. */
|
|
258
268
|
public capabilities: GlassesCapabilities | null = null
|
|
269
|
+
/**
|
|
270
|
+
* Host-advertised optional features. Null until CONNECT_ACK. Older Mentra Apps
|
|
271
|
+
* omit this, so miniapps must not assume `captureAudio` is honored.
|
|
272
|
+
*/
|
|
273
|
+
public hostFeatures: HostFeatures | null = null
|
|
259
274
|
public userId = ""
|
|
260
275
|
public packageName = ""
|
|
261
276
|
public visibility: MiniappVisibility = "foreground"
|
|
@@ -308,6 +323,7 @@ export class MiniappSession<TChannels extends object = any> {
|
|
|
308
323
|
this.auth = new AuthModule(this)
|
|
309
324
|
this.events = new EventManager(this)
|
|
310
325
|
this.speaker = new SpeakerModule(this)
|
|
326
|
+
this.meeting = new MeetingModule(this)
|
|
311
327
|
this.camera = new CameraModule(this)
|
|
312
328
|
this.cloud = new CloudModule(this)
|
|
313
329
|
this.dashboard = new DashboardAPI(this)
|
|
@@ -619,6 +635,7 @@ export class MiniappSession<TChannels extends object = any> {
|
|
|
619
635
|
this.userId = ack.userId ?? ""
|
|
620
636
|
if (ack.packageName) this.packageName = ack.packageName
|
|
621
637
|
this.capabilities = ack.capabilities ?? null
|
|
638
|
+
this.hostFeatures = ack.hostFeatures ?? null
|
|
622
639
|
if (ack.visibility) this.visibility = ack.visibility
|
|
623
640
|
if (ack.colorScheme === "light" || ack.colorScheme === "dark") {
|
|
624
641
|
this.colorScheme = ack.colorScheme
|
|
@@ -667,6 +684,27 @@ export class MiniappSession<TChannels extends object = any> {
|
|
|
667
684
|
return
|
|
668
685
|
}
|
|
669
686
|
|
|
687
|
+
case MiniappResponseType.MEETING_STATE: {
|
|
688
|
+
const state = payload.state as import("./modules/meeting").MeetingPhase | undefined
|
|
689
|
+
if (!state) return
|
|
690
|
+
const event: import("./modules/meeting").MeetingState = {
|
|
691
|
+
state,
|
|
692
|
+
muted: Boolean(payload.muted),
|
|
693
|
+
error: payload.error as string | undefined,
|
|
694
|
+
meetingUrl: payload.meetingUrl as string | undefined,
|
|
695
|
+
provider: payload.provider as import("./modules/meeting").MeetingProvider | undefined,
|
|
696
|
+
audioSource: payload.audioSource as import("./modules/meeting").MeetingState["audioSource"],
|
|
697
|
+
audioSourceReason: payload.audioSourceReason as import("./modules/meeting").MeetingState["audioSourceReason"],
|
|
698
|
+
activeStream: payload.activeStream as import("./modules/meeting").MeetingState["activeStream"],
|
|
699
|
+
audioSafety: payload.audioSafety as import("./modules/meeting").MeetingState["audioSafety"],
|
|
700
|
+
mediaSource: parseMeetingMediaSource(payload.mediaSource),
|
|
701
|
+
participants: parseMeetingParticipants(payload.participants),
|
|
702
|
+
}
|
|
703
|
+
this.meeting._applyState(event)
|
|
704
|
+
this.emitter.emit("meetingState", event)
|
|
705
|
+
return
|
|
706
|
+
}
|
|
707
|
+
|
|
670
708
|
case MiniappRequestType.PING: {
|
|
671
709
|
// Phone → miniapp keepalive ping. Auto-reply with PONG.
|
|
672
710
|
const pong: object = {type: MiniappResponseType.PONG}
|