Class BackgroundModal

BackgroundModal - Component to manage background selection and manipulation in media streams.

This component allows users to choose, apply, and manipulate virtual backgrounds for media streams, leveraging MediaPipe’s Selfie Segmentation and MediaSoup functionalities.

BackgroundModal

<app-background-modal
[isVisible]="isModalVisible"
[parameters]="modalParameters"
position="topLeft"
backgroundColor="#f5f5f5"
(onClose)="handleModalClose()"
></app-background-modal>

Visibility state of the modal.

Parameters including settings and methods for media and background management.

The position of the modal, e.g., 'topLeft'.

Background color of the modal.

Callback function when the modal is closed.

ngOnInit - Initializes the modal component by updating properties based on parameters.

Implements

  • OnChanges
  • OnInit

Constructors

Methods

Properties

isVisible: boolean = false
parameters: BackgroundModalParameters = ...
position: string = 'topLeft'
backgroundColor: string = '#f5f5f5'
onClose: (() => void) = ...
defaultImagesContainerRef: ElementRef<any>
uploadImageInputRef: ElementRef<any>
backgroundCanvasRef: ElementRef<any>
videoPreviewRef: ElementRef<any>
captureVideoRef: ElementRef<any>
loadingOverlayRef: ElementRef<any>
applyBackgroundButtonRef: ElementRef<any>
saveBackgroundButtonRef: ElementRef<any>
faTimes: IconDefinition = faTimes

Icon used for closing the modal.

customImage: string = ''

Custom image URL for background.

selectedImage: string = ''

Selected image URL for background.

segmentVideo: null | MediaStream = null

Media stream for video segmentation.

selfieSegmentation: null | SelfieSegmentation = null

SelfieSegmentation instance.

pauseSegmentation: boolean = false

Pause state for segmentation.

processedStream: null | MediaStream = null

Processed media stream with applied background.

keepBackground: boolean = false

State to keep or reset background.

backgroundHasChanged: boolean = false
virtualStream: null | MediaStream = null
mainCanvas: HTMLCanvasElement
prevKeepBackground: boolean = false
appliedBackground: boolean = false
videoAlreadyOn: boolean = false
audioOnlyRoom: boolean = false
islevel: string = '0'
recordStarted: boolean = false
recordResumed: boolean = false
recordPaused: boolean = false
recordStopped: boolean = false
recordingMediaOptions: string = ''
vidCons: any = {}
frameRate: number = 5
targetResolution: string = '1280x720'
videoParams: ProducerOptions = {}
autoClickBackground: boolean = false
localStreamVideo: null | MediaStream = null
clonedStream: null | MediaStream = null
clonedTrack: null | MediaStreamTrack = null
updateCustomImage: ((value: string) => void)
updateSelectedImage: ((value: string) => void)
updateSegmentVideo: ((value: null | MediaStream) => void)
updateSelfieSegmentation: ((value: null | SelfieSegmentation) => void)
updatePauseSegmentation: ((value: boolean) => void)
updateProcessedStream: ((value: null | MediaStream) => void)
updateKeepBackground: ((value: boolean) => void)
updateBackgroundHasChanged: ((value: boolean) => void)
updateVirtualStream: ((value: null | MediaStream) => void)
updateMainCanvas: ((value: HTMLCanvasElement) => void)
updatePrevKeepBackground: ((value: boolean) => void)
updateAppliedBackground: ((value: boolean) => void)
updateVideoParams: ((value: ProducerOptions) => void)
updateAutoClickBackground: ((value: boolean) => void)
createSendTransport: CreateSendTransportType
connectSendTransportVideo: ConnectSendTransportVideoType
disconnectSendTransportVideo: DisconnectSendTransportVideoType
onScreenChanges: OnScreenChangesType
sleep: SleepType