Skip to content

Conversation

bcherry
Copy link
Contributor

@bcherry bcherry commented Aug 20, 2024

This makes RoomScope more closely match other helpers by providing two ways to get the room - either through @EnvironmentObject or through a param.

It simplifies the use of multiple delegates on Room, such as with Krisp filtering, by allowing you to add them after room creation without adding extra custom views:

  RoomScope(url: ... 
                      token: ...,
                      connect: true,
                      enableCamera: true,
                      enableMicrophone: true) { room in
    room.add(delegate: krispProcessor)
    return VStack {
        ForEachParticipant { _ in
            VStack {
                ForEachTrack(filter: .video) { _ in
                    MyVideoView()
                }
            }
        }
    }
}

@bcherry bcherry requested a review from hiroshihorie August 20, 2024 20:12
@bcherry bcherry closed this Aug 20, 2024
@bcherry
Copy link
Contributor Author

bcherry commented Aug 20, 2024

@hiroshihorie digging in a little more i found it's cleaner to just pass a room (for Krisp), but I do think that RoomScope is a bit messy because all of its parameters aren't really stateful. If it's going to expose token, enableMicrophone, etc it needs to respond to changes to them but right now those are just initialization params only. We should consider reworking them as bindings - so enableMicrophone is directly connected through and toggling it on or off toggles mute, and token is listening so you can have it set to nil initially while it gets fetched, and the room will automatically connect when a value is set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant