videoTileWasRemoved() not being called after stopVideoInput() is called

282 Views Asked by At

When I call stopVideoInput() by clicking a button, on my side the video stops, but on the remote side the video just freezes instead of turning off completely. Using Chime SDK v3.

 videoTileDidUpdate(tileState: VideoTileState): void {
        const videoElementId = tileState.localTile ? "local-video" : "remote-video";
        const videoElement: HTMLVideoElement = this.domElement(videoElementId);
    
 

      if (videoElement) {
              console.info("binding video element: " + videoElementId);
              this._audioVideo.bindVideoElement(tileState.tileId, videoElement);
            } else {
              console.error(videoElementId + " video not found");
            }
          }
        
    
          videoTileWasRemoved(tileId: number) {
            console.log("videoTileWasRemoved...");
            this._audioVideo.unbindVideoElement(tileId);
          }
    

stopVideoInput is called here

          endCamera(): void {
            this.av.stopVideoInput();
          }
1

There are 1 best solutions below

0
On

When you call stopVideoInput, only videoTileDidUpdate will get called with the inactive tile state. Chime SDK is reusing the same local tile object when you restart it by calling startLocalVideoTile.

videoTileDidUpdate: tileState => {
   if (tileState.localTile) {
     // tileState.active will be false when you call stopLocalVideoTile
   }
}

videoTileWasRemoved gets invoked when you call removeLocalVideoTile. Chime SDK will remove the local video tile. Please review the "Stop sharing your video" example in: AWS Chime SDK - Video

Source: AWS Chime SKD GitHub