userSig:'userB_sig',// Fill in userSig corresponding to userId
roomId:6969
})
What is the main/sub video stream?
1. TRTC has a main video stream (main stream) and an sub video stream (sub stream).
2. The camera is published through the main stream, and the screen sharing is published through the sub stream.
3. The main video stream includes: big stream and small stream. By default, TRTC.startRemoteVideo plays the big stream, and the small stream can be played through the small parameter. Refer to: Optimize Multi-Person Video Calls.
Capturing system audio is only supported by Chromium based browser M74+, such as Chrome, Edge, Opera.
OS
System Audio
Tab Audio
Windows
Yes
Yes
MacOS
No
Yes
Linux
No
Yes
Non-Chromium based browser, such as Safari, Firefox
No
No
Check Share audio in the pop-up dialog box, and the system audio will be mixed with the local microphone and published. Other users in the room will receive the TRTC.EVENT.REMOTE_AUDIO_AVALIABLE event.
In addition, users may also stop screen sharing through the browser's own button, SDK will stop screen sharing when user click the Stop Button. You can listen for the TRTC.EVENT.SCREEN_SHARE_STOPPED event.
// Listen for local screen sharing stop event
trtcA.on(TRTC.EVENT.SCREEN_SHARE_STOPPED,()=>{
console.log('screen sharing was stopped');
});
FAQ
1. Safari screen sharing error getDisplayMedia must be called from a user gesture handler
This is because Safari restricts the getDisplayMedia screen capture interface, which must be called within 1 second of the callback function of the user click event.
// It is recommended to execute the collection logic first when onClick is executed
await trtcA.startScreenShare();
await trtcA.enterRoom({
roomId:123123,
sdkAppId:140000000,// Fill in your sdkAppId
userId:'userA',// Fill in your userId
userSig:'userA_sig',// Fill in userSig corresponding to userId
});
}
// bad
asyncfunctiononClick(){
await trtcA.enterRoom({
roomId:123123,
sdkAppId:140000000,// Fill in your sdkAppId
userId:'userA',// Fill in your userId
userSig:'userA_sig',// Fill in userSig corresponding to userId
});
// Entering the room may take more than 1s, and the collection may fail
await trtcA.startScreenShare();
}
2. Mac Chrome screen sharing fails with the error message "NotAllowedError: Permission denied by system" or "NotReadableError: Could not start video source" when screen recording is already authorized.