aws / amazon-chime-sdk-js

A JavaScript client library for integrating multi-party communications powered by the Amazon Chime service.
Apache License 2.0
704 stars 475 forks source link

Fix a race condition when start and stop content share #2698

Closed ltrung closed 1 year ago

ltrung commented 1 year ago

Issue #2659 and #2535: Based on PR #2663. If calling startContentShare and then call stopContentShare or delete the media stream before the content attendee join the meeting, there will be an error logged in audioVideoDidStart event when the content attendee joins the meeting.

Credits to @kennyvallejodev for providing the fix #2663 😃

Cannot read properties of null (reading 'getVideoTracks')

Description of changes: Add an optional chaining to make sure the media stream still exists.

Testing:

Can these tested using a demo application? Please provide reproducible step-by-step instructions. Yes,

  1. Log in to the meeting demo
  2. Type in the developer console
    await app.meetingSession.audioVideo.startContentShareFromScreenCapture(); app.meetingSession.audioVideo.stopContentShare();
  3. Verify that there is no error in the console.

Checklist:

  1. Have you successfully run npm run build:release locally? Yes

  2. Do you add, modify, or delete public API definitions? If yes, has that been reviewed and approved? No

  3. Do you change the wire protocol, e.g. the request method? If yes, has that been reviewed and approved? No

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.