toggleVideo method

bool toggleVideo()

Implementation

bool toggleVideo() {
  if (stream != null) {
    final videoTrack = stream!.getVideoTracks()[0];
    final bool videoEnabled = videoTrack.enabled = !videoTrack.enabled;
    this.videoEnabled = videoEnabled;

    sendMessage('video-toggle', {
      'userId': userId,
      'videoEnabled': videoEnabled,
    });
    emit('video-toggle', null, {
      'userId': userId,
      'videoEnabled': videoEnabled,
    });
    return videoEnabled;
  }
  return false;
}