Provides the mechanism for controlling the published screen-sharing stream.
In order to access the screen publisher, you will need to start screen
sharing first. By default, screen sharing doesn’t share audio.
In order to share audio from a browser tab, the user who shares
the screen must check the option “Share audio” in Chrome when the
screen/tab dialog selector shows up.
You can access the ScreenPublisher
object via the
screen
property of the Room
object, as follows:
await room.startScreensharing('screenSharingContainer');
const { screen } = room;
screen.on('stopped', () => {
console.log('The screen sharing has stopped');
});
screen.on('started', () => {
console.log('The screen sharing has started');
});
screen.on('audioLevelUpdated', (audioLevel) => {
console.log('Audio level: ', audioLevel);
});
Methods
Name | Description |
---|---|
(void)
enableVideo
()
|
Enables the video track. |
(void)
disableVideo
()
|
Disables the video track. |
(boolean)
isVideoEnabled
()
|
Returns true when the video track is enabled.
Otherwise it returns false .
|
(void)
enableAudio
()
|
Enables the audio track. |
(void)
disableAudio
()
|
Disables the audio track. |
(boolean)
isAudioEnabled
()
|
Returns true when the audio track is enabled.
Otherwise it returns false .
|
Events
Name | Description |
---|---|
audioLevelUpdated
|
Emits audioLevel (Number ). Dispatched periodically
by the screen publisher to indicate the audio level. This event is dispatched
up to 60 times per second, depending on the browser. The audioLevel
value is the audio level, from 0 to 1.0.
|
started
|
Dispatched when the screen publisher starts screen sharing. This event does not emit anything. |
stopped
|
Dispatched when the screen publisher stops screen sharing. This event does not emit anything. |