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

Commit a0ab931

Browse files
mpozygraduad
andauthored
Rename cancel to stop in audio preview (#413)
Also rename the RecorderStatus to AudioCaptureOptions. Branch commits: * Changes for 3.10.1 and changed return type. * Update Podfile.lock * Update ios moks version * Simplify pod repo update command * Fix a rename issue in tests --------- Co-authored-by: Gabriel Radu <gabriel.radu@dolby.com>
1 parent e31988d commit a0ab931

File tree

20 files changed

+123
-123
lines changed

20 files changed

+123
-123
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ jobs:
111111
- name: Fetch dependencies
112112
run: |
113113
flutter pub get
114+
- name: Update Cocoapods repo
115+
run: pod repo update
114116
- name: Run unmocked integration tests
115117
env:
116118
APP_KEY: ${{ secrets.DOLBYIO_APP_KEY }}

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version '1.0-SNAPSHOT'
33

44
buildscript {
55
ext.kotlin_version = '1.7.10'
6-
ext.voxeet_sdk_version = "3.10.0"
6+
ext.voxeet_sdk_version = "[3.10.1,3.11)"
77
ext.dagger_version = "2.40.5"
88
repositories {
99
google()

android/src/main/kotlin/io/dolby/comms/sdk/flutter/events/AudioPreviewEventEmitter.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
package io.dolby.comms.sdk.flutter.events
22

33
import com.voxeet.VoxeetSDK
4-
import com.voxeet.android.media.capture.audio.preview.RecorderStatus
4+
import com.voxeet.android.media.capture.audio.preview.AudioPreviewStatus
55

66
class AudioPreviewEventEmitter(eventChannelHandler: EventChannelHandler) : NativeEventEmitter(eventChannelHandler) {
77

88
/**
99
* Emitted when the application user received an audio preview status changed.
1010
*/
11-
private val previewCallback: (RecorderStatus) -> Unit = { status ->
11+
private val previewCallback: (AudioPreviewStatus) -> Unit = { status ->
1212
emit(OnStatusChanged, status.name)
1313
}
1414

1515
override fun registerEventEmitter() {
16-
VoxeetSDK.audio().local.preview().callback = previewCallback
16+
VoxeetSDK.audio().local.preview().onStatusChanged = previewCallback
1717
}
1818

1919
override fun unregisterEventEmitter() {
20-
VoxeetSDK.audio().local.preview().callback = null
20+
VoxeetSDK.audio().local.preview().onStatusChanged = null
2121
}
2222

2323
companion object {

android/src/main/kotlin/io/dolby/comms/sdk/flutter/module/audio/AudioPreviewNativeModule.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class AudioPreviewNativeModule(private val scope: CoroutineScope) : NativeModule
3232
::setCaptureMode.name -> setCaptureMode(call, result)
3333
::record.name -> record(call, result)
3434
::play.name -> play(call, result)
35-
::cancel.name -> cancel(result)
35+
::stop.name -> stop(result)
3636
::release.name -> release(result)
3737
}
3838
}
@@ -83,10 +83,10 @@ class AudioPreviewNativeModule(private val scope: CoroutineScope) : NativeModule
8383
}
8484
)
8585

86-
private fun cancel(result: MethodChannel.Result) = scope.launch(
86+
private fun stop(result: MethodChannel.Result) = scope.launch(
8787
onError = result::onError,
8888
onSuccess = {
89-
result.success(VoxeetSDK.audio().local.preview().cancel())
89+
result.success(VoxeetSDK.audio().local.preview().stop())
9090
}
9191
)
9292

ios/Classes/Bindings/AudioPreviewServiceBinding.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class AudioPreviewServiceBinding: Binding {
99
do {
1010
try self?.nativeEventEmitter.sendEvent(
1111
event: EventKeys.statusChanged,
12-
body: DTO.RecorderStatus(recorderStatus: status)
12+
body: DTO.AudioPreviewStatus(audioPreviewStatus: status)
1313
)
1414
} catch {
1515
fatalError(error.localizedDescription)
@@ -26,7 +26,7 @@ class AudioPreviewServiceBinding: Binding {
2626
completionHandler: FlutterMethodCallCompletionHandler
2727
) {
2828
let status = audioPreview().status
29-
completionHandler.success(encodable: DTO.RecorderStatus(recorderStatus: status))
29+
completionHandler.success(encodable: DTO.AudioPreviewStatus(audioPreviewStatus: status))
3030
}
3131

3232
/// Retrieves the comfort noise level setting for output devices in Dolby Voice conferences.
@@ -101,15 +101,15 @@ class AudioPreviewServiceBinding: Binding {
101101
}
102102
}
103103

104-
/// If playing or recording is underway calling this method will cancel the ongoing activity.
104+
/// If playing or recording is underway calling this method will stop the ongoing activity.
105105
/// - Parameters:
106106
/// - flutterArguments: Method arguments passed from Flutter.
107107
/// - completionHandler: Call methods on this instance when execution has finished.
108-
public func cancel(
108+
public func stop(
109109
flutterArguments: FlutterMethodCallArguments,
110110
completionHandler: FlutterMethodCallCompletionHandler
111111
) {
112-
audioPreview().cancel()
112+
audioPreview().stop()
113113
completionHandler.success(flutterConvertible: true)
114114
}
115115

@@ -144,8 +144,8 @@ extension AudioPreviewServiceBinding: FlutterBinding {
144144
play(flutterArguments: flutterArguments, completionHandler: completionHandler)
145145
case "record":
146146
record(flutterArguments: flutterArguments, completionHandler: completionHandler)
147-
case "cancel":
148-
cancel(flutterArguments: flutterArguments, completionHandler: completionHandler)
147+
case "stop":
148+
stop(flutterArguments: flutterArguments, completionHandler: completionHandler)
149149
case "release":
150150
release(flutterArguments: flutterArguments, completionHandler: completionHandler)
151151
default:

ios/Classes/Bindings/Models/AudioDTO.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import WebRTC
44

55
typealias VTAudioCaptureMode = AudioCaptureMode
66
typealias VTVoiceFont = VoiceFont
7-
typealias VTRecorderStatus = RecorderStatus
7+
typealias VTAudioPreviewStatus = AudioPreviewStatus
88

99
extension DTO {
1010

@@ -157,29 +157,29 @@ extension DTO {
157157
}
158158
}
159159

160-
struct RecorderStatus: Codable {
160+
struct AudioPreviewStatus: Codable {
161161

162-
let recorderStatus: VTRecorderStatus
162+
let audioPreviewStatus: VTAudioPreviewStatus
163163

164-
init(recorderStatus: VTRecorderStatus) {
165-
self.recorderStatus = recorderStatus
164+
init(audioPreviewStatus: VTAudioPreviewStatus) {
165+
self.audioPreviewStatus = audioPreviewStatus
166166
}
167167

168168
init(from decoder: Decoder) throws {
169169
let container = try decoder.singleValueContainer()
170170
switch try container.decode(String.self) {
171-
case "NoRecordingAvailable": recorderStatus = .noRecordingAvailable
172-
case "RecordingAvailable": recorderStatus = .recordingAvailable
173-
case "Recording": recorderStatus = .recording
174-
case "Playing": recorderStatus = .playing
175-
case "Released": recorderStatus = .released
171+
case "NoRecordingAvailable": audioPreviewStatus = .noRecordingAvailable
172+
case "RecordingAvailable": audioPreviewStatus = .recordingAvailable
173+
case "Recording": audioPreviewStatus = .recording
174+
case "Playing": audioPreviewStatus = .playing
175+
case "Released": audioPreviewStatus = .released
176176
default: throw EncoderError.decoderFailed()
177177
}
178178
}
179179

180180
func encode(to encoder: Encoder) throws {
181181
var container = encoder.singleValueContainer()
182-
switch recorderStatus {
182+
switch audioPreviewStatus {
183183
case .noRecordingAvailable: try container.encode("NoRecordingAvailable")
184184
case .recordingAvailable: try container.encode("RecordingAvailable")
185185
case .recording: try container.encode("Recording")

ios/dolbyio_comms_sdk_flutter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DESC
1919
s.source = { :path => '.' }
2020
s.source_files = 'Classes/**/*'
2121
s.dependency 'Flutter'
22-
s.dependency 'VoxeetSDK', '~> 3.10.0'
22+
s.dependency 'VoxeetSDK', '~> 3.10.1'
2323
s.platforms = {
2424
:ios => "12.0"
2525
}

lib/dolbyio_comms_sdk_flutter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ export 'src/sdk_api/models/audio.dart'
8686
AudioCaptureMode,
8787
NoiseReduction,
8888
VoiceFont,
89-
RecorderStatus;
89+
AudioPreviewStatus;

lib/src/sdk_api/audio/audio_preview.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ class AudioPreview {
1717
.receiveBroadcastStream();
1818

1919
/// Gets the recording status.
20-
Future<RecorderStatus> status() async {
20+
Future<AudioPreviewStatus> status() async {
2121
var status = await _methodChannel.invokeMethod("status");
22-
return Future(() => RecorderStatus.decode(status));
22+
return Future(() => AudioPreviewStatus.decode(status));
2323
}
2424

2525
/// Gets an audio capture mode for the audio preview.
@@ -47,9 +47,9 @@ class AudioPreview {
4747
return await _methodChannel.invokeMethod("record", {"duration": duration});
4848
}
4949

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

5555
/// Release the internal memory and restart the audio session configuration.
@@ -58,13 +58,13 @@ class AudioPreview {
5858
}
5959

6060
/// Returns a [Stream] of the [AudioPreviewEventNames.onStatusChanged] events. By subscribing to the returned stream you will be notified about new conference invitations.
61-
Stream<Event<AudioPreviewEventNames, RecorderStatus>> onStatusChanged() {
61+
Stream<Event<AudioPreviewEventNames, AudioPreviewStatus>> onStatusChanged() {
6262
return _eventStream
6363
.addListener([AudioPreviewEventNames.onStatusChanged.value]).map((map) {
6464
final event = map as Map<Object?, Object?>;
6565
final key = AudioPreviewEventNames.valueOf(event["key"] as String);
6666
final data = event["body"] as String;
67-
return Event(key, RecorderStatus.decode(data));
67+
return Event(key, AudioPreviewStatus.decode(data));
6868
});
6969
}
7070
}

lib/src/sdk_api/models/audio.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ enum VoiceFont {
193193
}
194194
}
195195

196-
/// The RecorderStatus model gathers all possible statuses of audio samples recording for audio preview.
196+
/// The AudioPreviewStatus model gathers all possible statuses of audio samples recording for audio preview.
197197
///
198198
/// This model is available in SDK 3.10 and later.
199-
enum RecorderStatus {
199+
enum AudioPreviewStatus {
200200
/// There is no recording available.
201201
noRecordingAvailable("NoRecordingAvailable"),
202202

@@ -214,14 +214,14 @@ enum RecorderStatus {
214214

215215
final String _value;
216216

217-
const RecorderStatus(this._value);
217+
const AudioPreviewStatus(this._value);
218218

219219
String encode() {
220220
return _value;
221221
}
222222

223-
static RecorderStatus decode(String? value) {
224-
return RecorderStatus.values.firstWhere(
223+
static AudioPreviewStatus decode(String? value) {
224+
return AudioPreviewStatus.values.firstWhere(
225225
(element) => element._value == value,
226226
orElse: () => throw Exception("Invalid enum name"),
227227
);

0 commit comments

Comments
 (0)