Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

[RTC-226] Remove peers #29

Merged
merged 5 commits into from
May 26, 2023
Merged

[RTC-226] Remove peers #29

merged 5 commits into from
May 26, 2023

Conversation

LVala
Copy link
Member

@LVala LVala commented May 25, 2023

Removing peers to match changes in membrane_rtc_engine.
Introduces many breaking changes.
Additionally:

  • removed callbacks to MembraneWebRTC completely in favour of emitted events.

Matching PR in membrane_rtc_engine.

@LVala LVala self-assigned this May 25, 2023
@LVala LVala requested a review from Rados13 May 25, 2023 08:50

/**
* Called when peer was accepted. Triggered by {@link MembraneWebRTC.join}
* Called when endpoint is ready. Triggered by {@link MembraneWebRTC.connect}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Called when endpoint is ready. Triggered by {@link MembraneWebRTC.connect}
* Emitted when endpoint is ready. Triggered by {@link MembraneWebRTC.connect}

Comment on lines 255 to 257
* Emitted each time endpoint is removed, emitted both for the local endpoint and other endpoints.
*/
onPeerLeft?: (peer: Peer) => void;
endpointRemoved: (endpoint: Endpoint) => void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we have a proper event for a situation when the local endpoint is removed? Because with the current implementation, a client would have to store in his code what is its endpointId, which IMO is a little bit inconvenient.

});
this.sendMediaEvent(mediaEvent);
};

/**
* Updates the metadata for a specific track.
* @param trackId - trackId (generated in addTrack) of audio or video track.
* @param trackMetadata - Data about this track that other peers will receive upon joining.
* @param trackMetadata - Data about this track that other endppoint will receive upon being added.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param trackMetadata - Data about this track that other endppoint will receive upon being added.
* @param trackMetadata - Data about this track that other endpoint will receive upon being added.

@LVala LVala requested a review from Rados13 May 25, 2023 10:49

/**
* Called when peer was accepted. Triggered by {@link MembraneWebRTC.join}
* Emitted when endpoint of this peer is ready. Triggered by {@link MembraneWebRTC.connect}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be no peer phrases in this library.

@LVala LVala requested a review from mickel8 May 25, 2023 10:58
}

interface TrackContextCallbacks {
export interface TrackContextEvents {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not TS magician but using interface as "Enum" looks a little bit weird, or not really?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tough to say, although that's how it was done in jellyfish-ts-client.

}

/**
* Main class that is responsible for connecting to the RTC Engine, sending and receiving media.
*/
export class MembraneWebRTC extends (EventEmitter as new () => TypedEmitter<Required<Callbacks>>) {
export class MembraneWebRTC extends (EventEmitter as new () => TypedEmitter<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a good time to change this name to something new. WebRTCEndpoint comes to my mind 🤔

@LVala LVala merged commit b43c6cb into master May 26, 2023
@LVala LVala deleted the remove-peers branch May 26, 2023 08:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants