Apply Flutter best practices [Non-Breaking] (#2)
* Add flutter_lints package * Use key in widget constructors lint: use_key_in_widget_constructors * Unnecessary new keyword lint: unnecessary_new * Prefer const with constant constructors * Exclude protobuf files from analyzer * Private field could be final * Annotate overridden members * Use initializing formals when possible * Don't access members with `this` unless avoiding shadowing * Prefer is! operator * Use isEmpty instead of length * Use collection literals when possible * Revert comment changes * Cleaner null testing * Misc fixes * Avoid using `forEach` with a function literal * Prefer `final` over `var` where applicable * Enforce stricter type-checking * Ignore VS Code files * Flutter format * Prefer using lowerCamelCase for constant names * flutter format -l 100 * Disable `avoid_print` for examples * Slight improvements to example Should solve lint error: no_logic_in_create_state
This commit is contained in:
@@ -32,7 +32,7 @@ jobs:
|
||||
- run: flutter pub get
|
||||
|
||||
# Check for any formatting issues in the code.
|
||||
- run: flutter format --set-exit-if-changed .
|
||||
- run: flutter format --set-exit-if-changed -l 100 .
|
||||
|
||||
# Statically analyze the Dart code for any errors.
|
||||
- run: flutter analyze .
|
||||
|
||||
@@ -73,3 +73,6 @@ build/
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
!**/ios/**/default.perspectivev3
|
||||
|
||||
# VS Code
|
||||
.vscode/
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
|
||||
# https://pub.dev/packages/flutter_lints
|
||||
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
#
|
||||
# Enforce stricter type-checking
|
||||
# https://dart.dev/guides/language/analysis-options#enabling-additional-type-checks
|
||||
# https://dash-overflow.net/articles/getting_started/#step-3-disabling-_implicit-dynamic_--_implicit-cast_
|
||||
#
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
||||
#
|
||||
# exclude protobuf files
|
||||
#
|
||||
exclude:
|
||||
- '**/*.pb.dart'
|
||||
- '**/*.pbenum.dart'
|
||||
- '**/*.pbjson.dart'
|
||||
- '**/*.pbserver.dart'
|
||||
|
||||
linter:
|
||||
rules:
|
||||
#
|
||||
# Additional recommended rules
|
||||
#
|
||||
prefer_single_quotes: true
|
||||
@@ -0,0 +1,44 @@
|
||||
# This file configures the analyzer, which statically analyzes Dart code to
|
||||
# check for errors, warnings, and lints.
|
||||
#
|
||||
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
|
||||
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
|
||||
# invoked from the command line by running `flutter analyze`.
|
||||
|
||||
# The following line activates a set of recommended lints for Flutter apps,
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
|
||||
# https://pub.dev/packages/flutter_lints
|
||||
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
#
|
||||
# Enforce stricter type-checking
|
||||
# https://dart.dev/guides/language/analysis-options#enabling-additional-type-checks
|
||||
# https://dash-overflow.net/articles/getting_started/#step-3-disabling-_implicit-dynamic_--_implicit-cast_
|
||||
#
|
||||
strong-mode:
|
||||
implicit-casts: false
|
||||
implicit-dynamic: false
|
||||
|
||||
#
|
||||
# exclude protobuf files
|
||||
#
|
||||
exclude:
|
||||
- '**/*.pb.dart'
|
||||
- '**/*.pbenum.dart'
|
||||
- '**/*.pbjson.dart'
|
||||
- '**/*.pbserver.dart'
|
||||
|
||||
linter:
|
||||
rules:
|
||||
#
|
||||
# Additional recommended rules
|
||||
#
|
||||
prefer_single_quotes: true
|
||||
|
||||
#
|
||||
# Turn off avoid_print for example projects
|
||||
#
|
||||
avoid_print: false
|
||||
+83
-58
@@ -10,88 +10,113 @@ void main() {
|
||||
print('${record.level.name}: ${record.time}: ${record.message}');
|
||||
});
|
||||
|
||||
runApp(MyApp());
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
//
|
||||
const MyApp({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'LiveKit Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.deepPurple,
|
||||
),
|
||||
home: PreConnect(),
|
||||
);
|
||||
}
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
title: 'LiveKit Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.deepPurple,
|
||||
),
|
||||
home: const PreConnectWidget(
|
||||
url: '<livekit_host>',
|
||||
token: '<access_token>',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class PreConnect extends StatefulWidget {
|
||||
class PreConnectWidget extends StatefulWidget {
|
||||
//
|
||||
final String url;
|
||||
final String token;
|
||||
|
||||
const PreConnectWidget({
|
||||
required this.url,
|
||||
required this.token,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _PreConnectState(
|
||||
'<livekit_host>',
|
||||
'<access_token>',
|
||||
);
|
||||
}
|
||||
State<StatefulWidget> createState() => _PreConnectWidgetState();
|
||||
}
|
||||
|
||||
class _PreConnectState extends State<PreConnect> {
|
||||
String url;
|
||||
String token;
|
||||
class _PreConnectWidgetState extends State<PreConnectWidget> {
|
||||
//
|
||||
final _urlCtrl = TextEditingController();
|
||||
final _tokenCtrl = TextEditingController();
|
||||
|
||||
_PreConnectState(this.url, this.token);
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_urlCtrl.text = widget.url;
|
||||
_tokenCtrl.text = widget.token;
|
||||
}
|
||||
|
||||
_connect(BuildContext context) async {
|
||||
@override
|
||||
void dispose() {
|
||||
_urlCtrl.dispose();
|
||||
_tokenCtrl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _connect(BuildContext context) async {
|
||||
try {
|
||||
var room = await LiveKitClient.connect(this.url, this.token);
|
||||
Navigator.push(
|
||||
print('Connecting with url: ${_urlCtrl.text}, token: ${_tokenCtrl.text}...');
|
||||
|
||||
final room = await LiveKitClient.connect(
|
||||
_urlCtrl.text,
|
||||
_tokenCtrl.text,
|
||||
);
|
||||
|
||||
Navigator.push<void>(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return RoomWidget(room);
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
print("could not connect $e");
|
||||
print('could not connect $e');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Connect to LiveKit'),
|
||||
),
|
||||
body: Center(
|
||||
child: Container(
|
||||
// width: 250,
|
||||
alignment: Alignment.center,
|
||||
margin: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'URL',
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Connect to LiveKit'),
|
||||
),
|
||||
body: Center(
|
||||
child: Container(
|
||||
// width: 250,
|
||||
alignment: Alignment.center,
|
||||
margin: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: _urlCtrl,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'URL',
|
||||
),
|
||||
),
|
||||
onChanged: (value) => this.url,
|
||||
initialValue: this.url,
|
||||
),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Token',
|
||||
TextField(
|
||||
controller: _tokenCtrl,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Token',
|
||||
),
|
||||
),
|
||||
onChanged: (value) => this.token,
|
||||
initialValue: this.token,
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => _connect(context),
|
||||
child: Text('Connect'),
|
||||
),
|
||||
],
|
||||
TextButton(
|
||||
onPressed: () => _connect(context),
|
||||
child: const Text('Connect'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
+32
-33
@@ -4,9 +4,13 @@ import 'package:livekit_example/src/controls.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class RoomWidget extends StatefulWidget {
|
||||
//
|
||||
final Room room;
|
||||
|
||||
RoomWidget(this.room);
|
||||
const RoomWidget(
|
||||
this.room, {
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -32,16 +36,16 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_onConnected() async {
|
||||
void _onConnected() async {
|
||||
// video will fail when running in ios simulator
|
||||
try {
|
||||
var localVideo = await LocalVideoTrack.createCameraTrack();
|
||||
final localVideo = await LocalVideoTrack.createCameraTrack();
|
||||
await widget.room.localParticipant.publishVideoTrack(localVideo);
|
||||
} catch (e) {
|
||||
print('could not publish video: $e');
|
||||
}
|
||||
|
||||
var localAudio = await LocalAudioTrack.createTrack();
|
||||
final localAudio = await LocalAudioTrack.createTrack();
|
||||
await widget.room.localParticipant.publishAudioTrack(localAudio);
|
||||
sortParticipants();
|
||||
}
|
||||
@@ -65,14 +69,9 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
}
|
||||
|
||||
// last spoken at
|
||||
var aSpokeAt = a.lastSpokeAt?.millisecondsSinceEpoch;
|
||||
var bSpokeAt = b.lastSpokeAt?.millisecondsSinceEpoch;
|
||||
if (aSpokeAt == null) {
|
||||
aSpokeAt = 0;
|
||||
}
|
||||
if (bSpokeAt == null) {
|
||||
bSpokeAt = 0;
|
||||
}
|
||||
final aSpokeAt = a.lastSpokeAt?.millisecondsSinceEpoch ?? 0;
|
||||
final bSpokeAt = b.lastSpokeAt?.millisecondsSinceEpoch ?? 0;
|
||||
|
||||
if (aSpokeAt != bSpokeAt) {
|
||||
return aSpokeAt > bSpokeAt ? -1 : 1;
|
||||
}
|
||||
@@ -83,8 +82,7 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
}
|
||||
|
||||
// joinedAt
|
||||
return a.joinedAt.millisecondsSinceEpoch -
|
||||
b.joinedAt.millisecondsSinceEpoch;
|
||||
return a.joinedAt.millisecondsSinceEpoch - b.joinedAt.millisecondsSinceEpoch;
|
||||
});
|
||||
|
||||
if (participants.length > 1) {
|
||||
@@ -99,8 +97,8 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
|
||||
@override
|
||||
void onDisconnected() {
|
||||
var context = _lastContext;
|
||||
print("disconnected: $context");
|
||||
final context = _lastContext;
|
||||
print('disconnected: $context');
|
||||
if (context != null) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
@@ -110,8 +108,8 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
Widget build(BuildContext context) {
|
||||
_lastContext = context;
|
||||
|
||||
var mainWidgets = <Widget>[];
|
||||
var participants = this.participants;
|
||||
final mainWidgets = <Widget>[];
|
||||
final participants = this.participants;
|
||||
if (participants.isNotEmpty) {
|
||||
mainWidgets.add(Expanded(child: VideoView(participants.first)));
|
||||
} else {
|
||||
@@ -119,7 +117,7 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
}
|
||||
|
||||
if (participants.length > 1) {
|
||||
var videoList = ListView.builder(
|
||||
final videoList = ListView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: participants.length - 1,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
@@ -127,12 +125,11 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
width: 100,
|
||||
height: 60,
|
||||
padding: const EdgeInsets.all(2),
|
||||
child:
|
||||
VideoView(participants[index + 1], quality: VideoQuality.LOW),
|
||||
child: VideoView(participants[index + 1], quality: VideoQuality.LOW),
|
||||
);
|
||||
},
|
||||
);
|
||||
mainWidgets.add(Container(
|
||||
mainWidgets.add(SizedBox(
|
||||
height: 60,
|
||||
child: videoList,
|
||||
));
|
||||
@@ -157,11 +154,15 @@ class _RoomState extends State<RoomWidget> with RoomDelegate {
|
||||
|
||||
// displays a participant in view
|
||||
class VideoView extends StatefulWidget {
|
||||
//
|
||||
final Participant participant;
|
||||
final VideoQuality quality;
|
||||
|
||||
VideoView(this.participant, {VideoQuality quality = VideoQuality.MEDIUM})
|
||||
: this.quality = quality;
|
||||
const VideoView(
|
||||
this.participant, {
|
||||
this.quality = VideoQuality.MEDIUM,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -175,13 +176,13 @@ class _VideoViewState extends State<VideoView> with ParticipantDelegate {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.participant.addListener(this._onParticipantChanged);
|
||||
widget.participant.addListener(_onParticipantChanged);
|
||||
_onParticipantChanged();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.participant.removeListener(this._onParticipantChanged);
|
||||
widget.participant.removeListener(_onParticipantChanged);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -195,14 +196,12 @@ class _VideoViewState extends State<VideoView> with ParticipantDelegate {
|
||||
|
||||
// register for change so Flutter will re-build the widget upon change
|
||||
void _onParticipantChanged() {
|
||||
var subscribedVideos = widget.participant.videoTracks.values.where((pub) {
|
||||
return pub.kind == TrackType.VIDEO &&
|
||||
!pub.isScreenShare &&
|
||||
pub.subscribed;
|
||||
final subscribedVideos = widget.participant.videoTracks.values.where((pub) {
|
||||
return pub.kind == TrackType.VIDEO && !pub.isScreenShare && pub.subscribed;
|
||||
});
|
||||
setState(() {
|
||||
if (subscribedVideos.isNotEmpty) {
|
||||
var videoPub = subscribedVideos.first;
|
||||
final videoPub = subscribedVideos.first;
|
||||
if (videoPub is RemoteTrackPublication) {
|
||||
videoPub.videoQuality = widget.quality;
|
||||
}
|
||||
@@ -212,13 +211,13 @@ class _VideoViewState extends State<VideoView> with ParticipantDelegate {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.videoPub = null;
|
||||
videoPub = null;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var videoPub = this.videoPub;
|
||||
final videoPub = this.videoPub;
|
||||
if (videoPub != null) {
|
||||
return VideoTrackRenderer(videoPub.track as VideoTrack);
|
||||
} else {
|
||||
|
||||
@@ -2,10 +2,15 @@ import 'package:flutter/material.dart';
|
||||
import 'package:livekit_client/livekit_client.dart';
|
||||
|
||||
class Controls extends StatefulWidget {
|
||||
//
|
||||
final Room room;
|
||||
final LocalParticipant participant;
|
||||
|
||||
Controls(this.room) : participant = room.localParticipant;
|
||||
Controls(
|
||||
this.room, {
|
||||
Key? key,
|
||||
}) : participant = room.localParticipant,
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -14,7 +19,7 @@ class Controls extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ControlsState extends State<Controls> {
|
||||
CameraPosition position = CameraPosition.FRONT;
|
||||
CameraPosition position = CameraPosition.front;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -30,48 +35,48 @@ class _ControlsState extends State<Controls> {
|
||||
|
||||
LocalParticipant get participant => widget.participant;
|
||||
|
||||
_onChange() {
|
||||
void _onChange() {
|
||||
// trigger refresh
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
_muteAudio() {
|
||||
void _muteAudio() {
|
||||
if (participant.hasAudio) {
|
||||
var audioPub = participant.audioTracks.values.first;
|
||||
final audioPub = participant.audioTracks.values.first;
|
||||
audioPub.muted = true;
|
||||
}
|
||||
}
|
||||
|
||||
_unmuteAudio() async {
|
||||
Future<void> _unmuteAudio() async {
|
||||
if (participant.hasAudio) {
|
||||
var audioPub = participant.audioTracks.values.first;
|
||||
final audioPub = participant.audioTracks.values.first;
|
||||
audioPub.muted = false;
|
||||
} else {
|
||||
// publish audio track
|
||||
var audioTrack = await LocalAudioTrack.createTrack();
|
||||
final audioTrack = await LocalAudioTrack.createTrack();
|
||||
await participant.publishAudioTrack(audioTrack);
|
||||
}
|
||||
}
|
||||
|
||||
_muteVideo() {
|
||||
void _muteVideo() {
|
||||
if (participant.hasVideo) {
|
||||
var videoPub = participant.videoTracks.values.first;
|
||||
final videoPub = participant.videoTracks.values.first;
|
||||
videoPub.muted = true;
|
||||
}
|
||||
}
|
||||
|
||||
_unmuteVideo() async {
|
||||
void _unmuteVideo() async {
|
||||
if (participant.hasVideo) {
|
||||
var videoPub = participant.videoTracks.values.first;
|
||||
final videoPub = participant.videoTracks.values.first;
|
||||
videoPub.muted = false;
|
||||
} else {
|
||||
// publish audio track
|
||||
var videoTrack = await LocalVideoTrack.createCameraTrack();
|
||||
final videoTrack = await LocalVideoTrack.createCameraTrack();
|
||||
await participant.publishVideoTrack(videoTrack);
|
||||
}
|
||||
}
|
||||
|
||||
_setCameraPosition(TrackPublication? pub, CameraPosition position) async {
|
||||
void _setCameraPosition(TrackPublication? pub, CameraPosition position) async {
|
||||
if (this.position == position) {
|
||||
return;
|
||||
}
|
||||
@@ -96,13 +101,13 @@ class _ControlsState extends State<Controls> {
|
||||
});
|
||||
}
|
||||
|
||||
_exit() {
|
||||
void _exit() {
|
||||
widget.room.disconnect();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var buttons = <Widget>[];
|
||||
final buttons = <Widget>[];
|
||||
|
||||
// mute audio
|
||||
if (participant.hasAudio && !participant.isMuted) {
|
||||
@@ -127,7 +132,7 @@ class _ControlsState extends State<Controls> {
|
||||
videoPub = participant.videoTracks.values.first;
|
||||
}
|
||||
|
||||
var videoEnabled = videoPub != null && !videoPub.muted;
|
||||
final videoEnabled = videoPub != null && !videoPub.muted;
|
||||
if (videoEnabled) {
|
||||
buttons.add(IconButton(
|
||||
onPressed: _muteVideo,
|
||||
@@ -140,12 +145,12 @@ class _ControlsState extends State<Controls> {
|
||||
));
|
||||
}
|
||||
|
||||
if (position == CameraPosition.FRONT) {
|
||||
if (position == CameraPosition.front) {
|
||||
buttons.add(IconButton(
|
||||
icon: const Icon(Icons.video_camera_front_rounded),
|
||||
onPressed: videoEnabled
|
||||
? () {
|
||||
_setCameraPosition(videoPub, CameraPosition.BACK);
|
||||
_setCameraPosition(videoPub, CameraPosition.back);
|
||||
}
|
||||
: null,
|
||||
));
|
||||
@@ -154,7 +159,7 @@ class _ControlsState extends State<Controls> {
|
||||
icon: const Icon(Icons.video_camera_back_rounded),
|
||||
onPressed: videoEnabled
|
||||
? () {
|
||||
_setCameraPosition(videoPub, CameraPosition.FRONT);
|
||||
_setCameraPosition(videoPub, CameraPosition.front);
|
||||
}
|
||||
: null,
|
||||
));
|
||||
|
||||
+21
-7
@@ -90,6 +90,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -116,6 +123,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
livekit_client:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -171,14 +185,14 @@ packages:
|
||||
name: path_provider_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.2"
|
||||
path_provider_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.2"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -192,7 +206,7 @@ packages:
|
||||
name: path_provider_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.0.3"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -206,7 +220,7 @@ packages:
|
||||
name: platform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.2"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -220,7 +234,7 @@ packages:
|
||||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.1"
|
||||
version: "4.2.3"
|
||||
protobuf:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -330,7 +344,7 @@ packages:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.5"
|
||||
version: "2.2.7"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -340,4 +354,4 @@ packages:
|
||||
version: "0.2.0"
|
||||
sdks:
|
||||
dart: ">=2.13.0 <3.0.0"
|
||||
flutter: ">=1.22.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
||||
@@ -19,6 +19,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.4
|
||||
|
||||
# The following section is specific to Flutter.
|
||||
flutter:
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'package:livekit_example/main.dart';
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(MyApp());
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
|
||||
@@ -6,9 +6,9 @@ import 'package:web_socket_channel/html.dart';
|
||||
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
|
||||
Future<WebSocketChannel> connectToWebSocket(Uri uri) {
|
||||
var ws = WebSocket(uri.toString());
|
||||
final ws = WebSocket(uri.toString());
|
||||
ws.binaryType = 'arraybuffer';
|
||||
var completer = Completer<WebSocketChannel>();
|
||||
final completer = Completer<WebSocketChannel>();
|
||||
ws.onOpen.first.then((_) {
|
||||
completer.complete(HtmlWebSocketChannel(ws));
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:web_socket_channel/web_socket_channel.dart';
|
||||
Future<WebSocketChannel> connectToWebSocket(Uri uri) async {
|
||||
try {
|
||||
// ignore: close_sinks
|
||||
var ws = await WebSocket.connect(uri.toString());
|
||||
final ws = await WebSocket.connect(uri.toString());
|
||||
return IOWebSocketChannel(ws);
|
||||
} catch (e) {
|
||||
return Future.error(e);
|
||||
|
||||
+1
-2
@@ -14,8 +14,7 @@ class ConnectError extends LiveKitError {
|
||||
}
|
||||
|
||||
class UnexpectedConnectionState extends LiveKitError {
|
||||
UnexpectedConnectionState([String msg = 'Unexpected connection state'])
|
||||
: super(msg);
|
||||
UnexpectedConnectionState([String msg = 'Unexpected connection state']) : super(msg);
|
||||
}
|
||||
|
||||
class TrackCreateError extends LiveKitError {
|
||||
|
||||
+22
-14
@@ -4,17 +4,16 @@ class RTCConfiguration {
|
||||
String? iceTransportPolicy;
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
var iceServersMap = [];
|
||||
iceServers?.forEach((element) {
|
||||
final iceServersMap = <Map<String, dynamic>>[];
|
||||
for (final element in (iceServers ?? <RTCIceServer>[])) {
|
||||
iceServersMap.add(element.toMap());
|
||||
});
|
||||
return {
|
||||
}
|
||||
return <String, dynamic>{
|
||||
// only supports unified plan
|
||||
'sdpSemantics': 'unified-plan',
|
||||
if (iceCandidatePoolSize != null)
|
||||
"iceCandidatePoolSize": iceCandidatePoolSize,
|
||||
"iceServers": iceServersMap,
|
||||
if (iceTransportPolicy != null) "iceTransportPolicy": iceTransportPolicy,
|
||||
if (iceCandidatePoolSize != null) 'iceCandidatePoolSize': iceCandidatePoolSize,
|
||||
'iceServers': iceServersMap,
|
||||
if (iceTransportPolicy != null) 'iceTransportPolicy': iceTransportPolicy,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -27,13 +26,22 @@ class RTCIceServer {
|
||||
RTCIceServer({required this.urls, this.username, this.credential});
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
"urls": urls,
|
||||
if (username != null) "username": username,
|
||||
if (credential != null) "credential": credential,
|
||||
return <String, dynamic>{
|
||||
'urls': urls,
|
||||
if (username != null) 'username': username,
|
||||
if (credential != null) 'credential': credential,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const RTCIceTransportPolicyAll = 'all';
|
||||
const RTCIceTransportPolicyRelay = 'relay';
|
||||
enum RTCIceTransportPolicy {
|
||||
all,
|
||||
relay,
|
||||
}
|
||||
|
||||
extension RTCIceTransportPolicyExt on RTCIceTransportPolicy {
|
||||
String toStringValue() => {
|
||||
RTCIceTransportPolicy.all: 'all',
|
||||
RTCIceTransportPolicy.relay: 'relay',
|
||||
}[this]!;
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@ import 'options.dart';
|
||||
/// {@category Room}
|
||||
class LiveKitClient {
|
||||
/// Connects to a LiveKit room
|
||||
static Future<Room> connect(String url, String token,
|
||||
[JoinOptions? options]) {
|
||||
var room = Room();
|
||||
static Future<Room> connect(String url, String token, [JoinOptions? options]) {
|
||||
final room = Room();
|
||||
return room.connect(url, token, options);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
import 'package:logging/logging.dart';
|
||||
|
||||
final logger = Logger("livekit");
|
||||
final logger = Logger('livekit');
|
||||
|
||||
@@ -13,7 +13,7 @@ import 'participant.dart';
|
||||
|
||||
/// Represents the current participant in the room.
|
||||
class LocalParticipant extends Participant {
|
||||
RTCEngine _engine;
|
||||
final RTCEngine _engine;
|
||||
|
||||
LocalParticipant({
|
||||
required RTCEngine engine,
|
||||
@@ -29,15 +29,14 @@ class LocalParticipant extends Participant {
|
||||
|
||||
/// publish an audio track to the room
|
||||
Future<TrackPublication> publishAudioTrack(LocalAudioTrack track) async {
|
||||
if (audioTracks.values.any(
|
||||
(element) => element.track?.mediaTrack.id == track.mediaTrack.id)) {
|
||||
if (audioTracks.values.any((element) => element.track?.mediaTrack.id == track.mediaTrack.id)) {
|
||||
return Future.error(TrackPublishError('track already exists'));
|
||||
}
|
||||
|
||||
try {
|
||||
var trackInfo = await _engine.addTrack(
|
||||
cid: track.getCid(), name: track.name, kind: track.kind);
|
||||
var transceiverInit = new RTCRtpTransceiverInit(
|
||||
final trackInfo =
|
||||
await _engine.addTrack(cid: track.getCid(), name: track.name, kind: track.kind);
|
||||
final transceiverInit = RTCRtpTransceiverInit(
|
||||
direction: TransceiverDirection.SendOnly,
|
||||
);
|
||||
// addTransceiver cannot pass in a kind parameter due to a bug in flutter-webrtc (web)
|
||||
@@ -46,7 +45,7 @@ class LocalParticipant extends Participant {
|
||||
init: transceiverInit,
|
||||
);
|
||||
|
||||
var pub = new LocalTrackPublication(trackInfo, track, this);
|
||||
final pub = LocalTrackPublication(trackInfo, track, this);
|
||||
addTrackPublication(pub);
|
||||
notifyListeners();
|
||||
|
||||
@@ -58,15 +57,14 @@ class LocalParticipant extends Participant {
|
||||
|
||||
/// Publish a video track to the room
|
||||
Future<TrackPublication> publishVideoTrack(LocalVideoTrack track) async {
|
||||
if (videoTracks.values.any(
|
||||
(element) => element.track?.mediaTrack.id == track.mediaTrack.id)) {
|
||||
if (videoTracks.values.any((element) => element.track?.mediaTrack.id == track.mediaTrack.id)) {
|
||||
return Future.error(TrackPublishError('track already exists'));
|
||||
}
|
||||
|
||||
try {
|
||||
var trackInfo = await _engine.addTrack(
|
||||
cid: track.getCid(), name: track.name, kind: track.kind);
|
||||
var transceiverInit = new RTCRtpTransceiverInit(
|
||||
final trackInfo =
|
||||
await _engine.addTrack(cid: track.getCid(), name: track.name, kind: track.kind);
|
||||
final transceiverInit = RTCRtpTransceiverInit(
|
||||
direction: TransceiverDirection.SendOnly,
|
||||
);
|
||||
// TODO: video encodings and simulcasts
|
||||
@@ -76,7 +74,7 @@ class LocalParticipant extends Participant {
|
||||
init: transceiverInit,
|
||||
);
|
||||
|
||||
var pub = new LocalTrackPublication(trackInfo, track, this);
|
||||
final pub = LocalTrackPublication(trackInfo, track, this);
|
||||
addTrackPublication(pub);
|
||||
notifyListeners();
|
||||
|
||||
@@ -87,15 +85,15 @@ class LocalParticipant extends Participant {
|
||||
}
|
||||
|
||||
/// Unpublish a track that's already published
|
||||
unpublishTrack(Track track) {
|
||||
var existing = tracks.values.where((element) => element.track == track);
|
||||
void unpublishTrack(Track track) {
|
||||
final existing = tracks.values.where((element) => element.track == track);
|
||||
if (existing.isEmpty) {
|
||||
return;
|
||||
}
|
||||
var pub = existing.first;
|
||||
final pub = existing.first;
|
||||
|
||||
track.stop();
|
||||
var sender = track.transceiver?.sender;
|
||||
final sender = track.transceiver?.sender;
|
||||
if (sender != null) {
|
||||
engine.publisher?.pc.removeTrack(sender);
|
||||
}
|
||||
@@ -108,13 +106,14 @@ class LocalParticipant extends Participant {
|
||||
case TrackType.VIDEO:
|
||||
videoTracks.remove(pub.sid);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Publish a new data payload to the room.
|
||||
/// @param destinationSids When empty, data will be forwarded to each participant in the room.
|
||||
publishData(List<int> data, DataPacket_Kind reliability,
|
||||
{List<String>? destinationSids}) {
|
||||
void publishData(List<int> data, DataPacket_Kind reliability, {List<String>? destinationSids}) {
|
||||
RTCDataChannel? channel;
|
||||
switch (reliability) {
|
||||
case DataPacket_Kind.RELIABLE:
|
||||
@@ -128,23 +127,23 @@ class LocalParticipant extends Participant {
|
||||
return;
|
||||
}
|
||||
|
||||
var packet = new DataPacket(
|
||||
final packet = DataPacket(
|
||||
kind: reliability,
|
||||
user: new UserPacket(
|
||||
user: UserPacket(
|
||||
payload: data,
|
||||
participantSid: sid,
|
||||
destinationSids: destinationSids,
|
||||
),
|
||||
);
|
||||
|
||||
var buffer = packet.writeToBuffer();
|
||||
final buffer = packet.writeToBuffer();
|
||||
channel.send(RTCDataChannelMessage.fromBinary(buffer));
|
||||
}
|
||||
|
||||
/// for internal use
|
||||
/// {@nodoc}
|
||||
@override
|
||||
updateFromInfo(ParticipantInfo info) {
|
||||
void updateFromInfo(ParticipantInfo info) {
|
||||
super.updateFromInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,29 +21,26 @@ mixin ParticipantDelegate {
|
||||
void onTrackUnmuted(Participant participant, TrackPublication publication) {}
|
||||
|
||||
/// This participant has published a new [Track] to the [Room].
|
||||
void onTrackPublished(
|
||||
RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
void onTrackPublished(RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
|
||||
/// This participant has unpublished one of their [Track].
|
||||
void onTrackUnpublished(
|
||||
RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
void onTrackUnpublished(RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
|
||||
/// The [LocalParticipant] has subscribed to a new track published by this
|
||||
/// [RemoteParticipant]
|
||||
void onTrackSubscribed(RemoteParticipant participant, Track track,
|
||||
RemoteTrackPublication publication) {}
|
||||
void onTrackSubscribed(
|
||||
RemoteParticipant participant, Track track, RemoteTrackPublication publication) {}
|
||||
|
||||
/// The [LocalParticipant] has unsubscribed from a track published by this
|
||||
/// [RemoteParticipant]. This event is fired when the track was unpublished
|
||||
void onTrackUnsubscribed(RemoteParticipant participant, Track track,
|
||||
RemoteTrackPublication publication) {}
|
||||
void onTrackUnsubscribed(
|
||||
RemoteParticipant participant, Track track, RemoteTrackPublication publication) {}
|
||||
|
||||
/// Data received from this [RemoteParticipant].
|
||||
void onDataReceived(RemoteParticipant participant, List<int> data) {}
|
||||
|
||||
/// An error has occured during track subscription.
|
||||
void onTrackSubscriptionFailed(
|
||||
RemoteParticipant participant, String sid, String? message) {}
|
||||
void onTrackSubscriptionFailed(RemoteParticipant participant, String sid, String? message) {}
|
||||
}
|
||||
|
||||
/// Represents a Participant in the room, notifies changes via delegates as
|
||||
@@ -85,10 +82,9 @@ class Participant extends ChangeNotifier {
|
||||
|
||||
/// when the participant joined the room
|
||||
DateTime get joinedAt {
|
||||
var pi = _participantInfo;
|
||||
final pi = _participantInfo;
|
||||
if (pi != null) {
|
||||
return DateTime.fromMillisecondsSinceEpoch(pi.joinedAt.toInt() * 1000,
|
||||
isUtc: true);
|
||||
return DateTime.fromMillisecondsSinceEpoch(pi.joinedAt.toInt() * 1000, isUtc: true);
|
||||
}
|
||||
return DateTime.now();
|
||||
}
|
||||
@@ -111,7 +107,7 @@ class Participant extends ChangeNotifier {
|
||||
/// tracks that are subscribed to
|
||||
List<TrackPublication> get subscribedTracks {
|
||||
List<TrackPublication> result = [];
|
||||
for (var track in tracks.values) {
|
||||
for (final track in tracks.values) {
|
||||
if (track.subscribed) {
|
||||
result.add(track);
|
||||
}
|
||||
@@ -140,9 +136,9 @@ class Participant extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
_setMetadata(String md) {
|
||||
var changed = this._participantInfo?.metadata != md;
|
||||
this.metadata = md;
|
||||
void _setMetadata(String md) {
|
||||
final changed = _participantInfo?.metadata != md;
|
||||
metadata = md;
|
||||
if (changed) {
|
||||
delegate?.onMetadataChanged(this);
|
||||
roomDelegate?.onMetadataChanged(this);
|
||||
@@ -152,24 +148,24 @@ class Participant extends ChangeNotifier {
|
||||
|
||||
/// for internal use
|
||||
/// {@nodoc}
|
||||
updateFromInfo(ParticipantInfo info) {
|
||||
this.identity = info.identity;
|
||||
this.sid = info.sid;
|
||||
void updateFromInfo(ParticipantInfo info) {
|
||||
identity = info.identity;
|
||||
sid = info.sid;
|
||||
if (info.metadata.isNotEmpty) {
|
||||
_setMetadata(info.metadata);
|
||||
}
|
||||
this._participantInfo = info;
|
||||
_participantInfo = info;
|
||||
}
|
||||
|
||||
/// for internal use
|
||||
/// {@nodoc}
|
||||
muteChanged() {
|
||||
void muteChanged() {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// for internal use
|
||||
/// {@nodoc}
|
||||
addTrackPublication(TrackPublication pub) {
|
||||
void addTrackPublication(TrackPublication pub) {
|
||||
pub.track?.sid = pub.sid;
|
||||
tracks[pub.sid] = pub;
|
||||
switch (pub.kind) {
|
||||
|
||||
@@ -9,20 +9,18 @@ import 'participant.dart';
|
||||
|
||||
/// Represents other participant in the [Room].
|
||||
class RemoteParticipant extends Participant {
|
||||
SignalClient _client;
|
||||
final SignalClient _client;
|
||||
|
||||
SignalClient get client => _client;
|
||||
|
||||
RemoteParticipant(this._client, String sid, String identity)
|
||||
: super(sid, identity);
|
||||
RemoteParticipant(this._client, String sid, String identity) : super(sid, identity);
|
||||
|
||||
RemoteParticipant.fromInfo(this._client, ParticipantInfo info)
|
||||
: super(info.sid, info.identity) {
|
||||
RemoteParticipant.fromInfo(this._client, ParticipantInfo info) : super(info.sid, info.identity) {
|
||||
updateFromInfo(info);
|
||||
}
|
||||
|
||||
RemoteTrackPublication? getTrackPublication(String sid) {
|
||||
var pub = tracks[sid];
|
||||
final pub = tracks[sid];
|
||||
if (pub is RemoteTrackPublication) {
|
||||
return pub;
|
||||
}
|
||||
@@ -30,10 +28,9 @@ class RemoteParticipant extends Participant {
|
||||
|
||||
/// for internal use
|
||||
/// {@nodoc}
|
||||
addSubscribedMediaTrack(
|
||||
MediaStreamTrack mediaTrack, MediaStream stream, String? sid) async {
|
||||
void addSubscribedMediaTrack(MediaStreamTrack mediaTrack, MediaStream stream, String? sid) async {
|
||||
if (sid == null) {
|
||||
var msg = 'addSubscribedMediaTrack received null sid';
|
||||
const msg = 'addSubscribedMediaTrack received null sid';
|
||||
delegate?.onTrackSubscriptionFailed(this, '', msg);
|
||||
roomDelegate?.onTrackSubscriptionFailed(this, '', msg);
|
||||
return;
|
||||
@@ -42,9 +39,9 @@ class RemoteParticipant extends Participant {
|
||||
var pub = getTrackPublication(sid);
|
||||
if (pub == null) {
|
||||
// we may have received the track prior to metadata. wait up to 3s
|
||||
pub = await _waitForTrackPublication(sid, Duration(seconds: 3));
|
||||
pub = await _waitForTrackPublication(sid, const Duration(seconds: 3));
|
||||
if (pub == null) {
|
||||
var msg = 'no track metadata found';
|
||||
const msg = 'no track metadata found';
|
||||
delegate?.onTrackSubscriptionFailed(this, sid, msg);
|
||||
roomDelegate?.onTrackSubscriptionFailed(this, sid, msg);
|
||||
return;
|
||||
@@ -53,13 +50,13 @@ class RemoteParticipant extends Participant {
|
||||
|
||||
Track? track;
|
||||
if (pub.kind == TrackType.AUDIO) {
|
||||
var audioTrack = new AudioTrack(pub.name, mediaTrack, stream);
|
||||
final audioTrack = AudioTrack(pub.name, mediaTrack, stream);
|
||||
audioTrack.start();
|
||||
track = audioTrack;
|
||||
} else if (pub.kind == TrackType.VIDEO) {
|
||||
track = new VideoTrack(pub.name, mediaTrack, stream);
|
||||
track = VideoTrack(pub.name, mediaTrack, stream);
|
||||
} else {
|
||||
var msg = 'unsupported track type ${pub.kind}';
|
||||
final msg = 'unsupported track type ${pub.kind}';
|
||||
delegate?.onTrackSubscriptionFailed(this, sid, msg);
|
||||
roomDelegate?.onTrackSubscriptionFailed(this, sid, msg);
|
||||
return;
|
||||
@@ -77,15 +74,15 @@ class RemoteParticipant extends Participant {
|
||||
/// {@nodoc}
|
||||
@override
|
||||
void updateFromInfo(ParticipantInfo info) {
|
||||
var hadInfo = hasInfo;
|
||||
final hadInfo = hasInfo;
|
||||
super.updateFromInfo(info);
|
||||
|
||||
// figuring out deltas between tracks
|
||||
var validPubs = Map<String, RemoteTrackPublication>();
|
||||
var newPubs = Map<String, RemoteTrackPublication>();
|
||||
final validPubs = <String, RemoteTrackPublication>{};
|
||||
final newPubs = <String, RemoteTrackPublication>{};
|
||||
|
||||
for (var info in info.tracks) {
|
||||
var sid = info.sid;
|
||||
for (final info in info.tracks) {
|
||||
final sid = info.sid;
|
||||
var pub = getTrackPublication(sid);
|
||||
|
||||
if (pub == null) {
|
||||
@@ -101,30 +98,30 @@ class RemoteParticipant extends Participant {
|
||||
|
||||
// notify listeners when it's not a new participant
|
||||
if (hadInfo) {
|
||||
for (var pub in newPubs.values) {
|
||||
for (final pub in newPubs.values) {
|
||||
delegate?.onTrackPublished(this, pub);
|
||||
roomDelegate?.onTrackPublished(this, pub);
|
||||
}
|
||||
}
|
||||
|
||||
// remove tracks
|
||||
for (var pub in tracks.values) {
|
||||
for (final pub in tracks.values) {
|
||||
if (!validPubs.containsKey(pub.sid)) {
|
||||
unpublishTrack(sid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unpublishTrack(String sid, [bool sendUnpublish = false]) {
|
||||
var pub = tracks.remove(sid);
|
||||
if (pub == null || !(pub is RemoteTrackPublication)) {
|
||||
void unpublishTrack(String sid, [bool sendUnpublish = false]) {
|
||||
final pub = tracks.remove(sid);
|
||||
if (pub == null || pub is! RemoteTrackPublication) {
|
||||
return;
|
||||
}
|
||||
|
||||
audioTracks.remove(sid);
|
||||
videoTracks.remove(sid);
|
||||
|
||||
var track = pub.track;
|
||||
final track = pub.track;
|
||||
if (track != null) {
|
||||
track.stop();
|
||||
delegate?.onTrackUnsubscribed(this, track, pub);
|
||||
@@ -137,12 +134,11 @@ class RemoteParticipant extends Participant {
|
||||
}
|
||||
}
|
||||
|
||||
Future<RemoteTrackPublication?> _waitForTrackPublication(
|
||||
String sid, Duration delay) async {
|
||||
var endTime = DateTime.now().add(delay);
|
||||
Future<RemoteTrackPublication?> _waitForTrackPublication(String sid, Duration delay) async {
|
||||
final endTime = DateTime.now().add(delay);
|
||||
while (DateTime.now().isBefore(endTime)) {
|
||||
var pub = await Future<RemoteTrackPublication?>.delayed(
|
||||
Duration(milliseconds: 100), () {
|
||||
final pub =
|
||||
await Future<RemoteTrackPublication?>.delayed(const Duration(milliseconds: 100), () {
|
||||
return getTrackPublication(sid);
|
||||
});
|
||||
if (pub != null) {
|
||||
|
||||
@@ -16,35 +16,27 @@ export 'livekit_models.pbenum.dart';
|
||||
|
||||
class Room extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'Room',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Room',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'sid')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'name')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sid')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..a<$core.int>(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'emptyTimeout',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'emptyTimeout',
|
||||
$pb.PbFieldType.OU3)
|
||||
..a<$core.int>(
|
||||
4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'maxParticipants', $pb.PbFieldType.OU3)
|
||||
4,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'maxParticipants',
|
||||
$pb.PbFieldType.OU3)
|
||||
..aInt64(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'creationTime')
|
||||
..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'turnPassword')
|
||||
..pc<Codec>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'enabledCodecs', $pb.PbFieldType.PM, subBuilder: Codec.create)
|
||||
..pc<Codec>(
|
||||
7,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'enabledCodecs',
|
||||
$pb.PbFieldType.PM,
|
||||
subBuilder: Codec.create)
|
||||
..hasRequiredFields = false;
|
||||
|
||||
Room._() : super();
|
||||
@@ -84,8 +76,7 @@ class Room extends $pb.GeneratedMessage {
|
||||
factory Room.fromBuffer($core.List<$core.int> i,
|
||||
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
create()..mergeFromBuffer(i, r);
|
||||
factory Room.fromJson($core.String i,
|
||||
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
factory Room.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
create()..mergeFromJson(i, r);
|
||||
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
@@ -103,8 +94,7 @@ class Room extends $pb.GeneratedMessage {
|
||||
Room createEmptyInstance() => create();
|
||||
static $pb.PbList<Room> createRepeated() => $pb.PbList<Room>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static Room getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Room>(create);
|
||||
static Room getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<Room>(create);
|
||||
static Room? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -185,24 +175,12 @@ class Room extends $pb.GeneratedMessage {
|
||||
|
||||
class Codec extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'Codec',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Codec',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'mime')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'fmtpLine')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'mime')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fmtpLine')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
Codec._() : super();
|
||||
@@ -222,8 +200,7 @@ class Codec extends $pb.GeneratedMessage {
|
||||
factory Codec.fromBuffer($core.List<$core.int> i,
|
||||
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
create()..mergeFromBuffer(i, r);
|
||||
factory Codec.fromJson($core.String i,
|
||||
[$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
factory Codec.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) =>
|
||||
create()..mergeFromJson(i, r);
|
||||
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
@@ -272,30 +249,23 @@ class Codec extends $pb.GeneratedMessage {
|
||||
|
||||
class ParticipantInfo extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'ParticipantInfo',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ParticipantInfo',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'sid')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'identity')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sid')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'identity')
|
||||
..e<ParticipantInfo_State>(
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'state', $pb.PbFieldType.OE,
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'state',
|
||||
$pb.PbFieldType.OE,
|
||||
defaultOrMaker: ParticipantInfo_State.JOINING,
|
||||
valueOf: ParticipantInfo_State.valueOf,
|
||||
enumValues: ParticipantInfo_State.values)
|
||||
..pc<TrackInfo>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'tracks', $pb.PbFieldType.PM,
|
||||
..pc<TrackInfo>(
|
||||
4,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'tracks',
|
||||
$pb.PbFieldType.PM,
|
||||
subBuilder: TrackInfo.create)
|
||||
..aOS(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'metadata')
|
||||
..aInt64(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'joinedAt')
|
||||
@@ -356,11 +326,10 @@ class ParticipantInfo extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ParticipantInfo create() => ParticipantInfo._();
|
||||
ParticipantInfo createEmptyInstance() => create();
|
||||
static $pb.PbList<ParticipantInfo> createRepeated() =>
|
||||
$pb.PbList<ParticipantInfo>();
|
||||
static $pb.PbList<ParticipantInfo> createRepeated() => $pb.PbList<ParticipantInfo>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ParticipantInfo getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<ParticipantInfo>(create);
|
||||
static ParticipantInfo getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ParticipantInfo>(create);
|
||||
static ParticipantInfo? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -441,33 +410,20 @@ class ParticipantInfo extends $pb.GeneratedMessage {
|
||||
|
||||
class TrackInfo extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'TrackInfo',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TrackInfo',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'sid')
|
||||
..e<TrackType>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'type',
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sid')
|
||||
..e<TrackType>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type',
|
||||
$pb.PbFieldType.OE,
|
||||
defaultOrMaker: TrackType.AUDIO,
|
||||
valueOf: TrackType.valueOf,
|
||||
enumValues: TrackType.values)
|
||||
..aOS(
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
defaultOrMaker: TrackType.AUDIO, valueOf: TrackType.valueOf, enumValues: TrackType.values)
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..aOB(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'muted')
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.OU3)
|
||||
..a<$core.int>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height', $pb.PbFieldType.OU3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width',
|
||||
$pb.PbFieldType.OU3)
|
||||
..a<$core.int>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height',
|
||||
$pb.PbFieldType.OU3)
|
||||
..aOB(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'simulcast')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
@@ -619,32 +575,21 @@ class TrackInfo extends $pb.GeneratedMessage {
|
||||
enum DataMessage_Value { text, binary, notSet }
|
||||
|
||||
class DataMessage extends $pb.GeneratedMessage {
|
||||
static const $core.Map<$core.int, DataMessage_Value> _DataMessage_ValueByTag =
|
||||
{
|
||||
static const $core.Map<$core.int, DataMessage_Value> _DataMessage_ValueByTag = {
|
||||
1: DataMessage_Value.text,
|
||||
2: DataMessage_Value.binary,
|
||||
0: DataMessage_Value.notSet
|
||||
};
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'DataMessage',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DataMessage',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..oo(0, [1, 2])
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'text')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'text')
|
||||
..a<$core.List<$core.int>>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'binary',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'binary',
|
||||
$pb.PbFieldType.OY)
|
||||
..hasRequiredFields = false;
|
||||
|
||||
@@ -684,8 +629,8 @@ class DataMessage extends $pb.GeneratedMessage {
|
||||
DataMessage createEmptyInstance() => create();
|
||||
static $pb.PbList<DataMessage> createRepeated() => $pb.PbList<DataMessage>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static DataMessage getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<DataMessage>(create);
|
||||
static DataMessage getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DataMessage>(create);
|
||||
static DataMessage? _defaultInstance;
|
||||
|
||||
DataMessage_Value whichValue() => _DataMessage_ValueByTag[$_whichOneof(0)]!;
|
||||
@@ -718,30 +663,20 @@ class DataMessage extends $pb.GeneratedMessage {
|
||||
|
||||
class RecordingInput extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'RecordingInput',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RecordingInput',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'url')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'url')
|
||||
..aOM<RecordingTemplate>(
|
||||
2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'template',
|
||||
subBuilder: RecordingTemplate.create)
|
||||
..a<$core.int>(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'width',
|
||||
..a<$core.int>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width',
|
||||
$pb.PbFieldType.O3)
|
||||
..a<$core.int>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height',
|
||||
$pb.PbFieldType.O3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'depth',
|
||||
$pb.PbFieldType.O3)
|
||||
..a<$core.int>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height', $pb.PbFieldType.O3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'depth', $pb.PbFieldType.O3)
|
||||
..a<$core.int>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'framerate', $pb.PbFieldType.O3)
|
||||
..hasRequiredFields = false;
|
||||
|
||||
@@ -795,11 +730,10 @@ class RecordingInput extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingInput create() => RecordingInput._();
|
||||
RecordingInput createEmptyInstance() => create();
|
||||
static $pb.PbList<RecordingInput> createRepeated() =>
|
||||
$pb.PbList<RecordingInput>();
|
||||
static $pb.PbList<RecordingInput> createRepeated() => $pb.PbList<RecordingInput>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingInput getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<RecordingInput>(create);
|
||||
static RecordingInput getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RecordingInput>(create);
|
||||
static RecordingInput? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -879,31 +813,14 @@ class RecordingInput extends $pb.GeneratedMessage {
|
||||
|
||||
class RecordingTemplate extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'RecordingTemplate',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RecordingTemplate',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'type')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'wsUrl')
|
||||
..aOS(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'token')
|
||||
..aOS(4,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'roomName')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'wsUrl')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'token')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'roomName')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
RecordingTemplate._() : super();
|
||||
@@ -948,11 +865,10 @@ class RecordingTemplate extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingTemplate create() => RecordingTemplate._();
|
||||
RecordingTemplate createEmptyInstance() => create();
|
||||
static $pb.PbList<RecordingTemplate> createRepeated() =>
|
||||
$pb.PbList<RecordingTemplate>();
|
||||
static $pb.PbList<RecordingTemplate> createRepeated() => $pb.PbList<RecordingTemplate>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingTemplate getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<RecordingTemplate>(create);
|
||||
static RecordingTemplate getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RecordingTemplate>(create);
|
||||
static RecordingTemplate? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1006,31 +922,19 @@ class RecordingTemplate extends $pb.GeneratedMessage {
|
||||
|
||||
class RecordingOutput extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'RecordingOutput',
|
||||
package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RecordingOutput',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'file')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'rtmp')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'file')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rtmp')
|
||||
..aOM<RecordingS3Output>(
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 's3',
|
||||
subBuilder: RecordingS3Output.create)
|
||||
..a<$core.int>(
|
||||
4,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width',
|
||||
..a<$core.int>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width',
|
||||
$pb.PbFieldType.O3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height',
|
||||
$pb.PbFieldType.O3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height', $pb.PbFieldType.O3)
|
||||
..aOS(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'audioBitrate')
|
||||
..aOS(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'audioFrequency')
|
||||
..aOS(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'videoBitrate')
|
||||
@@ -1099,11 +1003,10 @@ class RecordingOutput extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingOutput create() => RecordingOutput._();
|
||||
RecordingOutput createEmptyInstance() => create();
|
||||
static $pb.PbList<RecordingOutput> createRepeated() =>
|
||||
$pb.PbList<RecordingOutput>();
|
||||
static $pb.PbList<RecordingOutput> createRepeated() => $pb.PbList<RecordingOutput>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingOutput getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<RecordingOutput>(create);
|
||||
static RecordingOutput getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RecordingOutput>(create);
|
||||
static RecordingOutput? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1219,31 +1122,14 @@ class RecordingOutput extends $pb.GeneratedMessage {
|
||||
|
||||
class RecordingS3Output extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'RecordingS3Output',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RecordingS3Output',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'bucket')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'key')
|
||||
..aOS(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'accessKey')
|
||||
..aOS(4,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'secret')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'bucket')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'key')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'accessKey')
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'secret')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
RecordingS3Output._() : super();
|
||||
@@ -1288,11 +1174,10 @@ class RecordingS3Output extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingS3Output create() => RecordingS3Output._();
|
||||
RecordingS3Output createEmptyInstance() => create();
|
||||
static $pb.PbList<RecordingS3Output> createRepeated() =>
|
||||
$pb.PbList<RecordingS3Output>();
|
||||
static $pb.PbList<RecordingS3Output> createRepeated() => $pb.PbList<RecordingS3Output>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static RecordingS3Output getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<RecordingS3Output>(create);
|
||||
static RecordingS3Output getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RecordingS3Output>(create);
|
||||
static RecordingS3Output? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
|
||||
@@ -10,21 +10,12 @@ import 'dart:core' as $core;
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class TrackType extends $pb.ProtobufEnum {
|
||||
static const TrackType AUDIO = TrackType._(
|
||||
0,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'AUDIO');
|
||||
static const TrackType VIDEO = TrackType._(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'VIDEO');
|
||||
static const TrackType DATA = TrackType._(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'DATA');
|
||||
static const TrackType AUDIO =
|
||||
TrackType._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'AUDIO');
|
||||
static const TrackType VIDEO =
|
||||
TrackType._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'VIDEO');
|
||||
static const TrackType DATA =
|
||||
TrackType._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DATA');
|
||||
|
||||
static const $core.List<TrackType> values = <TrackType>[
|
||||
AUDIO,
|
||||
@@ -32,8 +23,7 @@ class TrackType extends $pb.ProtobufEnum {
|
||||
DATA,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, TrackType> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, TrackType> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static TrackType? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const TrackType._($core.int v, $core.String n) : super(v, n);
|
||||
@@ -41,28 +31,15 @@ class TrackType extends $pb.ProtobufEnum {
|
||||
|
||||
class ParticipantInfo_State extends $pb.ProtobufEnum {
|
||||
static const ParticipantInfo_State JOINING = ParticipantInfo_State._(
|
||||
0,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'JOINING');
|
||||
0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'JOINING');
|
||||
static const ParticipantInfo_State JOINED = ParticipantInfo_State._(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'JOINED');
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'JOINED');
|
||||
static const ParticipantInfo_State ACTIVE = ParticipantInfo_State._(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'ACTIVE');
|
||||
2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ACTIVE');
|
||||
static const ParticipantInfo_State DISCONNECTED = ParticipantInfo_State._(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'DISCONNECTED');
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DISCONNECTED');
|
||||
|
||||
static const $core.List<ParticipantInfo_State> values =
|
||||
<ParticipantInfo_State>[
|
||||
static const $core.List<ParticipantInfo_State> values = <ParticipantInfo_State>[
|
||||
JOINING,
|
||||
JOINED,
|
||||
ACTIVE,
|
||||
|
||||
@@ -20,8 +20,8 @@ const TrackType$json = const {
|
||||
};
|
||||
|
||||
/// Descriptor for `TrackType`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List trackTypeDescriptor = $convert.base64Decode(
|
||||
'CglUcmFja1R5cGUSCQoFQVVESU8QABIJCgVWSURFTxABEggKBERBVEEQAg==');
|
||||
final $typed_data.Uint8List trackTypeDescriptor =
|
||||
$convert.base64Decode('CglUcmFja1R5cGUSCQoFQVVESU8QABIJCgVWSURFTxABEggKBERBVEEQAg==');
|
||||
@$core.Deprecated('Use roomDescriptor instead')
|
||||
const Room$json = const {
|
||||
'1': 'Room',
|
||||
@@ -29,13 +29,7 @@ const Room$json = const {
|
||||
const {'1': 'sid', '3': 1, '4': 1, '5': 9, '10': 'sid'},
|
||||
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
|
||||
const {'1': 'empty_timeout', '3': 3, '4': 1, '5': 13, '10': 'emptyTimeout'},
|
||||
const {
|
||||
'1': 'max_participants',
|
||||
'3': 4,
|
||||
'4': 1,
|
||||
'5': 13,
|
||||
'10': 'maxParticipants'
|
||||
},
|
||||
const {'1': 'max_participants', '3': 4, '4': 1, '5': 13, '10': 'maxParticipants'},
|
||||
const {'1': 'creation_time', '3': 5, '4': 1, '5': 3, '10': 'creationTime'},
|
||||
const {'1': 'turn_password', '3': 6, '4': 1, '5': 9, '10': 'turnPassword'},
|
||||
const {
|
||||
@@ -62,8 +56,8 @@ const Codec$json = const {
|
||||
};
|
||||
|
||||
/// Descriptor for `Codec`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List codecDescriptor = $convert.base64Decode(
|
||||
'CgVDb2RlYxISCgRtaW1lGAEgASgJUgRtaW1lEhsKCWZtdHBfbGluZRgCIAEoCVIIZm10cExpbmU=');
|
||||
final $typed_data.Uint8List codecDescriptor = $convert
|
||||
.base64Decode('CgVDb2RlYxISCgRtaW1lGAEgASgJUgRtaW1lEhsKCWZtdHBfbGluZRgCIAEoCVIIZm10cExpbmU=');
|
||||
@$core.Deprecated('Use participantInfoDescriptor instead')
|
||||
const ParticipantInfo$json = const {
|
||||
'1': 'ParticipantInfo',
|
||||
@@ -78,14 +72,7 @@ const ParticipantInfo$json = const {
|
||||
'6': '.livekit.ParticipantInfo.State',
|
||||
'10': 'state'
|
||||
},
|
||||
const {
|
||||
'1': 'tracks',
|
||||
'3': 4,
|
||||
'4': 3,
|
||||
'5': 11,
|
||||
'6': '.livekit.TrackInfo',
|
||||
'10': 'tracks'
|
||||
},
|
||||
const {'1': 'tracks', '3': 4, '4': 3, '5': 11, '6': '.livekit.TrackInfo', '10': 'tracks'},
|
||||
const {'1': 'metadata', '3': 5, '4': 1, '5': 9, '10': 'metadata'},
|
||||
const {'1': 'joined_at', '3': 6, '4': 1, '5': 3, '10': 'joinedAt'},
|
||||
const {'1': 'hidden', '3': 7, '4': 1, '5': 8, '10': 'hidden'},
|
||||
@@ -112,14 +99,7 @@ const TrackInfo$json = const {
|
||||
'1': 'TrackInfo',
|
||||
'2': const [
|
||||
const {'1': 'sid', '3': 1, '4': 1, '5': 9, '10': 'sid'},
|
||||
const {
|
||||
'1': 'type',
|
||||
'3': 2,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.livekit.TrackType',
|
||||
'10': 'type'
|
||||
},
|
||||
const {'1': 'type', '3': 2, '4': 1, '5': 14, '6': '.livekit.TrackType', '10': 'type'},
|
||||
const {'1': 'name', '3': 3, '4': 1, '5': 9, '10': 'name'},
|
||||
const {'1': 'muted', '3': 4, '4': 1, '5': 8, '10': 'muted'},
|
||||
const {'1': 'width', '3': 5, '4': 1, '5': 13, '10': 'width'},
|
||||
@@ -189,24 +169,11 @@ const RecordingOutput$json = const {
|
||||
'2': const [
|
||||
const {'1': 'file', '3': 1, '4': 1, '5': 9, '10': 'file'},
|
||||
const {'1': 'rtmp', '3': 2, '4': 1, '5': 9, '10': 'rtmp'},
|
||||
const {
|
||||
'1': 's3',
|
||||
'3': 3,
|
||||
'4': 1,
|
||||
'5': 11,
|
||||
'6': '.livekit.RecordingS3Output',
|
||||
'10': 's3'
|
||||
},
|
||||
const {'1': 's3', '3': 3, '4': 1, '5': 11, '6': '.livekit.RecordingS3Output', '10': 's3'},
|
||||
const {'1': 'width', '3': 4, '4': 1, '5': 5, '10': 'width'},
|
||||
const {'1': 'height', '3': 5, '4': 1, '5': 5, '10': 'height'},
|
||||
const {'1': 'audio_bitrate', '3': 6, '4': 1, '5': 9, '10': 'audioBitrate'},
|
||||
const {
|
||||
'1': 'audio_frequency',
|
||||
'3': 7,
|
||||
'4': 1,
|
||||
'5': 9,
|
||||
'10': 'audioFrequency'
|
||||
},
|
||||
const {'1': 'audio_frequency', '3': 7, '4': 1, '5': 9, '10': 'audioFrequency'},
|
||||
const {'1': 'video_bitrate', '3': 8, '4': 1, '5': 9, '10': 'videoBitrate'},
|
||||
const {'1': 'video_buffer', '3': 9, '4': 1, '5': 9, '10': 'videoBuffer'},
|
||||
],
|
||||
|
||||
+144
-321
@@ -30,8 +30,7 @@ enum SignalRequest_Message {
|
||||
}
|
||||
|
||||
class SignalRequest extends $pb.GeneratedMessage {
|
||||
static const $core.Map<$core.int, SignalRequest_Message>
|
||||
_SignalRequest_MessageByTag = {
|
||||
static const $core.Map<$core.int, SignalRequest_Message> _SignalRequest_MessageByTag = {
|
||||
1: SignalRequest_Message.offer,
|
||||
2: SignalRequest_Message.answer,
|
||||
3: SignalRequest_Message.trickle,
|
||||
@@ -43,26 +42,24 @@ class SignalRequest extends $pb.GeneratedMessage {
|
||||
9: SignalRequest_Message.simulcast,
|
||||
0: SignalRequest_Message.notSet
|
||||
};
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignalRequest',
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignalRequest',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..oo(0, [1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
..aOM<SessionDescription>(
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'offer',
|
||||
..aOM<SessionDescription>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'offer',
|
||||
subBuilder: SessionDescription.create)
|
||||
..aOM<SessionDescription>(
|
||||
2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'answer',
|
||||
subBuilder: SessionDescription.create)
|
||||
..aOM<TrickleRequest>(
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trickle',
|
||||
..aOM<TrickleRequest>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trickle',
|
||||
subBuilder: TrickleRequest.create)
|
||||
..aOM<AddTrackRequest>(
|
||||
4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'addTrack',
|
||||
subBuilder: AddTrackRequest.create)
|
||||
..aOM<MuteTrackRequest>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'mute', subBuilder: MuteTrackRequest.create)
|
||||
..aOM<MuteTrackRequest>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'mute',
|
||||
subBuilder: MuteTrackRequest.create)
|
||||
..aOM<UpdateSubscription>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subscription', subBuilder: UpdateSubscription.create)
|
||||
..aOM<UpdateTrackSettings>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trackSetting', subBuilder: UpdateTrackSettings.create)
|
||||
..aOM<LeaveRequest>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'leave', subBuilder: LeaveRequest.create)
|
||||
@@ -131,15 +128,13 @@ class SignalRequest extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SignalRequest create() => SignalRequest._();
|
||||
SignalRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<SignalRequest> createRepeated() =>
|
||||
$pb.PbList<SignalRequest>();
|
||||
static $pb.PbList<SignalRequest> createRepeated() => $pb.PbList<SignalRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SignalRequest getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<SignalRequest>(create);
|
||||
static SignalRequest getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignalRequest>(create);
|
||||
static SignalRequest? _defaultInstance;
|
||||
|
||||
SignalRequest_Message whichMessage() =>
|
||||
_SignalRequest_MessageByTag[$_whichOneof(0)]!;
|
||||
SignalRequest_Message whichMessage() => _SignalRequest_MessageByTag[$_whichOneof(0)]!;
|
||||
void clearMessage() => clearField($_whichOneof(0));
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -282,8 +277,7 @@ enum SignalResponse_Message {
|
||||
}
|
||||
|
||||
class SignalResponse extends $pb.GeneratedMessage {
|
||||
static const $core.Map<$core.int, SignalResponse_Message>
|
||||
_SignalResponse_MessageByTag = {
|
||||
static const $core.Map<$core.int, SignalResponse_Message> _SignalResponse_MessageByTag = {
|
||||
1: SignalResponse_Message.join,
|
||||
2: SignalResponse_Message.answer,
|
||||
3: SignalResponse_Message.offer,
|
||||
@@ -294,26 +288,24 @@ class SignalResponse extends $pb.GeneratedMessage {
|
||||
8: SignalResponse_Message.leave,
|
||||
0: SignalResponse_Message.notSet
|
||||
};
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignalResponse',
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SignalResponse',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..oo(0, [1, 2, 3, 4, 5, 6, 7, 8])
|
||||
..aOM<JoinResponse>(
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'join',
|
||||
..aOM<JoinResponse>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'join',
|
||||
subBuilder: JoinResponse.create)
|
||||
..aOM<SessionDescription>(
|
||||
2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'answer',
|
||||
subBuilder: SessionDescription.create)
|
||||
..aOM<SessionDescription>(
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'offer',
|
||||
..aOM<SessionDescription>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'offer',
|
||||
subBuilder: SessionDescription.create)
|
||||
..aOM<TrickleRequest>(
|
||||
4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trickle',
|
||||
..aOM<TrickleRequest>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trickle',
|
||||
subBuilder: TrickleRequest.create)
|
||||
..aOM<ParticipantUpdate>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'update', subBuilder: ParticipantUpdate.create)
|
||||
..aOM<ParticipantUpdate>(
|
||||
5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'update',
|
||||
subBuilder: ParticipantUpdate.create)
|
||||
..aOM<TrackPublishedResponse>(6, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trackPublished', subBuilder: TrackPublishedResponse.create)
|
||||
..aOM<ActiveSpeakerUpdate>(7, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'speaker', subBuilder: ActiveSpeakerUpdate.create)
|
||||
..aOM<LeaveRequest>(8, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'leave', subBuilder: LeaveRequest.create)
|
||||
@@ -377,15 +369,13 @@ class SignalResponse extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SignalResponse create() => SignalResponse._();
|
||||
SignalResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<SignalResponse> createRepeated() =>
|
||||
$pb.PbList<SignalResponse>();
|
||||
static $pb.PbList<SignalResponse> createRepeated() => $pb.PbList<SignalResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SignalResponse getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<SignalResponse>(create);
|
||||
static SignalResponse getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SignalResponse>(create);
|
||||
static SignalResponse? _defaultInstance;
|
||||
|
||||
SignalResponse_Message whichMessage() =>
|
||||
_SignalResponse_MessageByTag[$_whichOneof(0)]!;
|
||||
SignalResponse_Message whichMessage() => _SignalResponse_MessageByTag[$_whichOneof(0)]!;
|
||||
void clearMessage() => clearField($_whichOneof(0));
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -503,35 +493,23 @@ class SignalResponse extends $pb.GeneratedMessage {
|
||||
|
||||
class AddTrackRequest extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'AddTrackRequest',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddTrackRequest',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'cid')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'name')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cid')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name')
|
||||
..e<$0.TrackType>(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'type',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type',
|
||||
$pb.PbFieldType.OE,
|
||||
defaultOrMaker: $0.TrackType.AUDIO,
|
||||
valueOf: $0.TrackType.valueOf,
|
||||
enumValues: $0.TrackType.values)
|
||||
..a<$core.int>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width', $pb.PbFieldType.OU3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height', $pb.PbFieldType.OU3)
|
||||
..a<$core.int>(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'width',
|
||||
$pb.PbFieldType.OU3)
|
||||
..a<$core.int>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height',
|
||||
$pb.PbFieldType.OU3)
|
||||
..hasRequiredFields = false;
|
||||
|
||||
AddTrackRequest._() : super();
|
||||
@@ -580,11 +558,10 @@ class AddTrackRequest extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static AddTrackRequest create() => AddTrackRequest._();
|
||||
AddTrackRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<AddTrackRequest> createRepeated() =>
|
||||
$pb.PbList<AddTrackRequest>();
|
||||
static $pb.PbList<AddTrackRequest> createRepeated() => $pb.PbList<AddTrackRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static AddTrackRequest getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<AddTrackRequest>(create);
|
||||
static AddTrackRequest getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<AddTrackRequest>(create);
|
||||
static AddTrackRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -650,22 +627,15 @@ class AddTrackRequest extends $pb.GeneratedMessage {
|
||||
|
||||
class TrickleRequest extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'TrickleRequest',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TrickleRequest',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'candidateInit',
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'candidateInit',
|
||||
protoName: 'candidateInit')
|
||||
..e<SignalTarget>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'target',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'target',
|
||||
$pb.PbFieldType.OE,
|
||||
defaultOrMaker: SignalTarget.PUBLISHER,
|
||||
valueOf: SignalTarget.valueOf,
|
||||
@@ -706,11 +676,10 @@ class TrickleRequest extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static TrickleRequest create() => TrickleRequest._();
|
||||
TrickleRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<TrickleRequest> createRepeated() =>
|
||||
$pb.PbList<TrickleRequest>();
|
||||
static $pb.PbList<TrickleRequest> createRepeated() => $pb.PbList<TrickleRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static TrickleRequest getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<TrickleRequest>(create);
|
||||
static TrickleRequest getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<TrickleRequest>(create);
|
||||
static TrickleRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -740,24 +709,12 @@ class TrickleRequest extends $pb.GeneratedMessage {
|
||||
|
||||
class MuteTrackRequest extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'MuteTrackRequest',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'MuteTrackRequest',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'sid')
|
||||
..aOB(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'muted')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sid')
|
||||
..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'muted')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
MuteTrackRequest._() : super();
|
||||
@@ -794,11 +751,10 @@ class MuteTrackRequest extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static MuteTrackRequest create() => MuteTrackRequest._();
|
||||
MuteTrackRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<MuteTrackRequest> createRepeated() =>
|
||||
$pb.PbList<MuteTrackRequest>();
|
||||
static $pb.PbList<MuteTrackRequest> createRepeated() => $pb.PbList<MuteTrackRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static MuteTrackRequest getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<MuteTrackRequest>(create);
|
||||
static MuteTrackRequest getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<MuteTrackRequest>(create);
|
||||
static MuteTrackRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -828,24 +784,14 @@ class MuteTrackRequest extends $pb.GeneratedMessage {
|
||||
|
||||
class SetSimulcastLayers extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'SetSimulcastLayers',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SetSimulcastLayers',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'trackSid')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trackSid')
|
||||
..pc<VideoQuality>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'layers',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'layers',
|
||||
$pb.PbFieldType.PE,
|
||||
valueOf: VideoQuality.valueOf,
|
||||
enumValues: VideoQuality.values)
|
||||
@@ -885,11 +831,10 @@ class SetSimulcastLayers extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SetSimulcastLayers create() => SetSimulcastLayers._();
|
||||
SetSimulcastLayers createEmptyInstance() => create();
|
||||
static $pb.PbList<SetSimulcastLayers> createRepeated() =>
|
||||
$pb.PbList<SetSimulcastLayers>();
|
||||
static $pb.PbList<SetSimulcastLayers> createRepeated() => $pb.PbList<SetSimulcastLayers>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SetSimulcastLayers getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<SetSimulcastLayers>(create);
|
||||
static SetSimulcastLayers getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SetSimulcastLayers>(create);
|
||||
static SetSimulcastLayers? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -909,11 +854,10 @@ class SetSimulcastLayers extends $pb.GeneratedMessage {
|
||||
}
|
||||
|
||||
class JoinResponse extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'JoinResponse',
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'JoinResponse',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOM<$0.Room>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'room',
|
||||
subBuilder: $0.Room.create)
|
||||
@@ -922,13 +866,13 @@ class JoinResponse extends $pb.GeneratedMessage {
|
||||
subBuilder: $0.ParticipantInfo.create)
|
||||
..pc<$0.ParticipantInfo>(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'otherParticipants',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'otherParticipants',
|
||||
$pb.PbFieldType.PM,
|
||||
subBuilder: $0.ParticipantInfo.create)
|
||||
..aOS(4, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'serverVersion')
|
||||
..pc<ICEServer>(5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'iceServers', $pb.PbFieldType.PM, subBuilder: ICEServer.create)
|
||||
..pc<ICEServer>(
|
||||
5, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'iceServers', $pb.PbFieldType.PM,
|
||||
subBuilder: ICEServer.create)
|
||||
..hasRequiredFields = false;
|
||||
|
||||
JoinResponse._() : super();
|
||||
@@ -977,11 +921,10 @@ class JoinResponse extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static JoinResponse create() => JoinResponse._();
|
||||
JoinResponse createEmptyInstance() => create();
|
||||
static $pb.PbList<JoinResponse> createRepeated() =>
|
||||
$pb.PbList<JoinResponse>();
|
||||
static $pb.PbList<JoinResponse> createRepeated() => $pb.PbList<JoinResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static JoinResponse getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<JoinResponse>(create);
|
||||
static JoinResponse getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<JoinResponse>(create);
|
||||
static JoinResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1037,20 +980,11 @@ class TrackPublishedResponse extends $pb.GeneratedMessage {
|
||||
? ''
|
||||
: 'TrackPublishedResponse',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'cid')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'cid')
|
||||
..aOM<$0.TrackInfo>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'track',
|
||||
2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'track',
|
||||
subBuilder: $0.TrackInfo.create)
|
||||
..hasRequiredFields = false;
|
||||
|
||||
@@ -1077,13 +1011,11 @@ class TrackPublishedResponse extends $pb.GeneratedMessage {
|
||||
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
|
||||
'Will be removed in next major version')
|
||||
TrackPublishedResponse clone() =>
|
||||
TrackPublishedResponse()..mergeFromMessage(this);
|
||||
TrackPublishedResponse clone() => TrackPublishedResponse()..mergeFromMessage(this);
|
||||
@$core.Deprecated('Using this can add significant overhead to your binary. '
|
||||
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
|
||||
'Will be removed in next major version')
|
||||
TrackPublishedResponse copyWith(
|
||||
void Function(TrackPublishedResponse) updates) =>
|
||||
TrackPublishedResponse copyWith(void Function(TrackPublishedResponse) updates) =>
|
||||
super.copyWith((message) => updates(message as TrackPublishedResponse))
|
||||
as TrackPublishedResponse; // ignore: deprecated_member_use
|
||||
$pb.BuilderInfo get info_ => _i;
|
||||
@@ -1093,8 +1025,8 @@ class TrackPublishedResponse extends $pb.GeneratedMessage {
|
||||
static $pb.PbList<TrackPublishedResponse> createRepeated() =>
|
||||
$pb.PbList<TrackPublishedResponse>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static TrackPublishedResponse getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<TrackPublishedResponse>(create);
|
||||
static TrackPublishedResponse getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<TrackPublishedResponse>(create);
|
||||
static TrackPublishedResponse? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1126,24 +1058,12 @@ class TrackPublishedResponse extends $pb.GeneratedMessage {
|
||||
|
||||
class SessionDescription extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'SessionDescription',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SessionDescription',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'type')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'sdp')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'type')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sdp')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
SessionDescription._() : super();
|
||||
@@ -1180,11 +1100,10 @@ class SessionDescription extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SessionDescription create() => SessionDescription._();
|
||||
SessionDescription createEmptyInstance() => create();
|
||||
static $pb.PbList<SessionDescription> createRepeated() =>
|
||||
$pb.PbList<SessionDescription>();
|
||||
static $pb.PbList<SessionDescription> createRepeated() => $pb.PbList<SessionDescription>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SessionDescription getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<SessionDescription>(create);
|
||||
static SessionDescription getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SessionDescription>(create);
|
||||
static SessionDescription? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1214,19 +1133,13 @@ class SessionDescription extends $pb.GeneratedMessage {
|
||||
|
||||
class ParticipantUpdate extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'ParticipantUpdate',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ParticipantUpdate',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..pc<$0.ParticipantInfo>(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'participants',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'participants',
|
||||
$pb.PbFieldType.PM,
|
||||
subBuilder: $0.ParticipantInfo.create)
|
||||
..hasRequiredFields = false;
|
||||
@@ -1261,11 +1174,10 @@ class ParticipantUpdate extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ParticipantUpdate create() => ParticipantUpdate._();
|
||||
ParticipantUpdate createEmptyInstance() => create();
|
||||
static $pb.PbList<ParticipantUpdate> createRepeated() =>
|
||||
$pb.PbList<ParticipantUpdate>();
|
||||
static $pb.PbList<ParticipantUpdate> createRepeated() => $pb.PbList<ParticipantUpdate>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ParticipantUpdate getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<ParticipantUpdate>(create);
|
||||
static ParticipantUpdate getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ParticipantUpdate>(create);
|
||||
static ParticipantUpdate? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1274,19 +1186,13 @@ class ParticipantUpdate extends $pb.GeneratedMessage {
|
||||
|
||||
class ActiveSpeakerUpdate extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'ActiveSpeakerUpdate',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ActiveSpeakerUpdate',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..pc<SpeakerInfo>(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'speakers',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'speakers',
|
||||
$pb.PbFieldType.PM,
|
||||
subBuilder: SpeakerInfo.create)
|
||||
..hasRequiredFields = false;
|
||||
@@ -1321,11 +1227,10 @@ class ActiveSpeakerUpdate extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ActiveSpeakerUpdate create() => ActiveSpeakerUpdate._();
|
||||
ActiveSpeakerUpdate createEmptyInstance() => create();
|
||||
static $pb.PbList<ActiveSpeakerUpdate> createRepeated() =>
|
||||
$pb.PbList<ActiveSpeakerUpdate>();
|
||||
static $pb.PbList<ActiveSpeakerUpdate> createRepeated() => $pb.PbList<ActiveSpeakerUpdate>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static ActiveSpeakerUpdate getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<ActiveSpeakerUpdate>(create);
|
||||
static ActiveSpeakerUpdate getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<ActiveSpeakerUpdate>(create);
|
||||
static ActiveSpeakerUpdate? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1334,30 +1239,16 @@ class ActiveSpeakerUpdate extends $pb.GeneratedMessage {
|
||||
|
||||
class SpeakerInfo extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'SpeakerInfo',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'SpeakerInfo',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'sid')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'sid')
|
||||
..a<$core.double>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'level',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'level',
|
||||
$pb.PbFieldType.OF)
|
||||
..aOB(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'active')
|
||||
..aOB(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'active')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
SpeakerInfo._() : super();
|
||||
@@ -1400,8 +1291,8 @@ class SpeakerInfo extends $pb.GeneratedMessage {
|
||||
SpeakerInfo createEmptyInstance() => create();
|
||||
static $pb.PbList<SpeakerInfo> createRepeated() => $pb.PbList<SpeakerInfo>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static SpeakerInfo getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<SpeakerInfo>(create);
|
||||
static SpeakerInfo getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<SpeakerInfo>(create);
|
||||
static SpeakerInfo? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1443,24 +1334,12 @@ class SpeakerInfo extends $pb.GeneratedMessage {
|
||||
|
||||
class UpdateSubscription extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'UpdateSubscription',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateSubscription',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..pPS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'trackSids')
|
||||
..aOB(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'subscribe')
|
||||
..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trackSids')
|
||||
..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'subscribe')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
UpdateSubscription._() : super();
|
||||
@@ -1497,11 +1376,10 @@ class UpdateSubscription extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UpdateSubscription create() => UpdateSubscription._();
|
||||
UpdateSubscription createEmptyInstance() => create();
|
||||
static $pb.PbList<UpdateSubscription> createRepeated() =>
|
||||
$pb.PbList<UpdateSubscription>();
|
||||
static $pb.PbList<UpdateSubscription> createRepeated() => $pb.PbList<UpdateSubscription>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UpdateSubscription getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<UpdateSubscription>(create);
|
||||
static UpdateSubscription getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UpdateSubscription>(create);
|
||||
static UpdateSubscription? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1522,29 +1400,15 @@ class UpdateSubscription extends $pb.GeneratedMessage {
|
||||
|
||||
class UpdateTrackSettings extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'UpdateTrackSettings',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UpdateTrackSettings',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..pPS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'trackSids')
|
||||
..aOB(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'disabled')
|
||||
..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'trackSids')
|
||||
..aOB(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'disabled')
|
||||
..e<VideoQuality>(
|
||||
4,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'quality',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'quality',
|
||||
$pb.PbFieldType.OE,
|
||||
defaultOrMaker: VideoQuality.LOW,
|
||||
valueOf: VideoQuality.valueOf,
|
||||
@@ -1589,11 +1453,10 @@ class UpdateTrackSettings extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UpdateTrackSettings create() => UpdateTrackSettings._();
|
||||
UpdateTrackSettings createEmptyInstance() => create();
|
||||
static $pb.PbList<UpdateTrackSettings> createRepeated() =>
|
||||
$pb.PbList<UpdateTrackSettings>();
|
||||
static $pb.PbList<UpdateTrackSettings> createRepeated() => $pb.PbList<UpdateTrackSettings>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UpdateTrackSettings getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<UpdateTrackSettings>(create);
|
||||
static UpdateTrackSettings getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UpdateTrackSettings>(create);
|
||||
static UpdateTrackSettings? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1626,19 +1489,11 @@ class UpdateTrackSettings extends $pb.GeneratedMessage {
|
||||
|
||||
class LeaveRequest extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'LeaveRequest',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'LeaveRequest',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOB(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'canReconnect')
|
||||
..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'canReconnect')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
LeaveRequest._() : super();
|
||||
@@ -1671,11 +1526,10 @@ class LeaveRequest extends $pb.GeneratedMessage {
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static LeaveRequest create() => LeaveRequest._();
|
||||
LeaveRequest createEmptyInstance() => create();
|
||||
static $pb.PbList<LeaveRequest> createRepeated() =>
|
||||
$pb.PbList<LeaveRequest>();
|
||||
static $pb.PbList<LeaveRequest> createRepeated() => $pb.PbList<LeaveRequest>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static LeaveRequest getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<LeaveRequest>(create);
|
||||
static LeaveRequest getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<LeaveRequest>(create);
|
||||
static LeaveRequest? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
@@ -1693,29 +1547,13 @@ class LeaveRequest extends $pb.GeneratedMessage {
|
||||
|
||||
class ICEServer extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'ICEServer',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'ICEServer',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..pPS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'urls')
|
||||
..aOS(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'username')
|
||||
..aOS(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'credential')
|
||||
..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'urls')
|
||||
..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'username')
|
||||
..aOS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'credential')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
ICEServer._() : super();
|
||||
@@ -1799,21 +1637,20 @@ class DataPacket extends $pb.GeneratedMessage {
|
||||
0: DataPacket_Value.notSet
|
||||
};
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'DataPacket',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'DataPacket',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..oo(0, [2, 3])
|
||||
..e<DataPacket_Kind>(
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'kind', $pb.PbFieldType.OE,
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'kind',
|
||||
$pb.PbFieldType.OE,
|
||||
defaultOrMaker: DataPacket_Kind.RELIABLE,
|
||||
valueOf: DataPacket_Kind.valueOf,
|
||||
enumValues: DataPacket_Kind.values)
|
||||
..aOM<UserPacket>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'user',
|
||||
..aOM<UserPacket>(
|
||||
2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'user',
|
||||
subBuilder: UserPacket.create)
|
||||
..aOM<ActiveSpeakerUpdate>(
|
||||
3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'speaker',
|
||||
@@ -1860,8 +1697,8 @@ class DataPacket extends $pb.GeneratedMessage {
|
||||
DataPacket createEmptyInstance() => create();
|
||||
static $pb.PbList<DataPacket> createRepeated() => $pb.PbList<DataPacket>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static DataPacket getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<DataPacket>(create);
|
||||
static DataPacket getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<DataPacket>(create);
|
||||
static DataPacket? _defaultInstance;
|
||||
|
||||
DataPacket_Value whichValue() => _DataPacket_ValueByTag[$_whichOneof(0)]!;
|
||||
@@ -1910,30 +1747,16 @@ class DataPacket extends $pb.GeneratedMessage {
|
||||
|
||||
class UserPacket extends $pb.GeneratedMessage {
|
||||
static final $pb.BuilderInfo _i = $pb.BuilderInfo(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'UserPacket',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'UserPacket',
|
||||
package: const $pb.PackageName(
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names')
|
||||
? ''
|
||||
: 'livekit'),
|
||||
const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'livekit'),
|
||||
createEmptyInstance: create)
|
||||
..aOS(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'participantSid')
|
||||
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'participantSid')
|
||||
..a<$core.List<$core.int>>(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'payload',
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'payload',
|
||||
$pb.PbFieldType.OY)
|
||||
..pPS(
|
||||
3,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_field_names')
|
||||
? ''
|
||||
: 'destinationSids')
|
||||
..pPS(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'destinationSids')
|
||||
..hasRequiredFields = false;
|
||||
|
||||
UserPacket._() : super();
|
||||
@@ -1976,8 +1799,8 @@ class UserPacket extends $pb.GeneratedMessage {
|
||||
UserPacket createEmptyInstance() => create();
|
||||
static $pb.PbList<UserPacket> createRepeated() => $pb.PbList<UserPacket>();
|
||||
@$core.pragma('dart2js:noInline')
|
||||
static UserPacket getDefault() => _defaultInstance ??=
|
||||
$pb.GeneratedMessage.$_defaultFor<UserPacket>(create);
|
||||
static UserPacket getDefault() =>
|
||||
_defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<UserPacket>(create);
|
||||
static UserPacket? _defaultInstance;
|
||||
|
||||
@$pb.TagNumber(1)
|
||||
|
||||
@@ -11,44 +11,28 @@ import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class SignalTarget extends $pb.ProtobufEnum {
|
||||
static const SignalTarget PUBLISHER = SignalTarget._(
|
||||
0,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'PUBLISHER');
|
||||
0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PUBLISHER');
|
||||
static const SignalTarget SUBSCRIBER = SignalTarget._(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'SUBSCRIBER');
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SUBSCRIBER');
|
||||
|
||||
static const $core.List<SignalTarget> values = <SignalTarget>[
|
||||
PUBLISHER,
|
||||
SUBSCRIBER,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, SignalTarget> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, SignalTarget> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static SignalTarget? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const SignalTarget._($core.int v, $core.String n) : super(v, n);
|
||||
}
|
||||
|
||||
class VideoQuality extends $pb.ProtobufEnum {
|
||||
static const VideoQuality LOW = VideoQuality._(
|
||||
0,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'LOW');
|
||||
static const VideoQuality LOW =
|
||||
VideoQuality._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'LOW');
|
||||
static const VideoQuality MEDIUM = VideoQuality._(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'MEDIUM');
|
||||
static const VideoQuality HIGH = VideoQuality._(
|
||||
2,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'HIGH');
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MEDIUM');
|
||||
static const VideoQuality HIGH =
|
||||
VideoQuality._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'HIGH');
|
||||
|
||||
static const $core.List<VideoQuality> values = <VideoQuality>[
|
||||
LOW,
|
||||
@@ -56,8 +40,7 @@ class VideoQuality extends $pb.ProtobufEnum {
|
||||
HIGH,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, VideoQuality> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static final $core.Map<$core.int, VideoQuality> _byValue = $pb.ProtobufEnum.initByValue(values);
|
||||
static VideoQuality? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const VideoQuality._($core.int v, $core.String n) : super(v, n);
|
||||
@@ -65,15 +48,9 @@ class VideoQuality extends $pb.ProtobufEnum {
|
||||
|
||||
class DataPacket_Kind extends $pb.ProtobufEnum {
|
||||
static const DataPacket_Kind RELIABLE = DataPacket_Kind._(
|
||||
0,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'RELIABLE');
|
||||
0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'RELIABLE');
|
||||
static const DataPacket_Kind LOSSY = DataPacket_Kind._(
|
||||
1,
|
||||
const $core.bool.fromEnvironment('protobuf.omit_enum_names')
|
||||
? ''
|
||||
: 'LOSSY');
|
||||
1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'LOSSY');
|
||||
|
||||
static const $core.List<DataPacket_Kind> values = <DataPacket_Kind>[
|
||||
RELIABLE,
|
||||
|
||||
@@ -19,8 +19,8 @@ const SignalTarget$json = const {
|
||||
};
|
||||
|
||||
/// Descriptor for `SignalTarget`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List signalTargetDescriptor = $convert.base64Decode(
|
||||
'CgxTaWduYWxUYXJnZXQSDQoJUFVCTElTSEVSEAASDgoKU1VCU0NSSUJFUhAB');
|
||||
final $typed_data.Uint8List signalTargetDescriptor =
|
||||
$convert.base64Decode('CgxTaWduYWxUYXJnZXQSDQoJUFVCTElTSEVSEAASDgoKU1VCU0NSSUJFUhAB');
|
||||
@$core.Deprecated('Use videoQualityDescriptor instead')
|
||||
const VideoQuality$json = const {
|
||||
'1': 'VideoQuality',
|
||||
@@ -32,8 +32,8 @@ const VideoQuality$json = const {
|
||||
};
|
||||
|
||||
/// Descriptor for `VideoQuality`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List videoQualityDescriptor = $convert.base64Decode(
|
||||
'CgxWaWRlb1F1YWxpdHkSBwoDTE9XEAASCgoGTUVESVVNEAESCAoESElHSBAC');
|
||||
final $typed_data.Uint8List videoQualityDescriptor =
|
||||
$convert.base64Decode('CgxWaWRlb1F1YWxpdHkSBwoDTE9XEAASCgoGTUVESVVNEAESCAoESElHSBAC');
|
||||
@$core.Deprecated('Use signalRequestDescriptor instead')
|
||||
const SignalRequest$json = const {
|
||||
'1': 'SignalRequest',
|
||||
@@ -219,14 +219,7 @@ const AddTrackRequest$json = const {
|
||||
'2': const [
|
||||
const {'1': 'cid', '3': 1, '4': 1, '5': 9, '10': 'cid'},
|
||||
const {'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
|
||||
const {
|
||||
'1': 'type',
|
||||
'3': 3,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.livekit.TrackType',
|
||||
'10': 'type'
|
||||
},
|
||||
const {'1': 'type', '3': 3, '4': 1, '5': 14, '6': '.livekit.TrackType', '10': 'type'},
|
||||
const {'1': 'width', '3': 4, '4': 1, '5': 13, '10': 'width'},
|
||||
const {'1': 'height', '3': 5, '4': 1, '5': 13, '10': 'height'},
|
||||
],
|
||||
@@ -240,14 +233,7 @@ const TrickleRequest$json = const {
|
||||
'1': 'TrickleRequest',
|
||||
'2': const [
|
||||
const {'1': 'candidateInit', '3': 1, '4': 1, '5': 9, '10': 'candidateInit'},
|
||||
const {
|
||||
'1': 'target',
|
||||
'3': 2,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.livekit.SignalTarget',
|
||||
'10': 'target'
|
||||
},
|
||||
const {'1': 'target', '3': 2, '4': 1, '5': 14, '6': '.livekit.SignalTarget', '10': 'target'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -271,14 +257,7 @@ const SetSimulcastLayers$json = const {
|
||||
'1': 'SetSimulcastLayers',
|
||||
'2': const [
|
||||
const {'1': 'track_sid', '3': 1, '4': 1, '5': 9, '10': 'trackSid'},
|
||||
const {
|
||||
'1': 'layers',
|
||||
'3': 2,
|
||||
'4': 3,
|
||||
'5': 14,
|
||||
'6': '.livekit.VideoQuality',
|
||||
'10': 'layers'
|
||||
},
|
||||
const {'1': 'layers', '3': 2, '4': 3, '5': 14, '6': '.livekit.VideoQuality', '10': 'layers'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -289,14 +268,7 @@ final $typed_data.Uint8List setSimulcastLayersDescriptor = $convert.base64Decode
|
||||
const JoinResponse$json = const {
|
||||
'1': 'JoinResponse',
|
||||
'2': const [
|
||||
const {
|
||||
'1': 'room',
|
||||
'3': 1,
|
||||
'4': 1,
|
||||
'5': 11,
|
||||
'6': '.livekit.Room',
|
||||
'10': 'room'
|
||||
},
|
||||
const {'1': 'room', '3': 1, '4': 1, '5': 11, '6': '.livekit.Room', '10': 'room'},
|
||||
const {
|
||||
'1': 'participant',
|
||||
'3': 2,
|
||||
@@ -313,13 +285,7 @@ const JoinResponse$json = const {
|
||||
'6': '.livekit.ParticipantInfo',
|
||||
'10': 'otherParticipants'
|
||||
},
|
||||
const {
|
||||
'1': 'server_version',
|
||||
'3': 4,
|
||||
'4': 1,
|
||||
'5': 9,
|
||||
'10': 'serverVersion'
|
||||
},
|
||||
const {'1': 'server_version', '3': 4, '4': 1, '5': 9, '10': 'serverVersion'},
|
||||
const {
|
||||
'1': 'ice_servers',
|
||||
'3': 5,
|
||||
@@ -339,21 +305,13 @@ const TrackPublishedResponse$json = const {
|
||||
'1': 'TrackPublishedResponse',
|
||||
'2': const [
|
||||
const {'1': 'cid', '3': 1, '4': 1, '5': 9, '10': 'cid'},
|
||||
const {
|
||||
'1': 'track',
|
||||
'3': 2,
|
||||
'4': 1,
|
||||
'5': 11,
|
||||
'6': '.livekit.TrackInfo',
|
||||
'10': 'track'
|
||||
},
|
||||
const {'1': 'track', '3': 2, '4': 1, '5': 11, '6': '.livekit.TrackInfo', '10': 'track'},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `TrackPublishedResponse`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List trackPublishedResponseDescriptor =
|
||||
$convert.base64Decode(
|
||||
'ChZUcmFja1B1Ymxpc2hlZFJlc3BvbnNlEhAKA2NpZBgBIAEoCVIDY2lkEigKBXRyYWNrGAIgASgLMhIubGl2ZWtpdC5UcmFja0luZm9SBXRyYWNr');
|
||||
final $typed_data.Uint8List trackPublishedResponseDescriptor = $convert.base64Decode(
|
||||
'ChZUcmFja1B1Ymxpc2hlZFJlc3BvbnNlEhAKA2NpZBgBIAEoCVIDY2lkEigKBXRyYWNrGAIgASgLMhIubGl2ZWtpdC5UcmFja0luZm9SBXRyYWNr');
|
||||
@$core.Deprecated('Use sessionDescriptionDescriptor instead')
|
||||
const SessionDescription$json = const {
|
||||
'1': 'SessionDescription',
|
||||
@@ -388,14 +346,7 @@ final $typed_data.Uint8List participantUpdateDescriptor = $convert.base64Decode(
|
||||
const ActiveSpeakerUpdate$json = const {
|
||||
'1': 'ActiveSpeakerUpdate',
|
||||
'2': const [
|
||||
const {
|
||||
'1': 'speakers',
|
||||
'3': 1,
|
||||
'4': 3,
|
||||
'5': 11,
|
||||
'6': '.livekit.SpeakerInfo',
|
||||
'10': 'speakers'
|
||||
},
|
||||
const {'1': 'speakers', '3': 1, '4': 3, '5': 11, '6': '.livekit.SpeakerInfo', '10': 'speakers'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -433,14 +384,7 @@ const UpdateTrackSettings$json = const {
|
||||
'2': const [
|
||||
const {'1': 'track_sids', '3': 1, '4': 3, '5': 9, '10': 'trackSids'},
|
||||
const {'1': 'disabled', '3': 3, '4': 1, '5': 8, '10': 'disabled'},
|
||||
const {
|
||||
'1': 'quality',
|
||||
'3': 4,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.livekit.VideoQuality',
|
||||
'10': 'quality'
|
||||
},
|
||||
const {'1': 'quality', '3': 4, '4': 1, '5': 14, '6': '.livekit.VideoQuality', '10': 'quality'},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -456,8 +400,8 @@ const LeaveRequest$json = const {
|
||||
};
|
||||
|
||||
/// Descriptor for `LeaveRequest`. Decode as a `google.protobuf.DescriptorProto`.
|
||||
final $typed_data.Uint8List leaveRequestDescriptor = $convert.base64Decode(
|
||||
'CgxMZWF2ZVJlcXVlc3QSIwoNY2FuX3JlY29ubmVjdBgBIAEoCFIMY2FuUmVjb25uZWN0');
|
||||
final $typed_data.Uint8List leaveRequestDescriptor =
|
||||
$convert.base64Decode('CgxMZWF2ZVJlcXVlc3QSIwoNY2FuX3JlY29ubmVjdBgBIAEoCFIMY2FuUmVjb25uZWN0');
|
||||
@$core.Deprecated('Use iCEServerDescriptor instead')
|
||||
const ICEServer$json = const {
|
||||
'1': 'ICEServer',
|
||||
@@ -475,23 +419,8 @@ final $typed_data.Uint8List iCEServerDescriptor = $convert.base64Decode(
|
||||
const DataPacket$json = const {
|
||||
'1': 'DataPacket',
|
||||
'2': const [
|
||||
const {
|
||||
'1': 'kind',
|
||||
'3': 1,
|
||||
'4': 1,
|
||||
'5': 14,
|
||||
'6': '.livekit.DataPacket.Kind',
|
||||
'10': 'kind'
|
||||
},
|
||||
const {
|
||||
'1': 'user',
|
||||
'3': 2,
|
||||
'4': 1,
|
||||
'5': 11,
|
||||
'6': '.livekit.UserPacket',
|
||||
'9': 0,
|
||||
'10': 'user'
|
||||
},
|
||||
const {'1': 'kind', '3': 1, '4': 1, '5': 14, '6': '.livekit.DataPacket.Kind', '10': 'kind'},
|
||||
const {'1': 'user', '3': 2, '4': 1, '5': 11, '6': '.livekit.UserPacket', '9': 0, '10': 'user'},
|
||||
const {
|
||||
'1': 'speaker',
|
||||
'3': 3,
|
||||
@@ -524,21 +453,9 @@ final $typed_data.Uint8List dataPacketDescriptor = $convert.base64Decode(
|
||||
const UserPacket$json = const {
|
||||
'1': 'UserPacket',
|
||||
'2': const [
|
||||
const {
|
||||
'1': 'participant_sid',
|
||||
'3': 1,
|
||||
'4': 1,
|
||||
'5': 9,
|
||||
'10': 'participantSid'
|
||||
},
|
||||
const {'1': 'participant_sid', '3': 1, '4': 1, '5': 9, '10': 'participantSid'},
|
||||
const {'1': 'payload', '3': 2, '4': 1, '5': 12, '10': 'payload'},
|
||||
const {
|
||||
'1': 'destination_sids',
|
||||
'3': 3,
|
||||
'4': 3,
|
||||
'5': 9,
|
||||
'10': 'destinationSids'
|
||||
},
|
||||
const {'1': 'destination_sids', '3': 3, '4': 3, '5': 9, '10': 'destinationSids'},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
+69
-73
@@ -21,9 +21,9 @@ import 'track/track.dart';
|
||||
import 'track/track_publication.dart';
|
||||
|
||||
enum RoomState {
|
||||
Disconnected,
|
||||
Connected,
|
||||
Reconnecting,
|
||||
disconnected,
|
||||
connected,
|
||||
reconnecting,
|
||||
}
|
||||
|
||||
/// Delegate for [Room] callbacks
|
||||
@@ -68,21 +68,19 @@ mixin RoomDelegate {
|
||||
|
||||
/// When a new track is published to room *after* the current participant has
|
||||
/// joined. It will not fire for tracks that are already published
|
||||
void onTrackPublished(
|
||||
RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
void onTrackPublished(RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
|
||||
/// A [RemoteParticipant] has unpublished a track
|
||||
void onTrackUnpublished(
|
||||
RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
void onTrackUnpublished(RemoteParticipant participant, RemoteTrackPublication publication) {}
|
||||
|
||||
/// The [LocalParticipant] has subscribed to a new track. This event will **always**
|
||||
/// fire as long as new tracks are ready for use.
|
||||
void onTrackSubscribed(RemoteParticipant participant, Track track,
|
||||
RemoteTrackPublication publication) {}
|
||||
void onTrackSubscribed(
|
||||
RemoteParticipant participant, Track track, RemoteTrackPublication publication) {}
|
||||
|
||||
/// A subscribed track is no longer available.
|
||||
void onTrackUnsubscribed(RemoteParticipant participant, Track track,
|
||||
RemoteTrackPublication publication) {}
|
||||
void onTrackUnsubscribed(
|
||||
RemoteParticipant participant, Track track, RemoteTrackPublication publication) {}
|
||||
|
||||
/// Data received from another [RemoteParticipant].
|
||||
/// Data packets provides the ability to use LiveKit to send/receive arbitrary
|
||||
@@ -90,8 +88,7 @@ mixin RoomDelegate {
|
||||
void onDataReceived(RemoteParticipant participant, List<int> data) {}
|
||||
|
||||
/// Encountered failure attempting to subscribe to track.
|
||||
void onTrackSubscriptionFailed(
|
||||
RemoteParticipant participant, String sid, String? message) {}
|
||||
void onTrackSubscriptionFailed(RemoteParticipant participant, String sid, String? message) {}
|
||||
}
|
||||
|
||||
/// Room is the primary construct for LiveKit conferences. It contains a
|
||||
@@ -104,12 +101,12 @@ mixin RoomDelegate {
|
||||
/// * active speakers are different
|
||||
/// {@category Room}
|
||||
class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
RoomState _state = RoomState.Disconnected;
|
||||
RoomState _state = RoomState.disconnected;
|
||||
|
||||
/// connection state of the room
|
||||
RoomState get state => _state;
|
||||
|
||||
Map<String, RemoteParticipant> _participants = {};
|
||||
final Map<String, RemoteParticipant> _participants = {};
|
||||
|
||||
/// map of SID to RemoteParticipant
|
||||
UnmodifiableMapView<String, RemoteParticipant> get participants =>
|
||||
@@ -133,14 +130,13 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
/// delegate for room events
|
||||
RoomDelegate? delegate;
|
||||
|
||||
RTCEngine _engine;
|
||||
final RTCEngine _engine;
|
||||
|
||||
Completer<Room>? _connectCompleter;
|
||||
|
||||
/// internal use
|
||||
/// {@nodoc}
|
||||
Room([RTCConfiguration? rtcConfig])
|
||||
: _engine = new RTCEngine(SignalClient(), rtcConfig) {
|
||||
Room([RTCConfiguration? rtcConfig]) : _engine = RTCEngine(SignalClient(), rtcConfig) {
|
||||
_engine.onTrack = _onTrackAdded;
|
||||
_engine.onICEConnected = _handleICEConnected;
|
||||
_engine.onDisconnected = _handleDisconnect;
|
||||
@@ -148,26 +144,25 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
_engine.onActiveSpeakerchangedCallback = _handleSpeakerUpdate;
|
||||
_engine.onDataMessageCallback = _handleDataPacket;
|
||||
_engine.onReconnected = () {
|
||||
_state = RoomState.Connected;
|
||||
_state = RoomState.connected;
|
||||
delegate?.onReconnected();
|
||||
notifyListeners();
|
||||
};
|
||||
_engine.onReconnecting = () {
|
||||
_state = RoomState.Reconnecting;
|
||||
_state = RoomState.reconnecting;
|
||||
delegate?.onReconnecting();
|
||||
notifyListeners();
|
||||
};
|
||||
}
|
||||
|
||||
Future<Room> connect(String url, String token, [JoinOptions? opts]) async {
|
||||
var completer = new Completer<Room>();
|
||||
final completer = Completer<Room>();
|
||||
_connectCompleter = completer;
|
||||
|
||||
var joinResponse = await _engine.join(url, token, opts);
|
||||
logger.fine(
|
||||
'connected to LiveKit server, version: ${joinResponse.serverVersion}');
|
||||
final joinResponse = await _engine.join(url, token, opts);
|
||||
logger.fine('connected to LiveKit server, version: ${joinResponse.serverVersion}');
|
||||
|
||||
localParticipant = new LocalParticipant(
|
||||
localParticipant = LocalParticipant(
|
||||
engine: _engine,
|
||||
info: joinResponse.participant,
|
||||
);
|
||||
@@ -176,17 +171,17 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
sid = joinResponse.room.sid;
|
||||
name = joinResponse.room.name;
|
||||
|
||||
for (var info in joinResponse.otherParticipants) {
|
||||
for (final info in joinResponse.otherParticipants) {
|
||||
_getOrCreateRemoteParticipant(info.sid, info);
|
||||
}
|
||||
|
||||
// room is not ready until ICE is connected. so we would return a completer for now
|
||||
// if it times out, we'll fail the completer
|
||||
Timer(Duration(seconds: 5), () {
|
||||
if (_state != RoomState.Disconnected) {
|
||||
Timer(const Duration(seconds: 5), () {
|
||||
if (_state != RoomState.disconnected) {
|
||||
return;
|
||||
}
|
||||
_state = RoomState.Disconnected;
|
||||
_state = RoomState.disconnected;
|
||||
_connectCompleter?.completeError(ConnectError());
|
||||
_connectCompleter = null;
|
||||
notifyListeners();
|
||||
@@ -196,13 +191,12 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
}
|
||||
|
||||
/// Disconnects from the room, notifying server of disconnection.
|
||||
disconnect() {
|
||||
void disconnect() {
|
||||
_engine.client.sendLeave();
|
||||
_handleDisconnect();
|
||||
}
|
||||
|
||||
RemoteParticipant _getOrCreateRemoteParticipant(
|
||||
String sid, ParticipantInfo? info) {
|
||||
RemoteParticipant _getOrCreateRemoteParticipant(String sid, ParticipantInfo? info) {
|
||||
var participant = _participants[sid];
|
||||
if (participant != null) {
|
||||
return participant;
|
||||
@@ -219,40 +213,40 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
return participant;
|
||||
}
|
||||
|
||||
_handleICEConnected() {
|
||||
void _handleICEConnected() {
|
||||
_connectCompleter?.complete(this);
|
||||
_connectCompleter = null;
|
||||
_state = RoomState.Connected;
|
||||
_state = RoomState.connected;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
_handleDisconnect() {
|
||||
if (_state == RoomState.Disconnected) {
|
||||
void _handleDisconnect() {
|
||||
if (_state == RoomState.disconnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var p in _participants.values) {
|
||||
var tracks = List<TrackPublication>.from(p.tracks.values);
|
||||
for (var pub in tracks) {
|
||||
for (final p in _participants.values) {
|
||||
final tracks = List<TrackPublication>.from(p.tracks.values);
|
||||
for (final pub in tracks) {
|
||||
p.unpublishTrack(pub.sid);
|
||||
}
|
||||
}
|
||||
for (var pub in localParticipant.tracks.values) {
|
||||
for (final pub in localParticipant.tracks.values) {
|
||||
pub.track?.stop();
|
||||
}
|
||||
|
||||
_engine.close();
|
||||
_participants.clear();
|
||||
_activeSpeakers.clear();
|
||||
_state = RoomState.Disconnected;
|
||||
_state = RoomState.disconnected;
|
||||
notifyListeners();
|
||||
delegate?.onDisconnected();
|
||||
}
|
||||
|
||||
_handleParticipantUpdate(List<ParticipantInfo> updates) {
|
||||
void _handleParticipantUpdate(List<ParticipantInfo> updates) {
|
||||
// trigger change notifier only if list of participants membership is changed
|
||||
var hasChanged = false;
|
||||
for (var info in updates) {
|
||||
for (final info in updates) {
|
||||
if (localParticipant.sid == info.sid) {
|
||||
localParticipant.updateFromInfo(info);
|
||||
continue;
|
||||
@@ -264,8 +258,8 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
continue;
|
||||
}
|
||||
|
||||
var isNew = !_participants.containsKey(info.sid);
|
||||
var participant = _getOrCreateRemoteParticipant(info.sid, info);
|
||||
final isNew = !_participants.containsKey(info.sid);
|
||||
final participant = _getOrCreateRemoteParticipant(info.sid, info);
|
||||
|
||||
if (isNew) {
|
||||
hasChanged = true;
|
||||
@@ -280,10 +274,10 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
_handleSpeakerUpdate(List<SpeakerInfo> speakers) {
|
||||
var seenSids = Set<String>();
|
||||
void _handleSpeakerUpdate(List<SpeakerInfo> speakers) {
|
||||
final seenSids = <String>{};
|
||||
List<Participant> newSpeakers = [];
|
||||
for (var info in speakers) {
|
||||
for (final info in speakers) {
|
||||
seenSids.add(info.sid);
|
||||
|
||||
if (info.sid == localParticipant.sid) {
|
||||
@@ -293,7 +287,7 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
continue;
|
||||
}
|
||||
|
||||
var participant = participants[info.sid];
|
||||
final participant = participants[info.sid];
|
||||
if (participant != null) {
|
||||
participant.audioLevel = info.level;
|
||||
participant.isSpeaking = true;
|
||||
@@ -306,7 +300,7 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
localParticipant.audioLevel = 0;
|
||||
localParticipant.isSpeaking = false;
|
||||
}
|
||||
for (var participant in _participants.values) {
|
||||
for (final participant in _participants.values) {
|
||||
if (!seenSids.contains(participant.sid)) {
|
||||
participant.audioLevel = 0;
|
||||
participant.isSpeaking = false;
|
||||
@@ -318,8 +312,8 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
_handleDataPacket(UserPacket packet, DataPacket_Kind kind) {
|
||||
var participant = participants[packet.participantSid];
|
||||
void _handleDataPacket(UserPacket packet, DataPacket_Kind kind) {
|
||||
final participant = participants[packet.participantSid];
|
||||
if (participant == null) {
|
||||
return;
|
||||
}
|
||||
@@ -328,8 +322,7 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
delegate?.onDataReceived(participant, packet.payload);
|
||||
}
|
||||
|
||||
_onTrackAdded(
|
||||
MediaStreamTrack track, MediaStream? stream, RTCRtpReceiver? receiver) {
|
||||
void _onTrackAdded(MediaStreamTrack track, MediaStream? stream, RTCRtpReceiver? receiver) {
|
||||
if (stream == null) {
|
||||
// we need the stream to get the track's id
|
||||
logger.severe('received track without mediastream');
|
||||
@@ -337,23 +330,20 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
}
|
||||
|
||||
var parsed = _unpackStreamId(stream.id);
|
||||
var trackSid = parsed.item2;
|
||||
if (trackSid == null) {
|
||||
trackSid = track.id;
|
||||
}
|
||||
var trackSid = parsed.item2 ?? track.id;
|
||||
|
||||
var participant = _getOrCreateRemoteParticipant(parsed.item1, null);
|
||||
final participant = _getOrCreateRemoteParticipant(parsed.item1, null);
|
||||
participant.addSubscribedMediaTrack(track, stream, trackSid);
|
||||
}
|
||||
|
||||
_handleParticipantDisconnect(String sid) {
|
||||
var participant = _participants.remove(sid);
|
||||
void _handleParticipantDisconnect(String sid) {
|
||||
final participant = _participants.remove(sid);
|
||||
if (participant == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var toRemove = List.from(participant.tracks.values);
|
||||
for (var track in toRemove) {
|
||||
final toRemove = List<TrackPublication>.from(participant.tracks.values);
|
||||
for (final track in toRemove) {
|
||||
participant.unpublishTrack(track.sid, true);
|
||||
}
|
||||
delegate?.onParticipantDisconnected(participant);
|
||||
@@ -361,43 +351,49 @@ class Room extends ChangeNotifier with ParticipantDelegate {
|
||||
|
||||
//----------------- forward participant delegate calls ---------------------//
|
||||
|
||||
@override
|
||||
void onMetadataChanged(Participant participant) {
|
||||
delegate?.onMetadataChanged(participant);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTrackMuted(Participant participant, TrackPublication publication) {
|
||||
delegate?.onTrackMuted(participant, publication);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTrackUnmuted(Participant participant, TrackPublication publication) {
|
||||
delegate?.onTrackUnmuted(participant, publication);
|
||||
}
|
||||
|
||||
void onTrackPublished(
|
||||
RemoteParticipant participant, RemoteTrackPublication publication) {
|
||||
@override
|
||||
void onTrackPublished(RemoteParticipant participant, RemoteTrackPublication publication) {
|
||||
delegate?.onTrackPublished(participant, publication);
|
||||
}
|
||||
|
||||
void onTrackUnpublished(
|
||||
RemoteParticipant participant, RemoteTrackPublication publication) {
|
||||
@override
|
||||
void onTrackUnpublished(RemoteParticipant participant, RemoteTrackPublication publication) {
|
||||
delegate?.onTrackUnpublished(participant, publication);
|
||||
}
|
||||
|
||||
void onTrackSubscribed(RemoteParticipant participant, Track track,
|
||||
RemoteTrackPublication publication) {
|
||||
@override
|
||||
void onTrackSubscribed(
|
||||
RemoteParticipant participant, Track track, RemoteTrackPublication publication) {
|
||||
delegate?.onTrackSubscribed(participant, track, publication);
|
||||
}
|
||||
|
||||
void onTrackUnsubscribed(RemoteParticipant participant, Track track,
|
||||
RemoteTrackPublication publication) {
|
||||
@override
|
||||
void onTrackUnsubscribed(
|
||||
RemoteParticipant participant, Track track, RemoteTrackPublication publication) {
|
||||
delegate?.onTrackUnsubscribed(participant, track, publication);
|
||||
}
|
||||
|
||||
// omitted because data dispatching is handled in _handleDataPacket
|
||||
@override
|
||||
void onDataReceived(RemoteParticipant participant, List<int> data) {}
|
||||
|
||||
void onTrackSubscriptionFailed(
|
||||
RemoteParticipant participant, String sid, String? message) {
|
||||
@override
|
||||
void onTrackSubscriptionFailed(RemoteParticipant participant, String sid, String? message) {
|
||||
delegate?.onTrackSubscriptionFailed(participant, sid, message);
|
||||
}
|
||||
}
|
||||
|
||||
+64
-62
@@ -13,26 +13,23 @@ import 'transport.dart';
|
||||
|
||||
const lossyDataChannel = '_lossy';
|
||||
const reliableDataChannel = '_reliable';
|
||||
final connectionTimeout = new Duration(seconds: 5);
|
||||
final maxReconnectAttempts = 5;
|
||||
final iceRestartTimeout = new Duration(seconds: 10);
|
||||
const connectionTimeout = Duration(seconds: 5);
|
||||
const maxReconnectAttempts = 5;
|
||||
const iceRestartTimeout = Duration(seconds: 10);
|
||||
|
||||
typedef GenericCallback = void Function();
|
||||
typedef TrackCallback = void Function(
|
||||
MediaStreamTrack track, MediaStream? stream, RTCRtpReceiver? receiver);
|
||||
typedef ParticipantUpdateCallback = void Function(
|
||||
List<ParticipantInfo> participants);
|
||||
typedef ActiveSpeakerChangedCallback = void Function(
|
||||
List<SpeakerInfo> speakers);
|
||||
typedef DataPacketCallback = void Function(
|
||||
UserPacket packet, DataPacket_Kind kind);
|
||||
typedef ParticipantUpdateCallback = void Function(List<ParticipantInfo> participants);
|
||||
typedef ActiveSpeakerChangedCallback = void Function(List<SpeakerInfo> speakers);
|
||||
typedef DataPacketCallback = void Function(UserPacket packet, DataPacket_Kind kind);
|
||||
|
||||
class RTCEngine with SignalClientDelegate {
|
||||
PCTransport? publisher;
|
||||
PCTransport? subscriber;
|
||||
SignalClient client;
|
||||
// config for RTCPeerConnection
|
||||
RTCConfiguration rtcConfig = new RTCConfiguration();
|
||||
RTCConfiguration rtcConfig = RTCConfiguration();
|
||||
// data channels for packets
|
||||
RTCDataChannel? reliableDC;
|
||||
RTCDataChannel? lossyDC;
|
||||
@@ -62,14 +59,14 @@ class RTCEngine with SignalClientDelegate {
|
||||
this.rtcConfig = rtcConfig;
|
||||
}
|
||||
|
||||
this.client.delegate = this;
|
||||
client.delegate = this;
|
||||
}
|
||||
|
||||
Future<JoinResponse> join(String url, String token, JoinOptions? opts) async {
|
||||
this.url = url;
|
||||
this.token = token;
|
||||
|
||||
var completer = new Completer<JoinResponse>();
|
||||
final completer = Completer<JoinResponse>();
|
||||
joinCompleter = completer;
|
||||
|
||||
try {
|
||||
@@ -79,22 +76,22 @@ class RTCEngine with SignalClientDelegate {
|
||||
}
|
||||
|
||||
// if it's not complete after 5 seconds, fail
|
||||
new Timer(connectionTimeout, () {
|
||||
joinCompleter?.completeError(new ConnectError());
|
||||
Timer(connectionTimeout, () {
|
||||
joinCompleter?.completeError(ConnectError());
|
||||
joinCompleter = null;
|
||||
});
|
||||
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
close() async {
|
||||
void close() async {
|
||||
isClosed = true;
|
||||
|
||||
if (publisher != null) {
|
||||
var senders = await publisher?.pc.getSenders();
|
||||
senders?.forEach((element) async {
|
||||
final senders = await publisher?.pc.getSenders();
|
||||
for (final element in (senders ?? <RTCRtpSender>[])) {
|
||||
await publisher?.pc.removeTrack(element);
|
||||
});
|
||||
}
|
||||
|
||||
publisher?.pc.close();
|
||||
publisher = null;
|
||||
@@ -112,11 +109,10 @@ class RTCEngine with SignalClientDelegate {
|
||||
required TrackType kind,
|
||||
TrackDimension? dimension}) async {
|
||||
if (pendingTrackResolvers[cid] != null) {
|
||||
throw new TrackPublishError(
|
||||
'a track with the same CID has already been published');
|
||||
throw TrackPublishError('a track with the same CID has already been published');
|
||||
}
|
||||
|
||||
var completer = new Completer<TrackInfo>();
|
||||
final completer = Completer<TrackInfo>();
|
||||
pendingTrackResolvers[cid] = completer;
|
||||
|
||||
client.sendAddTrack(cid: cid, name: name, type: kind, dimension: dimension);
|
||||
@@ -124,29 +120,28 @@ class RTCEngine with SignalClientDelegate {
|
||||
return completer.future;
|
||||
}
|
||||
|
||||
negotiate({bool? iceRestart}) async {
|
||||
var pub = this.publisher;
|
||||
Future<void> negotiate({bool? iceRestart}) async {
|
||||
final pub = publisher;
|
||||
if (pub == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var remoteDesc = await pub.getRemoteDescription();
|
||||
final remoteDesc = await pub.getRemoteDescription();
|
||||
|
||||
// handle cases that we couldn't create a new offer due to a pending answer
|
||||
// that's lost in transit
|
||||
if (remoteDesc != null &&
|
||||
pub.pc.signalingState ==
|
||||
RTCSignalingState.RTCSignalingStateHaveLocalOffer) {
|
||||
pub.pc.signalingState == RTCSignalingState.RTCSignalingStateHaveLocalOffer) {
|
||||
await pub.pc.setRemoteDescription(remoteDesc);
|
||||
}
|
||||
|
||||
var constraints = <String, dynamic>{};
|
||||
final constraints = <String, dynamic>{};
|
||||
if (iceRestart != null && iceRestart) {
|
||||
constraints['mandatory'] = {
|
||||
'IceRestart': true,
|
||||
};
|
||||
}
|
||||
var offer = await pub.pc.createOffer(constraints);
|
||||
final offer = await pub.pc.createOffer(constraints);
|
||||
await pub.pc.setLocalDescription(offer);
|
||||
client.sendOffer(offer);
|
||||
}
|
||||
@@ -155,10 +150,10 @@ class RTCEngine with SignalClientDelegate {
|
||||
if (isClosed) {
|
||||
return;
|
||||
}
|
||||
var url = this.url;
|
||||
var token = this.token;
|
||||
final url = this.url;
|
||||
final token = this.token;
|
||||
if (url == null || token == null) {
|
||||
throw ConnectError("could not reconnect without url and token");
|
||||
throw ConnectError('could not reconnect without url and token');
|
||||
}
|
||||
if (reconnectAttempts == 0) {
|
||||
onReconnecting?.call();
|
||||
@@ -169,8 +164,8 @@ class RTCEngine with SignalClientDelegate {
|
||||
isReconnecting = true;
|
||||
await client.reconnect(url, token);
|
||||
|
||||
var pub = this.publisher;
|
||||
var sub = this.subscriber;
|
||||
final pub = publisher;
|
||||
final sub = subscriber;
|
||||
if (pub == null || sub == null) {
|
||||
throw UnexpectedConnectionState('publisher or subscribers is null');
|
||||
}
|
||||
@@ -185,28 +180,28 @@ class RTCEngine with SignalClientDelegate {
|
||||
}
|
||||
|
||||
// wait for connectivity to change
|
||||
var startTime = DateTime.now();
|
||||
final startTime = DateTime.now();
|
||||
while (DateTime.now().difference(startTime) < iceRestartTimeout) {
|
||||
if (iceConnected) {
|
||||
isReconnecting = false;
|
||||
return;
|
||||
}
|
||||
await Future.delayed(Duration(milliseconds: 100));
|
||||
await Future<void>.delayed(const Duration(milliseconds: 100));
|
||||
}
|
||||
|
||||
isReconnecting = false;
|
||||
return Future.error(ConnectError('could not reconnect ICE'));
|
||||
}
|
||||
|
||||
_configurePeerConnections() async {
|
||||
Future<void> _configurePeerConnections() async {
|
||||
if (publisher != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pubPC = await createPeerConnection(rtcConfig.toMap());
|
||||
publisher = new PCTransport(pubPC);
|
||||
var subPC = await createPeerConnection(rtcConfig.toMap());
|
||||
subscriber = new PCTransport(subPC);
|
||||
final pubPC = await createPeerConnection(rtcConfig.toMap());
|
||||
publisher = PCTransport(pubPC);
|
||||
final subPC = await createPeerConnection(rtcConfig.toMap());
|
||||
subscriber = PCTransport(subPC);
|
||||
|
||||
pubPC.onIceCandidate = (RTCIceCandidate candidate) {
|
||||
client.sendIceCandidate(candidate, SignalTarget.PUBLISHER);
|
||||
@@ -217,8 +212,7 @@ class RTCEngine with SignalClientDelegate {
|
||||
|
||||
pubPC.onRenegotiationNeeded = () {
|
||||
if (pubPC.iceConnectionState == null ||
|
||||
pubPC.iceConnectionState ==
|
||||
RTCIceConnectionState.RTCIceConnectionStateNew) {
|
||||
pubPC.iceConnectionState == RTCIceConnectionState.RTCIceConnectionStateNew) {
|
||||
return;
|
||||
}
|
||||
negotiate();
|
||||
@@ -256,30 +250,29 @@ class RTCEngine with SignalClientDelegate {
|
||||
};
|
||||
|
||||
// create data channels
|
||||
var lossyInit = new RTCDataChannelInit()
|
||||
final lossyInit = RTCDataChannelInit()
|
||||
..maxRetransmits = 1
|
||||
..ordered = true
|
||||
..binaryType = 'binary';
|
||||
lossyDC = await pubPC.createDataChannel(lossyDataChannel, lossyInit);
|
||||
|
||||
var reliableInit = new RTCDataChannelInit()
|
||||
final reliableInit = RTCDataChannelInit()
|
||||
..ordered = true
|
||||
..maxRetransmits = 50
|
||||
..binaryType = 'binary';
|
||||
reliableDC =
|
||||
await pubPC.createDataChannel(reliableDataChannel, reliableInit);
|
||||
reliableDC = await pubPC.createDataChannel(reliableDataChannel, reliableInit);
|
||||
|
||||
lossyDC?.onMessage = _handleDataMessage;
|
||||
reliableDC?.onMessage = _handleDataMessage;
|
||||
}
|
||||
|
||||
_handleDataMessage(RTCDataChannelMessage message) {
|
||||
void _handleDataMessage(RTCDataChannelMessage message) {
|
||||
// always expect binary
|
||||
if (!message.isBinary) {
|
||||
return;
|
||||
}
|
||||
|
||||
var dp = DataPacket.fromBuffer(message.binary);
|
||||
final dp = DataPacket.fromBuffer(message.binary);
|
||||
switch (dp.whichValue()) {
|
||||
case DataPacket_Value.speaker:
|
||||
onActiveSpeakerchangedCallback?.call(dp.speaker.speakers);
|
||||
@@ -292,23 +285,23 @@ class RTCEngine with SignalClientDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
_handleDisconnect(String reason) {
|
||||
void _handleDisconnect(String reason) {
|
||||
if (isClosed) {
|
||||
return;
|
||||
}
|
||||
logger.fine('disconnected $reason');
|
||||
if (this.reconnectAttempts >= maxReconnectAttempts) {
|
||||
if (reconnectAttempts >= maxReconnectAttempts) {
|
||||
logger.info('could not connect after $reconnectAttempts, giving up');
|
||||
this.close();
|
||||
close();
|
||||
onDisconnected?.call();
|
||||
return;
|
||||
}
|
||||
|
||||
var delay = (reconnectAttempts * reconnectAttempts) * 300;
|
||||
final delay = (reconnectAttempts * reconnectAttempts) * 300;
|
||||
Future.delayed(Duration(milliseconds: delay), () {
|
||||
reconnect().then((_) {
|
||||
reconnectAttempts = 0;
|
||||
}).catchError((e) {
|
||||
}).catchError((dynamic e) {
|
||||
_handleDisconnect(reason);
|
||||
});
|
||||
});
|
||||
@@ -316,14 +309,15 @@ class RTCEngine with SignalClientDelegate {
|
||||
|
||||
//------------------ SignalClient Delegate methods -------------------------//
|
||||
|
||||
@override
|
||||
void onConnected(JoinResponse response) async {
|
||||
// create peer connections
|
||||
this.isClosed = false;
|
||||
isClosed = false;
|
||||
|
||||
if (rtcConfig.iceServers == null && response.iceServers.length > 0) {
|
||||
if (rtcConfig.iceServers == null && response.iceServers.isNotEmpty) {
|
||||
List<RTCIceServer> iceServers = [];
|
||||
response.iceServers.forEach((item) {
|
||||
var iceServer = new RTCIceServer(urls: item.urls);
|
||||
for (final item in response.iceServers) {
|
||||
final iceServer = RTCIceServer(urls: item.urls);
|
||||
if (item.username.isNotEmpty) {
|
||||
iceServer.username = item.username;
|
||||
}
|
||||
@@ -331,7 +325,7 @@ class RTCEngine with SignalClientDelegate {
|
||||
iceServer.credential = item.credential;
|
||||
}
|
||||
iceServers.add(iceServer);
|
||||
});
|
||||
}
|
||||
rtcConfig.iceServers = iceServers;
|
||||
}
|
||||
|
||||
@@ -343,22 +337,25 @@ class RTCEngine with SignalClientDelegate {
|
||||
joinCompleter = null;
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose([String? reason]) {
|
||||
_handleDisconnect("signal");
|
||||
_handleDisconnect('signal');
|
||||
}
|
||||
|
||||
@override
|
||||
void onOffer(RTCSessionDescription sd) async {
|
||||
var sub = subscriber;
|
||||
final sub = subscriber;
|
||||
if (sub == null) {
|
||||
return;
|
||||
}
|
||||
await sub.setRemoteDescription(sd);
|
||||
|
||||
var answer = await sub.pc.createAnswer();
|
||||
final answer = await sub.pc.createAnswer();
|
||||
await sub.pc.setLocalDescription(answer);
|
||||
client.sendAnswer(answer);
|
||||
}
|
||||
|
||||
@override
|
||||
void onAnswer(RTCSessionDescription sd) {
|
||||
if (publisher == null) {
|
||||
return;
|
||||
@@ -367,6 +364,7 @@ class RTCEngine with SignalClientDelegate {
|
||||
publisher?.setRemoteDescription(sd);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTrickle(RTCIceCandidate candidate, SignalTarget target) {
|
||||
if (target == SignalTarget.SUBSCRIBER) {
|
||||
subscriber?.addIceCandidate(candidate);
|
||||
@@ -375,19 +373,23 @@ class RTCEngine with SignalClientDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onParticipantUpdate(List<ParticipantInfo> updates) {
|
||||
onParticipantUpdateCallback?.call(updates);
|
||||
}
|
||||
|
||||
@override
|
||||
void onLocalTrackPublished(TrackPublishedResponse response) {
|
||||
var completer = pendingTrackResolvers.remove(response.cid);
|
||||
final completer = pendingTrackResolvers.remove(response.cid);
|
||||
completer?.complete(Future.value(response.track));
|
||||
}
|
||||
|
||||
@override
|
||||
void onActiveSpeakersChanged(List<SpeakerInfo> speakers) {
|
||||
onActiveSpeakerchangedCallback?.call(speakers);
|
||||
}
|
||||
|
||||
@override
|
||||
void onLeave(LeaveRequest req) {
|
||||
close();
|
||||
onDisconnected?.call();
|
||||
|
||||
+55
-54
@@ -46,30 +46,29 @@ class SignalClient {
|
||||
|
||||
SignalClient();
|
||||
|
||||
bool get connected => this._connected;
|
||||
bool get connected => _connected;
|
||||
|
||||
Future<void> join(String url, String token, JoinOptions? options) async {
|
||||
var rtcUrl = '$url/rtc';
|
||||
final rtcUrl = '$url/rtc';
|
||||
var params = _joinParams(token);
|
||||
if (options != null && options.autoSubscribe != null) {
|
||||
params += '&auto_subscribe=${options.autoSubscribe! ? '1' : '0'}';
|
||||
}
|
||||
|
||||
try {
|
||||
var ws = await platform.connectToWebSocket(Uri.parse(rtcUrl + params));
|
||||
ws.stream
|
||||
.listen(_handleMessage, onError: _handleError, onDone: _handleDone);
|
||||
final ws = await platform.connectToWebSocket(Uri.parse(rtcUrl + params));
|
||||
ws.stream.listen(_handleMessage, onError: _handleError, onDone: _handleDone);
|
||||
_ws = ws;
|
||||
} catch (e) {
|
||||
var completer = Completer();
|
||||
var validateUri = Uri.parse('http${rtcUrl.substring(2)}/validate$params');
|
||||
final completer = Completer<void>();
|
||||
final validateUri = Uri.parse('http${rtcUrl.substring(2)}/validate$params');
|
||||
http.get(validateUri).then((response) {
|
||||
if (response.statusCode != 200) {
|
||||
completer.completeError(ConnectError(response.body));
|
||||
} else {
|
||||
completer.completeError(ConnectError());
|
||||
}
|
||||
}).catchError((e) {
|
||||
}).catchError((dynamic e) {
|
||||
completer.completeError(ConnectError());
|
||||
});
|
||||
|
||||
@@ -85,53 +84,53 @@ class SignalClient {
|
||||
url += '/rtc';
|
||||
var params = _joinParams(token);
|
||||
params += '&reconnect=1';
|
||||
var uri = Uri.parse(url + params);
|
||||
final uri = Uri.parse(url + params);
|
||||
|
||||
var ws = await platform.connectToWebSocket(uri);
|
||||
final ws = await platform.connectToWebSocket(uri);
|
||||
_ws = ws;
|
||||
_connected = true;
|
||||
}
|
||||
|
||||
close() {
|
||||
this._connected = false;
|
||||
this._ws?.sink.close();
|
||||
void close() {
|
||||
_connected = false;
|
||||
_ws?.sink.close();
|
||||
}
|
||||
|
||||
sendOffer(RTCSessionDescription offer) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
void sendOffer(RTCSessionDescription offer) {
|
||||
_sendRequest(SignalRequest(
|
||||
offer: fromRTCSessionDescription(offer),
|
||||
));
|
||||
}
|
||||
|
||||
sendAnswer(RTCSessionDescription answer) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
void sendAnswer(RTCSessionDescription answer) {
|
||||
_sendRequest(SignalRequest(
|
||||
answer: fromRTCSessionDescription(answer),
|
||||
));
|
||||
}
|
||||
|
||||
sendIceCandidate(RTCIceCandidate candidate, SignalTarget target) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
trickle: new TrickleRequest(
|
||||
void sendIceCandidate(RTCIceCandidate candidate, SignalTarget target) {
|
||||
_sendRequest(SignalRequest(
|
||||
trickle: TrickleRequest(
|
||||
candidateInit: fromRTCIceCandidate(candidate),
|
||||
target: target,
|
||||
)));
|
||||
}
|
||||
|
||||
sendMuteTrack(String trackSid, bool muted) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
mute: new MuteTrackRequest(
|
||||
void sendMuteTrack(String trackSid, bool muted) {
|
||||
_sendRequest(SignalRequest(
|
||||
mute: MuteTrackRequest(
|
||||
sid: trackSid,
|
||||
muted: muted,
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
sendAddTrack(
|
||||
void sendAddTrack(
|
||||
{required String cid,
|
||||
required String name,
|
||||
required TrackType type,
|
||||
TrackDimension? dimension}) {
|
||||
var req = new AddTrackRequest(
|
||||
final req = AddTrackRequest(
|
||||
cid: cid,
|
||||
name: name,
|
||||
type: type,
|
||||
@@ -140,52 +139,52 @@ class SignalClient {
|
||||
req.width = dimension.width;
|
||||
req.height = dimension.height;
|
||||
}
|
||||
this._sendRequest(new SignalRequest(
|
||||
_sendRequest(SignalRequest(
|
||||
addTrack: req,
|
||||
));
|
||||
}
|
||||
|
||||
sendUpdateTrackSettings(UpdateTrackSettings settings) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
void sendUpdateTrackSettings(UpdateTrackSettings settings) {
|
||||
_sendRequest(SignalRequest(
|
||||
trackSetting: settings,
|
||||
));
|
||||
}
|
||||
|
||||
sendUpdateSubscription(UpdateSubscription subscription) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
void sendUpdateSubscription(UpdateSubscription subscription) {
|
||||
_sendRequest(SignalRequest(
|
||||
subscription: subscription,
|
||||
));
|
||||
}
|
||||
|
||||
sendSetSimulcastLayers(String trackSid, List<VideoQuality> layers) {
|
||||
this._sendRequest(new SignalRequest(
|
||||
simulcast: new SetSimulcastLayers(
|
||||
void sendSetSimulcastLayers(String trackSid, List<VideoQuality> layers) {
|
||||
_sendRequest(SignalRequest(
|
||||
simulcast: SetSimulcastLayers(
|
||||
trackSid: trackSid,
|
||||
layers: layers,
|
||||
)));
|
||||
}
|
||||
|
||||
sendLeave() {
|
||||
this._sendRequest(new SignalRequest(
|
||||
leave: new LeaveRequest(),
|
||||
void sendLeave() {
|
||||
_sendRequest(SignalRequest(
|
||||
leave: LeaveRequest(),
|
||||
));
|
||||
}
|
||||
|
||||
_sendRequest(SignalRequest req) {
|
||||
if (this._ws == null) {
|
||||
void _sendRequest(SignalRequest req) {
|
||||
if (_ws == null) {
|
||||
log('could not send message, not connected');
|
||||
return;
|
||||
}
|
||||
|
||||
var buf = req.writeToBuffer();
|
||||
this._ws?.sink.add(buf);
|
||||
final buf = req.writeToBuffer();
|
||||
_ws?.sink.add(buf);
|
||||
}
|
||||
|
||||
_handleMessage(dynamic message) {
|
||||
if (!(message is List<int>)) {
|
||||
void _handleMessage(dynamic message) {
|
||||
if (message is! List<int>) {
|
||||
return;
|
||||
}
|
||||
var msg = SignalResponse.fromBuffer(message);
|
||||
final msg = SignalResponse.fromBuffer(message);
|
||||
switch (msg.whichMessage()) {
|
||||
case SignalResponse_Message.join:
|
||||
if (!_connected) {
|
||||
@@ -200,8 +199,7 @@ class SignalClient {
|
||||
delegate?.onOffer(toRTCSessionDescription(msg.offer));
|
||||
break;
|
||||
case SignalResponse_Message.trickle:
|
||||
delegate?.onTrickle(
|
||||
toRTCIceCandidate(msg.trickle.candidateInit), msg.trickle.target);
|
||||
delegate?.onTrickle(toRTCIceCandidate(msg.trickle.candidateInit), msg.trickle.target);
|
||||
break;
|
||||
case SignalResponse_Message.update:
|
||||
delegate?.onParticipantUpdate(msg.update.participants);
|
||||
@@ -216,15 +214,15 @@ class SignalClient {
|
||||
delegate?.onLeave(msg.leave);
|
||||
break;
|
||||
default:
|
||||
log('unsupported message: ' + jsonEncode(msg));
|
||||
log('unsupported message: ' + json.encode(msg));
|
||||
}
|
||||
}
|
||||
|
||||
_handleError(Object error) {
|
||||
void _handleError(Object error) {
|
||||
logger.warning('received websocket error $error');
|
||||
}
|
||||
|
||||
_handleDone() {
|
||||
void _handleDone() {
|
||||
if (!_connected) {
|
||||
return;
|
||||
}
|
||||
@@ -239,19 +237,22 @@ String _joinParams(String token) {
|
||||
}
|
||||
|
||||
RTCSessionDescription toRTCSessionDescription(SessionDescription sd) {
|
||||
return new RTCSessionDescription(sd.sdp, sd.type);
|
||||
return RTCSessionDescription(sd.sdp, sd.type);
|
||||
}
|
||||
|
||||
SessionDescription fromRTCSessionDescription(RTCSessionDescription rsd) {
|
||||
return new SessionDescription(type: rsd.type, sdp: rsd.sdp);
|
||||
return SessionDescription(type: rsd.type, sdp: rsd.sdp);
|
||||
}
|
||||
|
||||
RTCIceCandidate toRTCIceCandidate(String candidateInit) {
|
||||
var candInit = jsonDecode(candidateInit);
|
||||
return new RTCIceCandidate(
|
||||
candInit['candidate'], candInit['sdpMid'], candInit['sdpMLineIndex']);
|
||||
final candInit = json.decode(candidateInit) as Map<String, dynamic>;
|
||||
return RTCIceCandidate(
|
||||
candInit['candidate'] as String?,
|
||||
candInit['sdpMid'] as String?,
|
||||
candInit['sdpMLineIndex'] as int?,
|
||||
);
|
||||
}
|
||||
|
||||
String fromRTCIceCandidate(RTCIceCandidate candidate) {
|
||||
return jsonEncode(candidate.toMap());
|
||||
return json.encode(candidate.toMap());
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ const audioContainerId = 'livekit_audio_container';
|
||||
const audioPrefix = 'livekit_audio_';
|
||||
|
||||
void startAudio(String id, MediaStreamTrack track) {
|
||||
if (!(track is MediaStreamTrackWeb)) {
|
||||
if (track is! MediaStreamTrackWeb) {
|
||||
return;
|
||||
}
|
||||
var elementId = audioPrefix + id;
|
||||
final elementId = audioPrefix + id;
|
||||
var audioElement = html.document.getElementById(elementId);
|
||||
if (audioElement == null) {
|
||||
audioElement = html.AudioElement()
|
||||
@@ -21,16 +21,16 @@ void startAudio(String id, MediaStreamTrack track) {
|
||||
findOrCreateAudioContainer().append(audioElement);
|
||||
}
|
||||
|
||||
if (!(audioElement is html.AudioElement)) {
|
||||
if (audioElement is! html.AudioElement) {
|
||||
return;
|
||||
}
|
||||
var audioStream = html.MediaStream();
|
||||
final audioStream = html.MediaStream();
|
||||
audioStream.addTrack(track.jsTrack);
|
||||
audioElement.srcObject = audioStream;
|
||||
}
|
||||
|
||||
void stopAudio(String id) {
|
||||
var audioElement = html.document.getElementById(audioPrefix + id);
|
||||
final audioElement = html.document.getElementById(audioPrefix + id);
|
||||
if (audioElement != null) {
|
||||
if (audioElement is html.AudioElement) {
|
||||
audioElement.srcObject = null;
|
||||
|
||||
@@ -13,14 +13,14 @@ class AudioTrack extends Track {
|
||||
|
||||
/// Start playing audio track. On web platform, create an audio element and
|
||||
/// start playback
|
||||
start() {
|
||||
if (!(this is LocalAudioTrack)) {
|
||||
void start() {
|
||||
if (this is! LocalAudioTrack) {
|
||||
audio.startAudio(getCid(), mediaTrack);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
stop() {
|
||||
void stop() {
|
||||
mediaStream?.dispose();
|
||||
mediaStream = null;
|
||||
audio.stopAudio(getCid());
|
||||
|
||||
@@ -9,19 +9,18 @@ class LocalAudioTrack extends AudioTrack {
|
||||
: super(name, track, stream);
|
||||
|
||||
/// Creates a new audio track from the default audio input device.
|
||||
static Future<LocalAudioTrack> createTrack(
|
||||
[LocalAudioTrackOptions? options]) async {
|
||||
static Future<LocalAudioTrack> createTrack([LocalAudioTrackOptions? options]) async {
|
||||
try {
|
||||
var stream = await navigator.mediaDevices.getUserMedia({
|
||||
"audio": true,
|
||||
"video": false,
|
||||
final stream = await navigator.mediaDevices.getUserMedia(<String, dynamic>{
|
||||
'audio': true,
|
||||
'video': false,
|
||||
});
|
||||
|
||||
if (stream.getAudioTracks().length == 0) {
|
||||
if (stream.getAudioTracks().isEmpty) {
|
||||
return Future.error(TrackCreateError());
|
||||
}
|
||||
|
||||
return LocalAudioTrack("", stream.getAudioTracks().first, stream);
|
||||
return LocalAudioTrack('', stream.getAudioTracks().first, stream);
|
||||
} catch (e) {
|
||||
return Future.error(e);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ import 'track.dart';
|
||||
import 'track_publication.dart';
|
||||
|
||||
class LocalTrackPublication extends TrackPublication {
|
||||
LocalParticipant _participant;
|
||||
final LocalParticipant _participant;
|
||||
|
||||
LocalTrackPublication(TrackInfo info, Track track, this._participant)
|
||||
: super.fromInfo(info) {
|
||||
LocalTrackPublication(TrackInfo info, Track track, this._participant) : super.fromInfo(info) {
|
||||
this.track = track;
|
||||
}
|
||||
|
||||
/// Mute or unmute the current track. When muted, track will stop sending data
|
||||
@override
|
||||
set muted(bool val) {
|
||||
if (val == muted) {
|
||||
return;
|
||||
|
||||
@@ -13,15 +13,12 @@ class LocalVideoTrack extends VideoTrack {
|
||||
: super(name, mediaTrack, stream);
|
||||
|
||||
/// Creates a LocalVideoTrack from camera input.
|
||||
static Future<LocalVideoTrack> createCameraTrack(
|
||||
[LocalVideoTrackOptions? options]) async {
|
||||
if (options == null) {
|
||||
options = LocalVideoTrackOptions(params: VideoPresets.qhd);
|
||||
}
|
||||
static Future<LocalVideoTrack> createCameraTrack([LocalVideoTrackOptions? options]) async {
|
||||
options ??= LocalVideoTrackOptions(params: VideoPresets.qhd);
|
||||
|
||||
try {
|
||||
var stream = await _createCameraStream(options);
|
||||
return LocalVideoTrack("camera", stream.getVideoTracks().first, stream);
|
||||
final stream = await _createCameraStream(options);
|
||||
return LocalVideoTrack('camera', stream.getVideoTracks().first, stream);
|
||||
} catch (e) {
|
||||
return Future.error(e);
|
||||
}
|
||||
@@ -34,13 +31,11 @@ class LocalVideoTrack extends VideoTrack {
|
||||
return Future.error(TrackCreateError('could not restart track'));
|
||||
}
|
||||
|
||||
if (options == null) {
|
||||
options = LocalVideoTrackOptions(params: VideoPresets.qhd);
|
||||
}
|
||||
options ??= LocalVideoTrackOptions(params: VideoPresets.qhd);
|
||||
|
||||
try {
|
||||
var stream = await _createCameraStream(options);
|
||||
var track = stream.getVideoTracks().first;
|
||||
final stream = await _createCameraStream(options);
|
||||
final track = stream.getVideoTracks().first;
|
||||
mediaStream = stream;
|
||||
await mediaTrack.stop();
|
||||
mediaTrack = track;
|
||||
@@ -50,19 +45,16 @@ class LocalVideoTrack extends VideoTrack {
|
||||
}
|
||||
}
|
||||
|
||||
static Future<MediaStream> _createCameraStream(
|
||||
LocalVideoTrackOptions? options) async {
|
||||
if (options == null) {
|
||||
options = LocalVideoTrackOptions(params: VideoPresets.qhd);
|
||||
}
|
||||
static Future<MediaStream> _createCameraStream(LocalVideoTrackOptions? options) async {
|
||||
options ??= LocalVideoTrackOptions(params: VideoPresets.qhd);
|
||||
|
||||
try {
|
||||
var stream = await navigator.mediaDevices.getUserMedia({
|
||||
"audio": false,
|
||||
"video": options.mediaConstraints,
|
||||
final stream = await navigator.mediaDevices.getUserMedia(<String, dynamic>{
|
||||
'audio': false,
|
||||
'video': options.mediaConstraints,
|
||||
});
|
||||
|
||||
if (stream.getVideoTracks().length == 0) {
|
||||
if (stream.getVideoTracks().isEmpty) {
|
||||
return Future.error(TrackCreateError());
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
/// Options when creating a LocalVideoTrack.
|
||||
class LocalVideoTrackOptions {
|
||||
CameraPosition position = CameraPosition.FRONT;
|
||||
CameraPosition position = CameraPosition.front;
|
||||
VideoParameter params;
|
||||
|
||||
LocalVideoTrackOptions({
|
||||
@@ -16,16 +16,16 @@ class LocalVideoTrackOptions {
|
||||
}
|
||||
|
||||
Map<String, dynamic> get mediaConstraints {
|
||||
return {
|
||||
"mandatory": params.mediaConstraints,
|
||||
"facingMode": position == CameraPosition.FRONT ? "user" : "environment",
|
||||
return <String, dynamic>{
|
||||
'mandatory': params.mediaConstraints,
|
||||
'facingMode': position == CameraPosition.front ? 'user' : 'environment',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
enum CameraPosition {
|
||||
FRONT,
|
||||
BACK,
|
||||
front,
|
||||
back,
|
||||
}
|
||||
|
||||
class VideoParameter {
|
||||
@@ -38,14 +38,14 @@ class VideoParameter {
|
||||
this.width,
|
||||
this.height,
|
||||
this.fps, {
|
||||
int? bitrate,
|
||||
}) : this.bitrate = bitrate;
|
||||
this.bitrate,
|
||||
});
|
||||
|
||||
Map<String, dynamic> get mediaConstraints {
|
||||
return {
|
||||
"minWidth": this.width,
|
||||
"minHeight": this.height,
|
||||
"minFrameRate": this.fps,
|
||||
return <String, dynamic>{
|
||||
'minWidth': width,
|
||||
'minHeight': height,
|
||||
'minFrameRate': fps,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'track_publication.dart';
|
||||
/// Represents a track publication from a RemoteParticipant. Provides methods to
|
||||
/// control if we should subscribe to the track, and its quality (for video).
|
||||
class RemoteTrackPublication extends TrackPublication {
|
||||
RemoteParticipant _participant;
|
||||
final RemoteParticipant _participant;
|
||||
bool _unsubscribed = false;
|
||||
bool _disabled = false;
|
||||
VideoQuality _videoQuality = VideoQuality.HIGH;
|
||||
@@ -26,6 +26,7 @@ class RemoteTrackPublication extends TrackPublication {
|
||||
_sendUpdateTrackSettings();
|
||||
}
|
||||
|
||||
@override
|
||||
bool get subscribed {
|
||||
if (_unsubscribed) {
|
||||
return false;
|
||||
@@ -41,6 +42,7 @@ class RemoteTrackPublication extends TrackPublication {
|
||||
|
||||
/// for internal use
|
||||
/// {@nodoc}
|
||||
@override
|
||||
set muted(bool val) {
|
||||
if (val == muted) {
|
||||
return;
|
||||
@@ -59,13 +61,12 @@ class RemoteTrackPublication extends TrackPublication {
|
||||
_participant.muteChanged();
|
||||
}
|
||||
|
||||
RemoteTrackPublication(TrackInfo info, this._participant, [Track? track])
|
||||
: super.fromInfo(info) {
|
||||
RemoteTrackPublication(TrackInfo info, this._participant, [Track? track]) : super.fromInfo(info) {
|
||||
this.track = track;
|
||||
}
|
||||
|
||||
_sendUpdateTrackSettings() {
|
||||
var settings = new UpdateTrackSettings(
|
||||
void _sendUpdateTrackSettings() {
|
||||
final settings = UpdateTrackSettings(
|
||||
trackSids: [sid],
|
||||
disabled: _disabled,
|
||||
);
|
||||
|
||||
@@ -12,7 +12,7 @@ class TrackDimension {
|
||||
|
||||
/// Wrapper around a MediaStreamTrack with additional metadata.
|
||||
class Track {
|
||||
static const ScreenShareName = "screen";
|
||||
static const screenShareName = 'screen';
|
||||
|
||||
String name;
|
||||
TrackType kind;
|
||||
@@ -38,19 +38,17 @@ class Track {
|
||||
}
|
||||
|
||||
String getCid() {
|
||||
var cid = _cid;
|
||||
var cid = _cid ?? mediaTrack.id;
|
||||
|
||||
if (cid == null) {
|
||||
cid = mediaTrack.id;
|
||||
}
|
||||
if (cid == null) {
|
||||
var uuid = Uuid();
|
||||
const uuid = Uuid();
|
||||
cid = uuid.v4();
|
||||
_cid = cid;
|
||||
}
|
||||
return cid;
|
||||
}
|
||||
|
||||
stop() {
|
||||
void stop() {
|
||||
mediaTrack.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,14 @@ class TrackPublication {
|
||||
updateFromInfo(info);
|
||||
}
|
||||
|
||||
/// True when the track is published with name [Track.ScreenShareName].
|
||||
bool get isScreenShare =>
|
||||
kind == TrackType.VIDEO && name == Track.ScreenShareName;
|
||||
/// True when the track is published with name [Track.screenShareName].
|
||||
bool get isScreenShare => kind == TrackType.VIDEO && name == Track.screenShareName;
|
||||
|
||||
updateFromInfo(TrackInfo info) {
|
||||
void updateFromInfo(TrackInfo info) {
|
||||
muted = info.muted;
|
||||
simulcasted = info.simulcast;
|
||||
if (info.type == TrackType.VIDEO) {
|
||||
dimension = new TrackDimension(info.width, info.height);
|
||||
dimension = TrackDimension(info.width, info.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ class PCTransport {
|
||||
}
|
||||
|
||||
Future<void> addIceCandidate(RTCIceCandidate candidate) async {
|
||||
var desc = await getRemoteDescription();
|
||||
final desc = await getRemoteDescription();
|
||||
if (desc != null && !restartingIce) {
|
||||
return pc.addCandidate(candidate);
|
||||
}
|
||||
|
||||
@@ -45,20 +45,20 @@ class _VideoTrackRendererState extends State<VideoTrackRenderer> {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
_trackChanged() {
|
||||
void _trackChanged() {
|
||||
setState(() {
|
||||
_renderer.srcObject = widget.track.mediaStream;
|
||||
});
|
||||
}
|
||||
|
||||
_initRenderer() async {
|
||||
void _initRenderer() async {
|
||||
await _renderer.initialize();
|
||||
_trackChanged();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var isLocal = widget.track is LocalVideoTrack;
|
||||
final isLocal = widget.track is LocalVideoTrack;
|
||||
return RTCVideoView(
|
||||
_renderer,
|
||||
mirror: isLocal,
|
||||
|
||||
+21
-7
@@ -83,6 +83,13 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -109,6 +116,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
lints:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: lints
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
logging:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -150,14 +164,14 @@ packages:
|
||||
name: path_provider_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.2"
|
||||
path_provider_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.0.2"
|
||||
path_provider_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -171,7 +185,7 @@ packages:
|
||||
name: path_provider_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "2.0.3"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -185,7 +199,7 @@ packages:
|
||||
name: platform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.2"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -199,7 +213,7 @@ packages:
|
||||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.2.1"
|
||||
version: "4.2.3"
|
||||
protobuf:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -302,7 +316,7 @@ packages:
|
||||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.5"
|
||||
version: "2.2.7"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -312,4 +326,4 @@ packages:
|
||||
version: "0.2.0"
|
||||
sdks:
|
||||
dart: ">=2.13.0 <3.0.0"
|
||||
flutter: ">=1.22.0"
|
||||
flutter: ">=2.0.0"
|
||||
|
||||
@@ -23,6 +23,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^1.0.4
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
Reference in New Issue
Block a user