Skip to content

Commit

Permalink
Use pin and always show flags in importance ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
robintown committed Jun 7, 2024
1 parent b546a52 commit 289c1ef
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/state/CallViewModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,15 @@ export type WindowMode = "normal" | "full screen" | "pip";
* Sorting bins defining the order in which media tiles appear in the layout.
*/
enum SortingBin {
SelfStart,
SelfAlwaysShown,
Pinned,
Presenters,
Speakers,
VideoAndAudio,
Video,
Audio,
NoMedia,
SelfEnd,
SelfNotAlwaysShown,
}

class UserMedia {
Expand Down Expand Up @@ -410,10 +411,23 @@ export class CallViewModel extends ViewModel {
switchMap((ms) => {
const bins = ms.map((m) =>
combineLatest(
[m.speaker, m.presenter, m.vm.audioEnabled, m.vm.videoEnabled],
(speaker, presenter, audio, video) => {
[
m.speaker,
m.presenter,
m.vm.audioEnabled,
m.vm.videoEnabled,
m.vm instanceof LocalUserMediaViewModel
? m.vm.alwaysShow
: of(false),
m.vm instanceof RemoteUserMediaViewModel ? m.vm.pin : of(false),
],
(speaker, presenter, audio, video, alwaysShow, pin) => {
let bin: SortingBin;
if (m.vm.local) bin = SortingBin.SelfStart;
if (m.vm.local)
bin = alwaysShow
? SortingBin.SelfAlwaysShown
: SortingBin.SelfNotAlwaysShown;
else if (pin) bin = SortingBin.Pinned;
else if (presenter) bin = SortingBin.Presenters;
else if (speaker) bin = SortingBin.Speakers;
else if (video)
Expand Down
1 change: 1 addition & 0 deletions src/tile/GridTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ const RemoteUserMediaTile = forwardRef<
}
secondaryButton={
<button
data-enabled={pin}
aria-label={pin ? t("video_tile.unpin") : t("video_tile.pin")}
onClick={onChangePin}
>
Expand Down

0 comments on commit 289c1ef

Please sign in to comment.