How odogono/video-operator-pads works
Main Components
• User Interface (Frontend):
• Pages (defined in src/app) and layouts (e.g., landing page, debug interface, player pages).
• Components for Video Playing (PlayerLocal, PlayerYT, LegacyPlayer), Pads, Sequencers (both StepSequencer and TimeSequencer), and Editing Panels.
• Common UI controls and modals (under src/components, e.g., Buttons, Controls, Modals, Tooltips).
• Application State and Business Logic:
• State management using stores and actions in the src/model/store directory.
• React Contexts and custom hooks (contained in src/hooks and src/contexts) for keyboard input, MIDI, drag-and-drop (usePadDnD), and project persistence.
• Helper functions and utilities (src/helpers) to perform tasks such as debouncing, canvas manipulations, and communication between components.
• Data Storage and Persistence:
• Local data persistence mechanisms: the use of IndexedDB or other browser-based storage, visible in src/model/db.
• Serialization and versioning of project data (see src/model/serialise and its versions).
• Integration with External Video Sources:
• Components for handling YouTube URLs (PlayerYT and associated helpers).
• Support for local mp4 files.
• Deployment / Containerization:
• Docker configurations (Dockerfile, Dockerfile-bun, docker_run.sh, etc.) which indicate how to containerize and deploy the application.
Relationships and Interactions
• The UI Layer interacts with the Application State Layer:
• For instance, UI components trigger events (touch, keyboard, MIDI) that are caught by hooks (located in src/hooks/useKeyboard, useMidi, etc.). These, in turn, update the state (stored in the model/store).
• The state and business logic then update the UI accordingly.
• The Application State Layer and Data Management:
• Actions (in src/model/store/actions) modify and persist data locally (e.g., project settings, video timings, sequencer events).
• Serialization modules handle exporting/importing project configurations.
• Integration Points:
• Video sources: the UI hands off video URLs or file references to the player components.
• Third-party libraries or external APIs (e.g., for YouTube integration) are encapsulated in helper functions.
• Deployment:
• Containerization scripts indicate that the same application codebase can be deployed to container environments.
Architectural Patterns and Design Principles
• Component-based architecture: The project leverages modular React components and reuses them across different sections (e.g., different kinds of players and controls).
• Separation of concerns: UI components, business logic, and data storage are clearly separated into different directories.
• Reactive state management: Custom hooks and React Context are used to reactively update the state and UI.
• Extensibility: With clearly defined modules and serialization versions, adding new features or editors is streamlined.