I'm using LiveKit client API createLocalScreenTracks to get screen stream but no share screen request window shown up and it keep giving me error when I try to publish the track. Here the environment I'm using and the code:
import {createLocalScreenTracks} from 'livekit-client';
...
//Create room
...
audioTrack = await createLocalAudioTrack({
echoCancellation: true,
noiseSuppression: true,
});
shareScreenTracks = await createLocalScreenTracks({ audio: false });
room.localParticipant.publishTrack(shareScreenTracks[0].mediaStreamTrack);
room.localParticipant.publishTrack(audioTrack);
The permission requests order does matter. After moving audio permission request to below share screen request, I can make my code work. The working code:
shareScreenTracks = await createLocalScreenTracks({ audio: false });
audioTrack = await createLocalAudioTrack({
echoCancellation: true,
noiseSuppression: true,
});
room.localParticipant.publishTrack(shareScreenTracks[0].mediaStreamTrack);
room.localParticipant.publishTrack(audioTrack);