mobile v0.1 with deployment for ios (#191)
* stage 1: project init * stage 2: skeleton with navigation * step 2.5: streams list * step 4: stream playback experience * step 5-6: compose experience * fix: broken record * transcode media particles to mp4 * build: reproducible go generate * build: rename skaffold module for particle processor worker * infra: increase particle processor worker resources Was dealing with OOM errors * tweaks to mobile * log transcode work * view on desktop placeholder * tweak padding * cap video resolution to save on memory * infra: bump memory limits as insurance * ux improvements * update bundle id for mobile * config for mobile
This commit was merged in pull request #191.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
/**
|
||||
* Single source of truth for "is stream playback paused." Each component that
|
||||
* wants to pause playback registers a unique id via `useSuspendPlayback`; the
|
||||
* label is for devtools only. Playback is paused while any id is registered.
|
||||
*/
|
||||
interface PlaybackPauseState {
|
||||
activeIds: Record<string, string>;
|
||||
composing: boolean;
|
||||
add: (id: string, label: string) => void;
|
||||
remove: (id: string) => void;
|
||||
setComposing: (composing: boolean) => void;
|
||||
}
|
||||
|
||||
export const usePlaybackPauseStore = create<PlaybackPauseState>((set) => ({
|
||||
activeIds: {},
|
||||
composing: false,
|
||||
add: (id, label) =>
|
||||
set((s) => ({ activeIds: { ...s.activeIds, [id]: label } })),
|
||||
remove: (id) =>
|
||||
set((s) => {
|
||||
if (!(id in s.activeIds)) return s;
|
||||
const { [id]: _, ...rest } = s.activeIds;
|
||||
return { activeIds: rest };
|
||||
}),
|
||||
setComposing: (composing) => set({ composing }),
|
||||
}));
|
||||
|
||||
export const selectIsPaused = (s: PlaybackPauseState) =>
|
||||
Object.keys(s.activeIds).length > 0 || s.composing;
|
||||
|
||||
export const selectIsComposing = (s: PlaybackPauseState) => s.composing;
|
||||
Reference in New Issue
Block a user