Skip to content

Commit

Permalink
Merge pull request #5 from dyte-io/fix/pip
Browse files Browse the repository at this point in the history
fix: move pip controls to web-core
  • Loading branch information
ishita1805 authored Sep 25, 2024
2 parents 2a8330c + 1250d9a commit 6d20a06
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ export class DyteParticipantTile {
@Event() tileUnload: EventEmitter<Peer>;

private onVideoRef(el: HTMLVideoElement) {
this.videoEl = el;
if (this.isPreview || this.participant == null || this.meeting == null) {
if (this.isPreview || !this.participant || !this.meeting || this.videoEl === el) {
return;
}
this.participant && this.participant.registerVideoElement(el);

this.videoEl = el;
this.participant.registerVideoElement(this.videoEl);
this.tileLoad.emit({ participant: this.participant, videoElement: this.videoEl });
}

Expand Down
29 changes: 0 additions & 29 deletions packages/core/src/components/dyte-simple-grid/dyte-simple-grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { Size, States } from '../../types/props';
import { UIConfig } from '../../types/ui-config';
import { Dimensions, useGrid } from '../../lib/grid';
import ResizeObserver from 'resize-observer-polyfill';
import { getInitials } from '../../utils/string';
import { MediaConnectionState } from '@dytesdk/web-core';

/**
Expand Down Expand Up @@ -75,32 +74,6 @@ export class DyteSimpleGrid {
this.resizeObserver?.disconnect();
}

private onParticipantTileLoad = (
event: CustomEvent<{ participant: Peer; videoElement: HTMLVideoElement }>
) => {
if (!this.meeting) return;

const { participant, videoElement } = event.detail;
if (!participant || !videoElement) return;

this.meeting.participants.pip?.addSource(
participant.id,
videoElement,
participant.videoEnabled,
false,
participant.name ?? getInitials(participant.name)
);
if (participant.videoEnabled) {
this.meeting.participants.pip?.enableSource(participant.id);
}
};
private onParticipantTileUnload = (event: CustomEvent<Peer>) => {
if (!this.meeting) return;

const participant = event.detail;
this.meeting.participants.pip?.removeSource(participant.id);
};

render() {
const defaults = {
meeting: this.meeting,
Expand Down Expand Up @@ -138,8 +111,6 @@ export class DyteSimpleGrid {
},
key: participant.id,
'data-participant': participant.id,
onTileLoad: this.onParticipantTileLoad,
onTileUnload: this.onParticipantTileUnload,
mediaConnection: this.mediaConnection,
}}
childProps={{ participant }}
Expand Down

0 comments on commit 6d20a06

Please sign in to comment.