Description
I am having an error when I call the mediaStream?.adjustRenderedVideoPosition() method. I called this method when the video element could not be found in the non-shared array buffer Video container. So instead of using the video element to render, I used the canvas element.
I would appreciate response ASAP. Thanks.
Browser Console Error
Object { type: "INVALID_PARAMETERS", reason: "userId is not correct" }
reason: "userId is not correct"
type: "INVALID_PARAMETERS"
Which Web Video SDK version?
1.9.5
Video SDK Code Snippets
Below is a snippet of the code used:
const startVideoWithCanvas = useCallback(async() => {
const startVideoOptions = { hd: true };
if (mediaStream?.isSupportVirtualBackground() && isBlur) {
Object.assign(startVideoOptions, { virtualBackground: { imageUrl: 'blur' } });
}
try {
await mediaStream?.startVideo(startVideoOptions).catch((err) => {
message.error('Die Videoaufnahme konnte nicht gestartet werden.');
setIsCameraDisabled(() => true);
console.log('217 could not start video');
});
} catch (error) {
console.log(error);
}
if (!mediaStream?.isSupportMultipleVideos()) {
console.log('selfVideoLayout', selfVideoLayout);
if(!visibleParticipants) {
return;
}
if(!videoRef)
{
return;
}
const index = visibleParticipants.findIndex(
(user) => user.userId === zmClient.getCurrentUserInfo().userId
);
if (index > selfVideoLayout.length - 1 || index < 0) {
return;
}
console.log('visibleParticipants userId', visibleParticipants[index].userId);
console.log('currentUserInfo userId', zmClient.getCurrentUserInfo().userId);
console.log('sessionInfo userId', zmClient.getSessionInfo().userId);
let dimension = selfVideoLayout[index];
const { width: w, height: h, x: _x, y: _y } = dimension;
const { height: canvasHeight } = canvasDimension;
let width = w;
let height = h;
let y = canvasHeight - _y - height;
let x = _x;
console.log('w, h, y, x', width, height, x, y);
try {
mediaStream?.adjustRenderedVideoPosition(
canvasElement,
zmClient.getSessionInfo().userId,
width,
height,
x,
y
).catch(err => {
console.log(err);
});
mediaStream?.renderVideo(
canvasElement,
zmClient.getCurrentUserInfo().userId,
width,
height,
_x,
y,
3
).then(() => {
console.log('Started video with x at ', _x);
}).catch((err) => {
console.log(err);
message.error('Die Videoaufnahme konnte nicht gestartet werden.');
setIsCameraDisabled(() => true);
console.log('201 could not start video');
});
} catch (error) {
console.log(error);
}
}
}, [canvasDimension, canvasElement, isBlur, mediaStream, selfVideoLayout, videoRef, visibleParticipants, zmClient]);
From the console logs above you would notice that the ids returned are the same. But the SDK API returns an error.