Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit b0abf7f

Browse files
authored
Fix/419 audio preview stop now returns a boolean (#420)
If it returns false it means that there was nothing to stop. Sub-commits: * Make audioPreview.stop() return bool. * Add get current conference button to join screen
1 parent b222f84 commit b0abf7f

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

ios/Classes/Bindings/AudioPreviewServiceBinding.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ class AudioPreviewServiceBinding: Binding {
109109
flutterArguments: FlutterMethodCallArguments,
110110
completionHandler: FlutterMethodCallCompletionHandler
111111
) {
112-
audioPreview().stop()
113-
completionHandler.success(flutterConvertible: true)
112+
completionHandler.success(flutterConvertible: audioPreview().stop())
114113
}
115114

116115
/// Release the internal memory and restart the audio session configuration.

lib/src/sdk_api/audio/audio_preview.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class AudioPreview {
4848
}
4949

5050
/// Stops recording or playing an audio sample.
51-
Future<void> stop() async {
51+
Future<bool> stop() async {
5252
return await _methodChannel.invokeMethod("stop");
5353
}
5454

test_app/lib/screens/join_screen.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,40 @@ class _JoinConferenceContentState extends State<JoinConferenceContent> {
385385
color: Colors.deepPurple,
386386
),
387387
const SizedBox(height: 16),
388+
PrimaryButton(
389+
widgetText: const Text('Current conference'),
390+
onPressed: () async {
391+
try {
392+
var conference = await _dolbyioCommsSdkFlutterPlugin
393+
.conference
394+
.current();
395+
if (!mounted) return;
396+
397+
if (conference == null) {
398+
ViewDialogs.dialog(
399+
context: context,
400+
title: "Conference",
401+
body: "Conference is null",
402+
);
403+
} else {
404+
ViewDialogs.dialog(
405+
context: context,
406+
title: "Conference",
407+
body: conference.toJson().toString(),
408+
);
409+
}
410+
} catch (error) {
411+
if (!mounted) return;
412+
ViewDialogs.dialog(
413+
context: context,
414+
title: "Error",
415+
body: error.toString(),
416+
);
417+
}
418+
},
419+
color: Colors.deepPurple,
420+
),
421+
const SizedBox(height: 16),
388422
PrimaryButton(
389423
widgetText: const Text('Audio preview'),
390424
onPressed: () {

0 commit comments

Comments
 (0)