Send video dimensions to the server (#41)
This commit is contained in:
@@ -24,6 +24,11 @@ More Docs and guides are available at [https://docs.livekit.io](https://docs.liv
|
|||||||
|
|
||||||
🔴 = Not currently available (Possibly in the future)
|
🔴 = Not currently available (Possibly in the future)
|
||||||
|
|
||||||
|
|
||||||
|
## Example app
|
||||||
|
|
||||||
|
We built a multi-user conferencing app as an example in the [example/](example/) folder. You can join the same room from any supported LiveKit clients.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Include this package to your `pubspec.yaml`
|
Include this package to your `pubspec.yaml`
|
||||||
@@ -87,10 +92,6 @@ On M1 Macs, you will also need to install x86_64 version of FFI:
|
|||||||
sudo arch -x86_64 gem install ffi
|
sudo arch -x86_64 gem install ffi
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example app
|
|
||||||
|
|
||||||
We built a multi-user conferencing app as an example in the [example/](example/) folder. You can join the same room from any supported LiveKit clients.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Connecting to a room, publish video & audio
|
### Connecting to a room, publish video & audio
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
flutter_webrtc: eb68063546a533bb98f0fbcc7b54daf62edea4ed
|
flutter_webrtc: e5036305102877d6a3dc18b8754aaae71851cb27
|
||||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||||
livekit_client: b137f094e90d910cfa846b282ad41e0e4a6a029b
|
livekit_client: b137f094e90d910cfa846b282ad41e0e4a6a029b
|
||||||
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
|
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
|
||||||
|
|||||||
@@ -99,38 +99,42 @@ class LocalParticipant extends Participant {
|
|||||||
// Use defaultPublishOptions if options is null
|
// Use defaultPublishOptions if options is null
|
||||||
options = options ?? defaultVideoPublishOptions;
|
options = options ?? defaultVideoPublishOptions;
|
||||||
|
|
||||||
final trackInfo = await engine.addTrack(
|
|
||||||
cid: track.getCid(),
|
|
||||||
name: track.name,
|
|
||||||
kind: track.kind,
|
|
||||||
source: track.source.toPBType(),
|
|
||||||
);
|
|
||||||
|
|
||||||
logger.fine('publishVideoTrack addTrack response: ${trackInfo}');
|
|
||||||
|
|
||||||
await track.start();
|
|
||||||
|
|
||||||
// Video encodings and simulcasts
|
|
||||||
|
|
||||||
// use constraints passed to getUserMedia by default
|
// use constraints passed to getUserMedia by default
|
||||||
int? width = track.currentOptions.params.width;
|
int width = track.currentOptions.params.width;
|
||||||
int? height = track.currentOptions.params.height;
|
int height = track.currentOptions.params.height;
|
||||||
|
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
// getSettings() is only implemented for Web
|
// getSettings() is only implemented for Web
|
||||||
try {
|
try {
|
||||||
// try to use getSettings for more accurate resolution
|
// try to use getSettings for more accurate resolution
|
||||||
final settings = track.mediaStreamTrack.getSettings();
|
final settings = track.mediaStreamTrack.getSettings();
|
||||||
width = settings['width'] as int?;
|
if (settings['width'] is int) {
|
||||||
height = settings['height'] as int?;
|
width = settings['width'] as int;
|
||||||
|
}
|
||||||
|
if (settings['height'] is int) {
|
||||||
|
height = settings['height'] as int;
|
||||||
|
}
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
logger.warning('Failed to call `mediaStreamTrack.getSettings()`');
|
logger.warning('Failed to call `mediaStreamTrack.getSettings()`');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final trackInfo = await engine.addTrack(
|
||||||
|
cid: track.getCid(),
|
||||||
|
name: track.name,
|
||||||
|
kind: track.kind,
|
||||||
|
source: track.source.toPBType(),
|
||||||
|
dimension: TrackDimension(width, height),
|
||||||
|
);
|
||||||
|
|
||||||
|
logger.fine('publishVideoTrack addTrack response: ${trackInfo}');
|
||||||
|
|
||||||
|
await track.start();
|
||||||
|
|
||||||
logger.fine(
|
logger.fine(
|
||||||
'Compute encodings with resolution: ${width}x${height}, options: ${options}');
|
'Compute encodings with resolution: ${width}x${height}, options: ${options}');
|
||||||
|
|
||||||
|
// Video encodings and simulcasts
|
||||||
final encodings = Utils.computeVideoEncodings(
|
final encodings = Utils.computeVideoEncodings(
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
|
|||||||
Reference in New Issue
Block a user