Skip to content
This repository was archived by the owner on Sep 19, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a4f90f1

Browse files
committedFeb 21, 2022
Add handle end_engine message
1 parent b3bf82b commit a4f90f1

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎assets/js/membraneWebRTC.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export class MembraneWebRTC {
296296

297297
case "peerLeft":
298298
peer = this.idToPeer.get(deserializedMediaEvent.data.peerId)!;
299-
if (peer.id === this.getPeerId()) return;
299+
if (peer === undefined || peer.id === this.getPeerId()) return;
300300
Array.from(peer.trackIdToMetadata.keys()).forEach((trackId) =>
301301
this.callbacks.onTrackRemoved?.(this.trackIdToTrack.get(trackId)!)
302302
);

‎lib/membrane_rtc_engine/engine.ex

+13
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,19 @@ defmodule Membrane.RTC.Engine do
444444
}}
445445
end
446446

447+
@impl true
448+
def handle_playing_to_prepared(ctx, state) do
449+
{actions, state} =
450+
state.peers
451+
|> Map.keys()
452+
|> Enum.reduce({[], state}, fn peer_id, {all_actions, state} ->
453+
{actions, state} = remove_peer(peer_id, ctx, state)
454+
{all_actions ++ actions, state}
455+
end)
456+
457+
{{:ok, actions}, state}
458+
end
459+
447460
@impl true
448461
@decorate trace("engine.other.register", include: [[:state, :id]])
449462
def handle_other({:register, pid}, _ctx, state) do

0 commit comments

Comments
 (0)