amazon-chime-sdk-js icon indicating copy to clipboard operation
amazon-chime-sdk-js copied to clipboard

Use MediaStream as an alternative to bindVideoElement

Open dathacky opened this issue 3 years ago • 9 comments

I have been using chime SDK for almost 1 year, I have a lot of problems using bindVideoElement(). In ReactJS, every time we render we always have to call the bindVideoElement() function again. This happens a lot because our UI changes frequently (grid layout, full screen, whiteboard,...), causing us to get a lot of video related errors if the UI renders but doesn't call bindVideoElement, so I have some suggestions below:

  • Observer will receive MediaStream without having to call the bindVideoElement() function, after having MediaStream, we can process and pass it to <//video> tag ourselves.
  • Can send to a MediaStream (camera + share screen) instead of calling functions (listAudioInputDevices, videoInputDevices, chooseVideoInputDevice)
  • I noticed that the promises of chooseAudioInputDevice and videoTileDidUpdate are not in sync. The chooseAudioInputDevice function returns a promise but videoTileDidUpdate triggers a long time later, causing our button On Camera state to not actually display correctly.
  • Please vote for this issue by adding a 👍 reaction to the issue. This will help the community and maintainers from the Amazon Chime SDK team to prioritize this request.
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.

dathacky avatar Jan 28 '22 08:01 dathacky

Observer will receive MediaStream without having to call the bindVideoElement() function, after having MediaStream, we can process and pass it to

Sorry pass it to what?

Can send to a MediaStream (camera + share screen) instead of calling functions (listAudioInputDevices, videoInputDevices, chooseVideoInputDevice)

I am not sure I follow this. Could you clarify? listVideoInputDevices and chooseVideoInputDevice are needed to get the stream from browsers.

I noticed that the promises of chooseAudioInputDevice and videoTileDidUpdate are not in sync. The chooseAudioInputDevice function returns a promise but videoTileDidUpdate triggers a long time later, causing our button On Camera state to not actually display correctly.

When there is a change in audio/video stream, we need to update the stream subscription in the backend and thus cause some delay to videoTileDidUpdate. It is something we could try to improve in the future. However, can you workaround by waiting for videoTileDidUpdate before update the camera state?

ltrung avatar Jan 28 '22 18:01 ltrung

Sorry pass it to what?

Sorry about that, i mean: pass it to <//video> tag.

dathacky avatar Feb 07 '22 02:02 dathacky

I am not sure I follow this. Could you clarify? listVideoInputDevices and chooseVideoInputDevice are needed to get the stream from browsers.

Similar to startContentShare but for camera, so I can use getUserMedia to get stream and send instead of listVideoInputDevices and chooseVideoInputDevice

https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia

dathacky avatar Feb 07 '22 02:02 dathacky

@dathacky listVideoInputDevices also just get the stream from getUserMedia. Could you provide more details on why you want to call it manually yourself?

ltrung avatar Feb 07 '22 20:02 ltrung

@ltrung I want to work with MediaStream completely like any other SDK, it makes it easier for me to develop and find bugs. I will also easily customize the stream by adding effects to change devices, filters, backgrounds.

dathacky avatar Feb 09 '22 03:02 dathacky

@dathacky Currently, there is no API to access the video stream directly but you could access via meetingSession.audioVideo.deviceController.activeDevices['video'].stream.

ltrung avatar Feb 09 '22 05:02 ltrung

Thanks, I hope in the future chime SDK can access video streams including remote

dathacky avatar Feb 09 '22 06:02 dathacky

@dathacky You can actually access the remote stream too from tileState.boundVideoStream in videoTileDidUpdate, you can just skip binding video element method.

ltrung avatar Feb 09 '22 07:02 ltrung

You can actually access the remote stream too from tileState.boundVideoStream in videoTileDidUpdate, you can just skip binding video element method.

Hi @ltrung, I'm using boundVideoStream as described above. Is it possible to also get the remote audio stream instead of binding an audio element?

evangeline avatar Apr 24 '23 21:04 evangeline