-
public final class LocalScreencastVideoTrack extends LocalVideoTrack
A video track that captures the screen for publishing.
Note: A foreground service is generally required for use. Use startForegroundService or start your own foreground service before starting the video track.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceLocalScreencastVideoTrack.Factorypublic final classLocalScreencastVideoTrack.MediaProjectionCallbackNeeded to deal with circular dependency.
public classLocalScreencastVideoTrack.Companion
-
Field Summary
Fields Modifier and Type Field Description private VideoCapturercapturerprivate VideoTrackrtcTrackprivate LocalVideoTrackOptionsoptionsprivate final Track.Dimensionsdimensionsprivate final EventListenable<TrackEvent>eventsprivate Stringnameprivate Track.Kindkindprivate Stringsidprivate Track.StreamStatestreamStateprivate Booleanenabledprivate Function1<RTCStatsCollectorCallback, Unit>statsGetterprivate final RTCThreadTokenrtcThreadToken
-
Constructor Summary
Constructors Constructor Description LocalScreencastVideoTrack(VideoCapturer capturer, VideoSource source, String name, LocalVideoTrackOptions options, VideoTrack rtcTrack, LocalScreencastVideoTrack.MediaProjectionCallback mediaProjectionCallback, PeerConnectionFactory peerConnectionFactory, Context context, EglBase eglBase, DefaultsManager defaultsManager, LocalVideoTrack.Factory videoTrackFactory, RTCThreadToken rtcThreadToken)
-
Method Summary
Modifier and Type Method Description final VideoCapturergetCapturer()final UnitsetCapturer(VideoCapturer capturer)VideoTrackgetRtcTrack()UnitsetRtcTrack(VideoTrack rtcTrack)final LocalVideoTrackOptionsgetOptions()final UnitsetOptions(@FlowObservable() LocalVideoTrackOptions options)final Track.DimensionsgetDimensions()final EventListenable<TrackEvent>getEvents()final StringgetName()final UnitsetName(String name)final Track.KindgetKind()final UnitsetKind(Track.Kind kind)final StringgetSid()final UnitsetSid(String sid)final Track.StreamStategetStreamState()final UnitsetStreamState(Track.StreamState streamState)final BooleangetEnabled()final UnitsetEnabled(Boolean enabled)final Function1<RTCStatsCollectorCallback, Unit>getStatsGetter()final UnitsetStatsGetter(Function1<RTCStatsCollectorCallback, Unit> statsGetter)final RTCThreadTokengetRtcThreadToken()UnitstartCapture()Starts the capturer with the capture params contained in options. final UnitstartForegroundService(Integer notificationId, Notification notification)A foreground service is generally required prior to startCapture for screen capture. Unitstop()Stops the track. -
Methods inherited from class io.livekit.android.room.track.LocalScreencastVideoTrack
addRenderer, dispose, removeRenderer, restartTrack, setDeviceId, stopCapture, switchCamera -
Methods inherited from class io.livekit.android.room.track.VideoTrack
getRTCStats, getRTCStats, start -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
LocalScreencastVideoTrack
LocalScreencastVideoTrack(VideoCapturer capturer, VideoSource source, String name, LocalVideoTrackOptions options, VideoTrack rtcTrack, LocalScreencastVideoTrack.MediaProjectionCallback mediaProjectionCallback, PeerConnectionFactory peerConnectionFactory, Context context, EglBase eglBase, DefaultsManager defaultsManager, LocalVideoTrack.Factory videoTrackFactory, RTCThreadToken rtcThreadToken)
-
-
Method Detail
-
getCapturer
final VideoCapturer getCapturer()
-
setCapturer
final Unit setCapturer(VideoCapturer capturer)
-
getRtcTrack
VideoTrack getRtcTrack()
-
setRtcTrack
Unit setRtcTrack(VideoTrack rtcTrack)
-
getOptions
@FlowObservable() final LocalVideoTrackOptions getOptions()
-
setOptions
final Unit setOptions(@FlowObservable() LocalVideoTrackOptions options)
-
getDimensions
final Track.Dimensions getDimensions()
-
getEvents
final EventListenable<TrackEvent> getEvents()
-
getKind
final Track.Kind getKind()
-
setKind
final Unit setKind(Track.Kind kind)
-
getStreamState
final Track.StreamState getStreamState()
-
setStreamState
final Unit setStreamState(Track.StreamState streamState)
-
getEnabled
final Boolean getEnabled()
-
setEnabled
final Unit setEnabled(Boolean enabled)
-
getStatsGetter
final Function1<RTCStatsCollectorCallback, Unit> getStatsGetter()
-
setStatsGetter
final Unit setStatsGetter(Function1<RTCStatsCollectorCallback, Unit> statsGetter)
-
getRtcThreadToken
final RTCThreadToken getRtcThreadToken()
-
startCapture
Unit startCapture()
-
startForegroundService
final Unit startForegroundService(Integer notificationId, Notification notification)
A foreground service is generally required prior to startCapture for screen capture. This method starts up a helper foreground service that only serves to display a notification while capturing. This foreground service will automatically stop upon the end of screen capture.
You may choose to use your own foreground service instead of this method, but it must be started prior to calling startCapture and kept running for the duration of the screen share.
Notes: If no notification is passed, a notification channel will be created and a default notification will be shown.
Beginning with Android 13, the Manifest.permission.POST_NOTIFICATIONS runtime permission is required to show notifications. The foreground service will work without the permission, but you must add the permission to your AndroidManifest.xml and request the permission at runtime if you wish for your notification to be shown.
- Parameters:
notificationId- The identifier for this notification as per NotificationManager.notify; must not be 0.notification- The notification to show.
-
-
-
-