{
	"version": 1,
	"name": "app_voice_session",
	"description": "Connected app voice session with gateway state, device and permission updates, local media, remote tracks, subscriptions, participant volume, stats, and screen encoding.",
	"capabilities": {
		"connect": true,
		"microphone": true,
		"camera": true,
		"screen": true,
		"screenAudio": true,
		"outputDevice": true,
		"participantVolume": true,
		"remoteTrackSubscription": true,
		"dataChannel": true,
		"stats": true,
		"nativeVideoFrames": true,
		"hardwareEncoding": true,
		"zeroCopyScreenTransport": true,
		"nativeAudioTaps": true
	},
	"steps": [
		{
			"name": "request gateway voice state write",
			"event": {
				"type": "gateway.voiceStateWriteRequested",
				"options": {
					"guildId": "guild-1",
					"channelId": "channel-1",
					"selfMute": false,
					"selfDeaf": false,
					"selfVideo": true,
					"selfStream": true
				}
			},
			"commands": [
				{
					"type": "gateway.voiceState.write",
					"operationId": 1,
					"options": {
						"guildId": "guild-1",
						"channelId": "channel-1",
						"selfMute": false,
						"selfDeaf": false,
						"selfVideo": true,
						"selfStream": true
					}
				}
			]
		},
		{
			"name": "gateway voice state write succeeds",
			"event": {
				"type": "gateway.voiceStateWriteSucceeded",
				"operationId": 1
			},
			"commands": []
		},
		{
			"name": "gateway self voice state arrives",
			"event": {
				"type": "gateway.voiceStateUpdated",
				"voiceState": {
					"guildId": "guild-1",
					"channelId": "channel-1",
					"userId": "user-1",
					"sessionId": "session-1",
					"selfMute": false,
					"selfDeaf": false,
					"selfVideo": true,
					"selfStream": true,
					"suppress": false,
					"requestToSpeakTimestamp": null
				}
			},
			"commands": []
		},
		{
			"name": "gateway voice server arrives",
			"event": {
				"type": "gateway.voiceServerUpdated",
				"voiceServer": {
					"guildId": "guild-1",
					"endpoint": "voice-gateway.example.test",
					"token": "gateway-token-1"
				}
			},
			"commands": []
		},
		{
			"name": "enumerate devices",
			"event": {
				"type": "devices.enumerateRequested"
			},
			"commands": [
				{
					"type": "devices.enumerate",
					"operationId": 2
				}
			]
		},
		{
			"name": "devices arrive",
			"event": {
				"type": "devices.changed",
				"operationId": 2,
				"reason": "initial",
				"devices": {
					"audioInputs": [
						{
							"deviceId": "mic-1",
							"label": "Studio Mic",
							"isDefault": true
						}
					],
					"audioOutputs": [
						{
							"deviceId": "speaker-1",
							"label": "Desk Speakers",
							"isDefault": true
						}
					],
					"cameras": [
						{
							"deviceId": "camera-1",
							"label": "Face Camera"
						}
					],
					"selectedAudioInputId": "mic-1",
					"selectedAudioOutputId": "speaker-1",
					"selectedCameraId": "camera-1"
				}
			},
			"commands": []
		},
		{
			"name": "microphone permission is known",
			"event": {
				"type": "permissions.result",
				"operationId": null,
				"result": {
					"name": "microphone",
					"status": "granted",
					"canPrompt": false
				}
			},
			"commands": []
		},
		{
			"name": "camera permission is known",
			"event": {
				"type": "permissions.result",
				"operationId": null,
				"result": {
					"name": "camera",
					"status": "granted",
					"canPrompt": false
				}
			},
			"commands": []
		},
		{
			"name": "queue microphone before connection",
			"event": {
				"type": "microphone.publishRequested",
				"options": {
					"deviceId": "mic-1",
					"echoCancellation": true,
					"noiseSuppression": true,
					"autoGainControl": true
				}
			},
			"commands": []
		},
		{
			"name": "queue camera before connection",
			"event": {
				"type": "camera.publishRequested",
				"options": {
					"deviceId": "camera-1",
					"width": 1280,
					"height": 720,
					"frameRate": 30
				}
			},
			"commands": []
		},
		{
			"name": "queue screen before connection",
			"event": {
				"type": "screen.publishRequested",
				"options": {
					"captureId": "screen-1",
					"width": 1920,
					"height": 1080,
					"codec": "h264",
					"maxBitrateBps": 3000000,
					"maxFramerate": 30,
					"adaptiveSend": true,
					"pacing": "sender"
				}
			},
			"commands": []
		},
		{
			"name": "queue screen audio before connection",
			"event": {
				"type": "screenAudio.publishRequested",
				"options": {
					"sampleRate": 48000,
					"numChannels": 2
				}
			},
			"commands": []
		},
		{
			"name": "request voice connection",
			"event": {
				"type": "connection.connectRequested",
				"options": {
					"url": "wss://voice.example.test",
					"token": "token-session-1",
					"metadata": {
						"guildId": "guild-1",
						"channelId": "channel-1"
					}
				}
			},
			"commands": [
				{
					"type": "connection.connect",
					"operationId": 3,
					"options": {
						"url": "wss://voice.example.test",
						"token": "token-session-1",
						"metadata": {
							"guildId": "guild-1",
							"channelId": "channel-1"
						}
					}
				}
			]
		},
		{
			"name": "livekit enters connecting",
			"event": {
				"type": "livekit.roomStateChanged",
				"room": {
					"connectionState": "connecting",
					"roomSid": null,
					"roomName": "guild-1/channel-1",
					"serverRegion": null
				}
			},
			"commands": []
		},
		{
			"name": "voice connection succeeds and queued media publishes",
			"event": {
				"type": "connection.connectSucceeded",
				"operationId": 3
			},
			"commands": [
				{
					"type": "microphone.publish",
					"operationId": 4,
					"options": {
						"deviceId": "mic-1",
						"echoCancellation": true,
						"noiseSuppression": true,
						"autoGainControl": true
					}
				},
				{
					"type": "camera.publish",
					"operationId": 5,
					"options": {
						"deviceId": "camera-1",
						"width": 1280,
						"height": 720,
						"frameRate": 30
					}
				},
				{
					"type": "screen.publish",
					"operationId": 6,
					"options": {
						"captureId": "screen-1",
						"width": 1920,
						"height": 1080,
						"codec": "h264",
						"maxBitrateBps": 3000000,
						"maxFramerate": 30,
						"adaptiveSend": true,
						"pacing": "sender"
					}
				},
				{
					"type": "screenAudio.publish",
					"operationId": 7,
					"options": {
						"sampleRate": 48000,
						"numChannels": 2
					}
				}
			]
		},
		{
			"name": "livekit room connects",
			"event": {
				"type": "livekit.roomStateChanged",
				"room": {
					"connectionState": "connected",
					"roomSid": "room-1",
					"roomName": "guild-1/channel-1",
					"serverRegion": "us-east"
				}
			},
			"commands": []
		},
		{
			"name": "microphone publish succeeds",
			"event": {
				"type": "microphone.publishSucceeded",
				"operationId": 4
			},
			"commands": []
		},
		{
			"name": "camera publish succeeds",
			"event": {
				"type": "camera.publishSucceeded",
				"operationId": 5
			},
			"commands": []
		},
		{
			"name": "screen publish succeeds",
			"event": {
				"type": "screen.publishSucceeded",
				"operationId": 6
			},
			"commands": []
		},
		{
			"name": "screen audio publish succeeds",
			"event": {
				"type": "screenAudio.publishSucceeded",
				"operationId": 7
			},
			"commands": []
		},
		{
			"name": "audio controls update",
			"event": {
				"type": "audioControls.changed",
				"controls": {
					"mode": "pushToTalk",
					"pushToTalkActive": true,
					"inputVolume": 0.85
				}
			},
			"commands": []
		},
		{
			"name": "remote participant joins",
			"event": {
				"type": "room.participantJoined",
				"participant": {
					"sid": "participant-remote-1",
					"identity": "user-2",
					"name": "Riley"
				}
			},
			"commands": []
		},
		{
			"name": "remote microphone track publishes",
			"event": {
				"type": "room.trackPublished",
				"track": {
					"participantIdentity": "user-2",
					"participantSid": "participant-remote-1",
					"trackSid": "track-remote-mic-1",
					"trackName": "microphone",
					"kind": "audio",
					"source": "microphone",
					"muted": false
				}
			},
			"commands": []
		},
		{
			"name": "remote screen track publishes",
			"event": {
				"type": "room.trackPublished",
				"track": {
					"participantIdentity": "user-2",
					"participantSid": "participant-remote-1",
					"trackSid": "track-remote-screen-1",
					"trackName": "screen",
					"kind": "video",
					"source": "screen",
					"muted": false
				}
			},
			"commands": []
		},
		{
			"name": "subscribe to remote screen",
			"event": {
				"type": "remoteTrackSubscription.setRequested",
				"options": {
					"participantIdentity": "user-2",
					"source": "screen",
					"subscribed": true,
					"enabled": true,
					"quality": "high"
				}
			},
			"commands": [
				{
					"type": "remoteTrackSubscription.set",
					"options": {
						"participantIdentity": "user-2",
						"source": "screen",
						"subscribed": true,
						"enabled": true,
						"quality": "high"
					},
					"operationId": 8
				}
			]
		},
		{
			"name": "remote screen subscription succeeds",
			"event": {
				"type": "remoteTrackSubscription.setSucceeded",
				"operationId": 8
			},
			"commands": []
		},
		{
			"name": "set participant volume",
			"event": {
				"type": "participantVolume.setRequested",
				"options": {
					"participantIdentity": "user-2",
					"volume": 0.6
				}
			},
			"commands": [
				{
					"type": "participantVolume.set",
					"options": {
						"participantIdentity": "user-2",
						"volume": 0.6
					},
					"operationId": 9
				}
			]
		},
		{
			"name": "participant volume succeeds",
			"event": {
				"type": "participantVolume.setSucceeded",
				"operationId": 9
			},
			"commands": []
		},
		{
			"name": "collect stats",
			"event": {
				"type": "stats.collectRequested"
			},
			"commands": [
				{
					"type": "stats.collect",
					"operationId": 10
				}
			]
		},
		{
			"name": "stats arrive",
			"event": {
				"type": "stats.collected",
				"operationId": 10,
				"stats": {
					"rttMs": 42,
					"outbound": [
						{
							"trackSid": "local-mic",
							"source": "microphone",
							"kind": "audio",
							"bitrateKbps": 48,
							"packetsLost": 0,
							"codec": "opus",
							"audioLevel": 0.12
						},
						{
							"trackSid": "local-screen",
							"source": "screen",
							"kind": "video",
							"bitrateKbps": 2500,
							"packetsLost": 1,
							"codec": "h264",
							"width": 1920,
							"height": 1080,
							"fps": 30,
							"zeroCopy": true
						}
					],
					"inbound": [
						{
							"participantIdentity": "user-2",
							"participantSid": "participant-remote-1",
							"trackSid": "track-remote-mic-1",
							"kind": "audio",
							"bitrateKbps": 40,
							"packetsLost": 0,
							"codec": "opus",
							"jitterMs": 8,
							"audioLevel": 0.2
						}
					],
					"droppedNativeVideoFrames": 0,
					"droppedVideoFrameCallbacks": 0,
					"send": null
				}
			},
			"commands": []
		},
		{
			"name": "update screen encoding",
			"event": {
				"type": "screen.updateEncodingRequested",
				"options": {
					"captureId": "screen-1",
					"width": 1280,
					"height": 720,
					"frameRate": 15,
					"maxBitrateBps": 1500000
				}
			},
			"commands": [
				{
					"type": "screen.updateEncoding",
					"operationId": 11,
					"options": {
						"captureId": "screen-1",
						"width": 1280,
						"height": 720,
						"frameRate": 15,
						"maxBitrateBps": 1500000
					}
				}
			]
		},
		{
			"name": "screen encoding update succeeds",
			"event": {
				"type": "screen.updateEncodingSucceeded",
				"operationId": 11
			},
			"commands": []
		}
	],
	"expected": {
		"finalSnapshot": {
			"nextOperationId": 12,
			"capabilities": {
				"connect": true,
				"microphone": true,
				"camera": true,
				"screen": true,
				"screenAudio": true,
				"outputDevice": true,
				"participantVolume": true,
				"remoteTrackSubscription": true,
				"dataChannel": true,
				"stats": true,
				"nativeVideoFrames": true,
				"hardwareEncoding": true,
				"zeroCopyScreenTransport": true,
				"nativeAudioTaps": true
			},
			"operations": {
				"1": {
					"operationId": 1,
					"commandType": "gateway.voiceState.write",
					"resourceKey": "gateway",
					"status": "succeeded",
					"error": null
				},
				"2": {
					"operationId": 2,
					"commandType": "devices.enumerate",
					"resourceKey": "devices",
					"status": "succeeded",
					"error": null
				},
				"3": {
					"operationId": 3,
					"commandType": "connection.connect",
					"resourceKey": "connection",
					"status": "succeeded",
					"error": null
				}
			},
			"connection": {
				"status": "connected",
				"active": {
					"url": "wss://voice.example.test",
					"token": "token-session-1",
					"metadata": {
						"guildId": "guild-1",
						"channelId": "channel-1"
					}
				},
				"desired": {
					"url": "wss://voice.example.test",
					"token": "token-session-1",
					"metadata": {
						"guildId": "guild-1",
						"channelId": "channel-1"
					}
				},
				"operationId": null,
				"disconnectReason": null,
				"failure": null
			},
			"gateway": {
				"desiredVoiceState": null,
				"desiredVoiceStateWrite": null,
				"selfVoiceState": {
					"guildId": "guild-1",
					"channelId": "channel-1",
					"userId": "user-1",
					"sessionId": "session-1",
					"selfMute": false,
					"selfDeaf": false,
					"selfVideo": true,
					"selfStream": true,
					"suppress": false,
					"requestToSpeakTimestamp": null
				},
				"voiceServer": {
					"guildId": "guild-1",
					"endpoint": "voice-gateway.example.test",
					"token": "gateway-token-1"
				},
				"operationId": null,
				"failure": null
			},
			"liveKit": {
				"connectionState": "connected",
				"roomSid": "room-1",
				"roomName": "guild-1/channel-1",
				"serverRegion": "us-east",
				"failure": null
			},
			"microphone": {
				"status": "published",
				"desired": {
					"deviceId": "mic-1",
					"echoCancellation": true,
					"noiseSuppression": true,
					"autoGainControl": true
				},
				"published": {
					"deviceId": "mic-1",
					"echoCancellation": true,
					"noiseSuppression": true,
					"autoGainControl": true
				},
				"operationId": null,
				"failure": null,
				"enabled": true,
				"localSpeakingOverride": true,
				"setEnabledOperationId": null
			},
			"camera": {
				"status": "published",
				"desired": {
					"deviceId": "camera-1",
					"width": 1280,
					"height": 720,
					"frameRate": 30
				},
				"published": {
					"deviceId": "camera-1",
					"width": 1280,
					"height": 720,
					"frameRate": 30
				},
				"operationId": null,
				"failure": null
			},
			"screen": {
				"status": "published",
				"desired": {
					"captureId": "screen-1",
					"width": 1280,
					"height": 720,
					"codec": "h264",
					"maxBitrateBps": 1500000,
					"maxFramerate": 15,
					"adaptiveSend": true,
					"pacing": "sender"
				},
				"published": {
					"captureId": "screen-1",
					"width": 1280,
					"height": 720,
					"codec": "h264",
					"maxBitrateBps": 1500000,
					"maxFramerate": 15,
					"adaptiveSend": true,
					"pacing": "sender"
				},
				"operationId": null,
				"failure": null
			},
			"screenAudio": {
				"status": "published",
				"desired": {
					"sampleRate": 48000,
					"numChannels": 2
				},
				"published": {
					"sampleRate": 48000,
					"numChannels": 2
				},
				"operationId": null,
				"failure": null
			},
			"audioControls": {
				"mode": "pushToTalk",
				"locallyMuted": false,
				"preferredLocallyMuted": false,
				"locallyDeafened": false,
				"mutedByPermission": false,
				"hasUserSetMute": false,
				"hasUserSetDeaf": false,
				"shouldUnmuteOnUndeafen": false,
				"pushToTalkActive": true,
				"pushToMuteActive": false,
				"inputVolume": 0.85,
				"outputVolume": 1
			},
			"outputDevice": {
				"desiredDeviceId": null,
				"activeDeviceId": null,
				"operationId": null,
				"failure": null
			},
			"participantVolumes": {
				"user-2": 0.6
			},
			"remoteTrackSubscriptions": {
				"user-2:screen": {
					"participantIdentity": "user-2",
					"source": "screen",
					"subscribed": true,
					"enabled": true,
					"quality": "high"
				}
			},
			"watchedStreams": {},
			"codecNegotiation": {
				"overrides": {},
				"localSupportedVideoCodecs": [],
				"remoteSupportedVideoCodecs": {},
				"streams": {}
			},
			"stats": {
				"rttMs": 42,
				"outbound": [
					{
						"trackSid": "local-mic",
						"source": "microphone",
						"kind": "audio",
						"bitrateKbps": 48,
						"packetsLost": 0,
						"codec": "opus",
						"audioLevel": 0.12
					},
					{
						"trackSid": "local-screen",
						"source": "screen",
						"kind": "video",
						"bitrateKbps": 2500,
						"packetsLost": 1,
						"codec": "h264",
						"width": 1920,
						"height": 1080,
						"fps": 30,
						"zeroCopy": true
					}
				],
				"inbound": [
					{
						"participantIdentity": "user-2",
						"participantSid": "participant-remote-1",
						"trackSid": "track-remote-mic-1",
						"kind": "audio",
						"bitrateKbps": 40,
						"packetsLost": 0,
						"codec": "opus",
						"jitterMs": 8,
						"audioLevel": 0.2
					}
				],
				"droppedNativeVideoFrames": 0,
				"droppedVideoFrameCallbacks": 0,
				"send": null
			},
			"statsOperationId": null,
			"statsFailure": null,
			"hardwareEncoder": {
				"capabilities": null,
				"operationId": null,
				"failure": null
			},
			"permissions": {
				"results": {
					"microphone": {
						"name": "microphone",
						"status": "granted",
						"canPrompt": false
					},
					"camera": {
						"name": "camera",
						"status": "granted",
						"canPrompt": false
					}
				},
				"operationIds": {},
				"failure": null
			},
			"devices": {
				"inventory": {
					"audioInputs": [
						{
							"deviceId": "mic-1",
							"label": "Studio Mic",
							"isDefault": true
						}
					],
					"audioOutputs": [
						{
							"deviceId": "speaker-1",
							"label": "Desk Speakers",
							"isDefault": true
						}
					],
					"cameras": [
						{
							"deviceId": "camera-1",
							"label": "Face Camera"
						}
					],
					"selectedAudioInputId": "mic-1",
					"selectedAudioOutputId": "speaker-1",
					"selectedCameraId": "camera-1"
				},
				"operationId": null,
				"failure": null
			},
			"e2ee": {
				"status": "disabled",
				"keyId": null,
				"failure": null,
				"operationId": null
			},
			"nativeCapture": {
				"captures": {},
				"operationIds": {},
				"failure": null
			},
			"nativeAudioTap": {
				"taps": {},
				"operationIds": {},
				"failure": null
			},
			"nativeFrameSink": {
				"sinks": {},
				"operationIds": {},
				"failure": null
			},
			"diagnostics": [],
			"lifecycle": {
				"tearingDown": false,
				"reason": null,
				"operationId": null,
				"failure": null
			},
			"room": {
				"participants": {
					"user-2": {
						"sid": "participant-remote-1",
						"identity": "user-2",
						"name": "Riley"
					}
				},
				"tracks": {
					"track-remote-mic-1": {
						"participantIdentity": "user-2",
						"participantSid": "participant-remote-1",
						"trackSid": "track-remote-mic-1",
						"trackName": "microphone",
						"kind": "audio",
						"source": "microphone",
						"muted": false
					},
					"track-remote-screen-1": {
						"participantIdentity": "user-2",
						"participantSid": "participant-remote-1",
						"trackSid": "track-remote-screen-1",
						"trackName": "screen",
						"kind": "video",
						"source": "screen",
						"muted": false
					}
				}
			},
			"inboundVideo": {
				"tracks": {},
				"droppedFrameCount": 0
			},
			"sourceLifecycles": {},
			"lastFailure": null
		},
		"finalModel": {
			"connection": {
				"status": "connected",
				"connected": true,
				"connecting": false,
				"reconnecting": false,
				"failed": false,
				"gateway": {
					"selfVoiceState": {
						"guildId": "guild-1",
						"channelId": "channel-1",
						"userId": "user-1",
						"sessionId": "session-1",
						"selfMute": false,
						"selfDeaf": false,
						"selfVideo": true,
						"selfStream": true,
						"suppress": false,
						"requestToSpeakTimestamp": null
					},
					"voiceServer": {
						"guildId": "guild-1",
						"endpoint": "voice-gateway.example.test",
						"token": "gateway-token-1"
					}
				},
				"liveKit": {
					"connectionState": "connected",
					"roomSid": "room-1",
					"roomName": "guild-1/channel-1",
					"serverRegion": "us-east"
				}
			},
			"media": {
				"microphone": "published",
				"camera": "published",
				"screen": "published",
				"screenAudio": "published",
				"audio": {
					"mode": "pushToTalk",
					"locallyMuted": false,
					"preferredLocallyMuted": false,
					"locallyDeafened": false,
					"mutedByPermission": false,
					"hasUserSetMute": false,
					"hasUserSetDeaf": false,
					"shouldUnmuteOnUndeafen": false,
					"pushToTalkActive": true,
					"pushToMuteActive": false,
					"inputVolume": 0.85,
					"outputVolume": 1
				},
				"effectiveMicrophoneEnabled": true,
				"localSpeakingOverride": true,
				"e2ee": {
					"status": "disabled",
					"keyId": null,
					"failure": null
				},
				"screenCaptureId": "screen-1"
			},
			"canPublishMedia": true,
			"hasActiveLocalMedia": true,
			"participants": [
				{
					"sid": "participant-remote-1",
					"identity": "user-2",
					"name": "Riley"
				}
			],
			"tracks": [
				{
					"participantIdentity": "user-2",
					"participantSid": "participant-remote-1",
					"trackSid": "track-remote-mic-1",
					"trackName": "microphone",
					"kind": "audio",
					"source": "microphone",
					"muted": false
				},
				{
					"participantIdentity": "user-2",
					"participantSid": "participant-remote-1",
					"trackSid": "track-remote-screen-1",
					"trackName": "screen",
					"kind": "video",
					"source": "screen",
					"muted": false
				}
			],
			"watchedStreams": [],
			"inboundVideoTracks": [],
			"devices": {
				"audioInputs": [
					{
						"deviceId": "mic-1",
						"label": "Studio Mic",
						"isDefault": true
					}
				],
				"audioOutputs": [
					{
						"deviceId": "speaker-1",
						"label": "Desk Speakers",
						"isDefault": true
					}
				],
				"cameras": [
					{
						"deviceId": "camera-1",
						"label": "Face Camera"
					}
				],
				"selectedAudioInputId": "mic-1",
				"selectedAudioOutputId": "speaker-1",
				"selectedCameraId": "camera-1"
			},
			"permissions": {
				"microphone": {
					"name": "microphone",
					"status": "granted",
					"canPrompt": false
				},
				"camera": {
					"name": "camera",
					"status": "granted",
					"canPrompt": false
				}
			},
			"stats": {
				"rttMs": 42,
				"outbound": [
					{
						"trackSid": "local-mic",
						"source": "microphone",
						"kind": "audio",
						"bitrateKbps": 48,
						"packetsLost": 0,
						"codec": "opus",
						"audioLevel": 0.12
					},
					{
						"trackSid": "local-screen",
						"source": "screen",
						"kind": "video",
						"bitrateKbps": 2500,
						"packetsLost": 1,
						"codec": "h264",
						"width": 1920,
						"height": 1080,
						"fps": 30,
						"zeroCopy": true
					}
				],
				"inbound": [
					{
						"participantIdentity": "user-2",
						"participantSid": "participant-remote-1",
						"trackSid": "track-remote-mic-1",
						"kind": "audio",
						"bitrateKbps": 40,
						"packetsLost": 0,
						"codec": "opus",
						"jitterMs": 8,
						"audioLevel": 0.2
					}
				],
				"droppedNativeVideoFrames": 0,
				"droppedVideoFrameCallbacks": 0,
				"send": null
			},
			"diagnostics": [],
			"tearingDown": false
		}
	}
}
