Skip to content

Commit e766e28

Browse files
web
1 parent f52f080 commit e766e28

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

example/lib/src/device_enumeration_sample.dart

+20-5
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,33 @@ class _DeviceEnumerationSampleState extends State<DeviceEnumerationSample> {
116116

117117
Future<void> _negotiate() async {
118118
try {
119-
final offer = await pc!.createOffer();
119+
Map<String, dynamic> buildConstraints() {
120+
if (kIsWeb) {
121+
return {
122+
'offerToReceiveAudio': true,
123+
'offerToReceiveVideo': true,
124+
};
125+
} else {
126+
return {};
127+
}
128+
}
129+
130+
final offer = await pc!.createOffer(buildConstraints());
131+
120132
await pc!.setLocalDescription(offer);
121133

122134
final response = await dio.postUri<Map<String, dynamic>>(
123135
Uri.https(
124136
'preprod-smartdevicemanagement.googleapis.com',
125137
'/v1/enterprises/$enterpriseId/devices/$deviceId:executeCommand',
126138
),
127-
options: Options(headers: {
128-
'Authorization': 'Bearer $jwt',
129-
'X-SDM-ID-Token': sdmIdToken,
130-
}),
139+
options: Options(
140+
headers: {
141+
'Authorization': 'Bearer $jwt',
142+
'X-SDM-ID-Token': sdmIdToken,
143+
},
144+
contentType: Headers.jsonContentType,
145+
),
131146
data: <String, dynamic>{
132147
'command':
133148
'sdm.devices.commands.CameraLiveStreamWithTalkBack.GenerateWebRtcStream',

0 commit comments

Comments
 (0)