protocol 8. (#134)

* protocol 8.

* add FastConnectOptions.

* update.

* fix.

* Deprecated the top connect method.

* Add fast connect button in example.

* Create a Listener before connecting.

* Force protocol-v7 for deprecated APIs.

* remove commented out line.

* relative path import.

* update.
This commit is contained in:
CloudWebRTC
2022-07-11 19:54:08 +08:00
committed by GitHub
parent 66d4052ada
commit 3d8bf96651
8 changed files with 122 additions and 18 deletions
+12 -1
View File
@@ -1,5 +1,6 @@
import 'core/room.dart';
import 'options.dart';
import 'types/other.dart';
/// Main entry point to connect to a room.
/// {@category Room}
@@ -9,6 +10,8 @@ class LiveKitClient {
/// Convenience method for connecting to a LiveKit server.
/// Returns a [Room] upon a successful connect or throws when it fails.
/// Alternatively, it is possible to instantiate [Room] and call [Room.connect] directly.
@Deprecated(
'Use `Room.connect` instead, This method is deprecated above Protocol v8.')
static Future<Room> connect(
String url,
String token, {
@@ -16,11 +19,19 @@ class LiveKitClient {
RoomOptions? roomOptions,
}) async {
final room = Room();
ConnectOptions copyOptions = ConnectOptions(
autoSubscribe:
connectOptions != null ? connectOptions.autoSubscribe : true,
rtcConfiguration: connectOptions != null
? connectOptions.rtcConfiguration
: const RTCConfiguration(),
protocolVersion: ProtocolVersion.v7,
);
try {
await room.connect(
url,
token,
connectOptions: connectOptions,
connectOptions: copyOptions,
roomOptions: roomOptions,
);
return room;