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

Commit

Permalink
Fix/419 audio preview stop now returns a boolean (#420)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
graduad authored Aug 17, 2023
1 parent b222f84 commit b0abf7f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ios/Classes/Bindings/AudioPreviewServiceBinding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ class AudioPreviewServiceBinding: Binding {
flutterArguments: FlutterMethodCallArguments,
completionHandler: FlutterMethodCallCompletionHandler
) {
audioPreview().stop()
completionHandler.success(flutterConvertible: true)
completionHandler.success(flutterConvertible: audioPreview().stop())
}

/// Release the internal memory and restart the audio session configuration.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/sdk_api/audio/audio_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class AudioPreview {
}

/// Stops recording or playing an audio sample.
Future<void> stop() async {
Future<bool> stop() async {
return await _methodChannel.invokeMethod("stop");
}

Expand Down
34 changes: 34 additions & 0 deletions test_app/lib/screens/join_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,40 @@ class _JoinConferenceContentState extends State<JoinConferenceContent> {
color: Colors.deepPurple,
),
const SizedBox(height: 16),
PrimaryButton(
widgetText: const Text('Current conference'),
onPressed: () async {
try {
var conference = await _dolbyioCommsSdkFlutterPlugin
.conference
.current();
if (!mounted) return;

if (conference == null) {
ViewDialogs.dialog(
context: context,
title: "Conference",
body: "Conference is null",
);
} else {
ViewDialogs.dialog(
context: context,
title: "Conference",
body: conference.toJson().toString(),
);
}
} catch (error) {
if (!mounted) return;
ViewDialogs.dialog(
context: context,
title: "Error",
body: error.toString(),
);
}
},
color: Colors.deepPurple,
),
const SizedBox(height: 16),
PrimaryButton(
widgetText: const Text('Audio preview'),
onPressed: () {
Expand Down

0 comments on commit b0abf7f

Please sign in to comment.