Stream Control
start_stream
The start_stream
command restarts your local stream with previously active settings. This is particularly useful after a presentation has ended or when devices have been changed (refer to Device Manager for detailed information on device management).
Note that enabling screen sharing (screen = true
) automatically disables video (video = false
), as these options are mutually exclusive.
eyeson.send({
type: 'start_stream',
audio: true | false, // default: true
video: true | false, // default: true
screen: true | false, // default: false
virtualBackground: true | false, // default: false
audioPassthrough: true | false, // default: false
});
The parameter screen
is used to toggle between camera and screen sharing mode. When set to true
, it will initiate screen sharing. The optional surface
parameter allows you to pre-select specific screen sharing options:
null
: Uses the browser's default selection interface'monitor'
: Pre-selects entire screen sharing'window'
: Pre-selects application window sharing'browser'
: Pre-selects browser tab sharing
To determine if the surface selection feature is available in the current browser, use FeatureDetector.canChooseDisplaySurface()
. This can help you create an appropriate UI experience based on browser capabilities. For more detailed information about display surface options, refer to the Chrome Developer documentation.
eyeson.send({
type: 'start_stream',
audio: true | false, // set true to add microphone
screen: true,
surface: null | 'monitor' | 'window' | 'browser' // optional; used only if screen=true
});
change_stream
The change_stream
command allows you to modify your active stream by toggling audio, video, or screen sharing settings. This provides real-time control over your media streams without needing to restart them completely.
To avoid issues with some devices, you can use StreamHelpers to toggle audio.
eyeson.send({
type: 'change_stream',
audio: true | false,
video: true | false,
screen: true | false,
surface: null | 'monitor' | 'window' | 'browser' // optional; used only if screen=true
});
toggle_camera
The toggle_camera
command allows you to switch between front and rear cameras on mobile devices by changing the camera's facing mode. This is particularly useful for mobile applications where users may need to show their surroundings or switch to selfie mode during a call.
eyeson.send({
type: 'toggle_camera',
stream: localStream,
facingMode: 'user' | 'environment'
});
replace_stream
The replace_stream
command allows you to substitute the current stream with any custom MediaStream object. When processing the replacement, the system will automatically select the first audio track and/or first video track with a readyState
of "live". This provides flexibility for implementing custom media sources or specialized stream handling in your application.
eyeson.send({
type: 'replace_stream',
stream
});
change_screen_video
The change_screen_video
command allows you to change the screen selection during an active screen cam session. This enables users to switch between different screens, windows, or browser tabs without stopping the current screen sharing session. For comprehensive information about screen cam functionality and its applications, refer to our detailed guide.
eyeson.send({ type: 'change_screen_video' });