Improving naming

This commit is contained in:
David Négrier 2021-06-21 14:43:10 +02:00
parent 77a4d23301
commit a08f6a33ac
13 changed files with 46 additions and 50 deletions

View file

@ -2,7 +2,7 @@ import {get, writable} from "svelte/store";
import type {Box} from "../WebRtc/LayoutManager";
import {HtmlUtils} from "../WebRtc/HtmlUtils";
import {LayoutMode} from "../WebRtc/LayoutManager";
import {layoutModeStore} from "./LayoutStore";
import {layoutModeStore} from "./StreamableCollectionStore";
/**
* Tries to find the biggest available box of remaining space (this is a space where we can center the character)

View file

@ -24,14 +24,12 @@ function createPeerStore() {
return users;
});
}
console.log('CONNECT VIDEO', peers);
},
onDisconnect(userId: number) {
update(users => {
users.delete(userId);
return users;
});
console.log('DISCONNECT VIDEO', peers);
}
})
}

View file

@ -4,14 +4,14 @@ import { peerStore, screenSharingStreamStore} from "./PeerStore";
import type {RemotePeer} from "../WebRtc/SimplePeer";
import {LayoutMode} from "../WebRtc/LayoutManager";
export type DisplayableMedia = RemotePeer | ScreenSharingLocalMedia;
export type Streamable = RemotePeer | ScreenSharingLocalMedia;
export const layoutModeStore = writable<LayoutMode>(LayoutMode.Presentation);
/**
* A store that contains the layout of the streams
* A store that contains everything that can produce a stream (so the peers + the local screen sharing stream)
*/
function createLayoutStore(): Readable<Map<string, DisplayableMedia>> {
function createStreamableCollectionStore(): Readable<Map<string, Streamable>> {
return derived([
screenSharingStreamStore,
@ -23,9 +23,9 @@ function createLayoutStore(): Readable<Map<string, DisplayableMedia>> {
$screenSharingLocalMedia,
], set) => {
const peers = new Map<string, DisplayableMedia>();
const peers = new Map<string, Streamable>();
const addPeer = (peer: DisplayableMedia) => {
const addPeer = (peer: Streamable) => {
peers.set(peer.uniqueId, peer);
};
@ -40,4 +40,4 @@ function createLayoutStore(): Readable<Map<string, DisplayableMedia>> {
});
}
export const layoutStore = createLayoutStore();
export const streamableCollectionStore = createStreamableCollectionStore();

View file

@ -2,19 +2,19 @@ import {writable} from "svelte/store";
import type {RemotePeer, SimplePeer} from "../WebRtc/SimplePeer";
import {VideoPeer} from "../WebRtc/VideoPeer";
import {ScreenSharingPeer} from "../WebRtc/ScreenSharingPeer";
import type {DisplayableMedia} from "./LayoutStore";
import type {Streamable} from "./StreamableCollectionStore";
/**
* A store that contains the peer / media that has currently the "importance" focus.
*/
function createVideoFocusStore() {
const { subscribe, set, update } = writable<DisplayableMedia | null>(null);
const { subscribe, set, update } = writable<Streamable | null>(null);
let focusedMedia: DisplayableMedia | null = null;
let focusedMedia: Streamable | null = null;
return {
subscribe,
focus: (media: DisplayableMedia) => {
focus: (media: Streamable) => {
focusedMedia = media;
set(media);
},
@ -22,7 +22,7 @@ function createVideoFocusStore() {
focusedMedia = null;
set(null);
},
toggleFocus: (media: DisplayableMedia) => {
toggleFocus: (media: Streamable) => {
if (media !== focusedMedia) {
focusedMedia = media;
} else {