Better audio management (#10)
* add audio_session package * `AudioManager` initial design * try to integrate audio manager * configure audio session * `DisposeAware` disposing if already published causes exception. * organize * guard flutter_webrtc calls * websocket async fix * use `ConnectionState` instead of `_isClosed` and `isReconnecting` * change create audio track defaults * update protos * protocol 3 speaker updates * fix exception * emit `RoomDisconnectedEvent` only once * fix exception * keep track of local / remote audio tracks * explicit types * manage track state * re-structure audio management * change defaults * unpublish all * use experimental build * change defaults * configuring is optional * call native `RTCAudioSession.setConfiguration` * defaults adjustment * iOS only for now * use lib 92.4515.07 * clean up * revert audio options for now * remove pod source * rename apple related audio * `createListener` method * organize native audio * `SpeakingChangedEvent` only on `Participant` * refactoring * fix ios compile * fix configure audio only for iOS logic * minor fix & clean up * change dispose logic * format protos * fix unpublishTrack * `createListener` into a mixin * simplify * use flutter_webrtc master * unpublish for example * update ios icon * android icon * web icon * favicon
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import 'platforms/io.dart' if (dart.library.html) 'platforms/web.dart';
|
||||
|
||||
class WebSocketException implements Exception {
|
||||
final int code;
|
||||
const WebSocketException._(this.code);
|
||||
|
||||
static WebSocketException unknown() => const WebSocketException._(0);
|
||||
static WebSocketException connect() => const WebSocketException._(1);
|
||||
|
||||
@override
|
||||
String toString() => {
|
||||
WebSocketException.unknown(): 'Unknown error',
|
||||
WebSocketException.connect(): 'Failed to connect',
|
||||
}[this]!;
|
||||
}
|
||||
|
||||
typedef WebSocketOnData = Function(dynamic data);
|
||||
typedef WebSocketOnError = Function(dynamic error);
|
||||
typedef WebSocketOnDispose = Function();
|
||||
|
||||
class WebSocketEventHandlers {
|
||||
final WebSocketOnData? onData;
|
||||
final WebSocketOnError? onError;
|
||||
final WebSocketOnDispose? onDispose;
|
||||
const WebSocketEventHandlers({
|
||||
this.onData,
|
||||
this.onError,
|
||||
this.onDispose,
|
||||
});
|
||||
}
|
||||
|
||||
abstract class LiveKitWebSocket {
|
||||
void send(List<int> data);
|
||||
Future<void> dispose();
|
||||
|
||||
static Future<LiveKitWebSocket> connect(
|
||||
Uri uri, [
|
||||
WebSocketEventHandlers? options,
|
||||
]) =>
|
||||
lkWebSocketConnect(uri, options);
|
||||
}
|
||||
Reference in New Issue
Block a user