android screenshare example and touch ups (#31)
This commit is contained in:
@@ -242,6 +242,10 @@ extension LocalParticipantTrackSourceExt on LocalParticipant {
|
||||
return setSourceEnabled(TrackSource.microphone, enabled);
|
||||
}
|
||||
|
||||
Future<void> setScreenShareEnabled(bool enabled) async {
|
||||
return setSourceEnabled(TrackSource.screenShareVideo, enabled);
|
||||
}
|
||||
|
||||
Future<void> setSourceEnabled(TrackSource source, bool enabled) async {
|
||||
final pub = getTrackPublicationBySource(source);
|
||||
if (pub != null) {
|
||||
@@ -261,8 +265,10 @@ extension LocalParticipantTrackSourceExt on LocalParticipant {
|
||||
} else if (source == TrackSource.microphone) {
|
||||
final track = await LocalAudioTrack.create();
|
||||
await publishAudioTrack(track);
|
||||
} else if (source == TrackSource.screenShareVideo) {
|
||||
final track = await LocalVideoTrack.createScreenTrack();
|
||||
await publishVideoTrack(track);
|
||||
}
|
||||
// TODO: Screen share
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ class LocalVideoTrack extends VideoTrack {
|
||||
);
|
||||
}
|
||||
|
||||
/// Creates a LocalVideoTrack from the display.
|
||||
///
|
||||
/// Note: Android requires a foreground service to be started prior to
|
||||
/// creating a screen track. Refer to the example app for an implementation.
|
||||
static Future<LocalVideoTrack> createScreenTrack([
|
||||
ScreenTrackOptions? options,
|
||||
]) async {
|
||||
|
||||
Reference in New Issue
Block a user