# 7ds7/videojs-vjstranscribe architecture

> Architecture diagram of the GitHub repository 7ds7/videojs-vjstranscribe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/7ds7/videojs-vjstranscribe
- Repository: https://github.com/7ds7/videojs-vjstranscribe

## Overview

##### Component Breakdown

- Video Player Container
- Transcript Widget
- Control Components:
- Language Selector
- Search Field
- Download/Copy Buttons
- PiP (Picture-in-Picture) Controls

B. Core Plugin Logic (use rounded rectangles):
- Main Plugin Module (videojs-vjstranscribe.js)
- Feature Modules:
- Search Module
- Download Module
- Selector Module
- Widget Module

C. Integration Layer (use hexagons):
- VideoJS Core
- Text Track API
- Browser PiP API

##### Specific Implementation Details

Annotations showing:
- Configuration options flow
- Text track data flow
- DOM element creation paths
- Event handling paths

##### Plugin Architecture
- VideoJS Player
- ↓
- vjstranscribe Plugin
- ↓
- Feature Modules → UI Components

##### Data Flow
- Text Tracks → Widget Module → UI Display
- ↓
- Search/Download/PiP

##### Component Communication
- User Interface ↔ Feature Modules ↔ Core Plugin

##### Modular nature of the plugin with clear separation between
- UI components (defined by ID options)
- Feature modules (search, download, selector)
- Core functionality (transcript processing)

##### Configuration flow
- How options propagate from initialization
- How they affect component creation
- Default behaviors and overrides

##### Notes about
- CSS customization points
- DOM element creation logic
- Track handling mechanisms

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#a8d1f0,stroke:#2c3e50
    classDef core fill:#98FB98,stroke:#2c3e50
    classDef external fill:#FFA07A,stroke:#2c3e50
    classDef data fill:#D3D3D3,stroke:#2c3e50

    %% Frontend UI Components Section
    subgraph Frontend
        UI[Video Player Container]:::ui
        TW[Transcript Widget]:::ui
        Controls[Control Components]:::ui
        
        subgraph ControlElements
            LS[Language Selector]:::ui
            SF[Search Field]:::ui
            DB[Download/Copy Buttons]:::ui
            PiP[PiP Controls]:::ui
        end
        
        Controls --> LS
        Controls --> SF
        Controls --> DB
        Controls --> PiP
    end

    %% Core Plugin Logic Section
    subgraph CoreLogic
        MPM[Main Plugin Module]:::core
        
        subgraph FeatureModules
            SM[Search Module]:::core
            DM[Download Module]:::core
            SLM[Selector Module]:::core
            WM[Widget Module]:::core
        end
        
        MPM --> SM
        MPM --> DM
        MPM --> SLM
        MPM --> WM
    end

    %% Integration Layer Section
    subgraph Integration
        VJS[VideoJS Core]:::external
        TTA[Text Track API]:::external
        BPA[Browser PiP API]:::external
    end

    %% Connections
    VJS --> MPM
    TTA --> WM
    BPA --> PiP
    WM --> TW
    SM --> SF
    DM --> DB
    SLM --> LS

    %% Click Events
    click MPM "https://github.com/7Ds7/videojs-vjstranscribe/blob/main/src/videojs-vjstranscribe.js"
    click SM "https://github.com/7Ds7/videojs-vjstranscribe/blob/main/src/videojs-vjstranscribe-search.js"
    click DM "https://github.com/7Ds7/videojs-vjstranscribe/blob/main/src/videojs-vjstranscribe-download.js"
    click SLM "https://github.com/7Ds7/videojs-vjstranscribe/blob/main/src/videojs-vjstranscribe-selector.js"
    click WM "https://github.com/7Ds7/videojs-vjstranscribe/blob/main/src/videojs-vjstranscribe-widget.js"

    %% Legend
    subgraph Legend
        UI_L[UI Components]:::ui
        CORE_L[Core Components]:::core
        EXT_L[External Systems]:::external
        DATA_L[Data Flow]:::data
    end
```
