Pinning Users
The StreamVideo SDK has support for pinning users, both locally for the current user, and remotely for everyone in the call.
Every user can pin as many participants on the call as they want, and those users will be shown first in the list of participants for that user. Pinning someone for everyone in the call requires the pinForEveryone capability.
By default, the pinned users appear first on the participants array. The ones which are pinned remotely appear before the local ones. If there are several remotely pinned users, they are sorted by the pinning date (the most recent pins appear first). You can change this sorting behaviour with your own implementation.
Local pins
In order to pin a user locally, you should call the following method on the Call object:
try await call.pin(sessionId: "pinned_user_session_id")To unpin the user, you should use the unpin method:
try await call.unpin(sessionId: "pinned_user_session_id")Remote pins
If you want to pin a user for everyone in the call, you should use the following method:
let response = try await call.pinForEveryone(userId: "pinned_user_id", sessionId: "pinned_user_session_id")Similarly, to unpin a user, you should call the following method:
let response = try await call.unpinForEveryone(userId: "pinned_user_id", sessionId: "pinned_user_session_id")UI SDK support
By default, the UI components show a menu with these options (based on their permissions) when the user taps the options button (an ellipsis icon) in the top left corner of a participant's video feed. This is implemented in the VideoCallParticipantOptionsModifier, which the VideoCallParticipantModifier attaches to the video view.
If you want to change this behaviour, you should implement your own version of it (here, CustomVideoCallParticipantModifier is your own ViewModifier), by using the ViewFactory method makeVideoCallParticipantModifier:
func makeVideoCallParticipantModifier(
participant: CallParticipant,
call: Call?,
availableFrame: CGRect,
ratio: CGFloat,
showAllInfo: Bool
) -> some ViewModifier {
CustomVideoCallParticipantModifier(
participant: participant,
call: call,
availableFrame: availableFrame,
ratio: ratio,
showAllInfo: showAllInfo
)
}If you only want to hide the options menu, you can return the SDK's VideoCallParticipantModifier with decorations: [.speaking], which keeps the speaking indicator and leaves out the .options decoration.