OpenSight / janus-cloud

a cluster solution for Janus WebRTC server, by API proxy approach
GNU Affero General Public License v3.0
205 stars 49 forks source link

VideoRoom plugin issue #28

Closed liqiang-xxfy closed 2 years ago

liqiang-xxfy commented 2 years ago

VideoRoom plugin: Other people in the room cannot receive the “destroyed” message.

It can be received in Janus gateway.

jamken commented 2 years ago

according to the flowing code, janus-proxy should send the "destroyed" message to all participants when the room is destroyed.

   def destroy(self):
        if self._has_destroyed:
            return
        self._has_destroyed = True
        participants = self._participants.values()
        self._participants.clear()
        self._private_id.clear()
        # Notify all participants that the fun is over, and that they'll be kicked
        log.debug("Notifying all participants")
        destroyed_event = {
            'videoroom': 'destroyed',
            'room': self.room_id,
        }
        for publisher in participants:
            publisher.push_videoroom_event(destroyed_event)
            publisher.room = None    # already removed from room, no need to call back room's on_participant destroy()
            publisher.room_id = 0
            publisher.destroy()

I will check this case again, thanks

jamken commented 2 years ago

I have found the problem, the participants list become empty after self._participants.clear(). this is a bug, thanks for figure out