# volcengine/vevoddemo-android architecture

> Architecture diagram of the GitHub repository volcengine/vevoddemo-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/volcengine/vevoddemo-android
- Repository: https://github.com/volcengine/vevoddemo-android

## Overview

This project is an Android demo application called VEVodDemo-android, which demonstrates how to integrate and use the VolcEngine Video on Demand SDK on Android. The purpose of the project is to showcase various playback scenes – including short dramas, short videos (similar to TikTok), feed videos (similar to content feeds on video apps), and long videos (like traditional streaming of movies/series) – by providing prebuilt UI components and encapsulated playback functionality. The solution is modular with clear separations for business logic, scene/UI controls, and the underlying playback and settings components.

##### Main Components
- App Shell: The “app” module is the main Android application that serves as the entry point.
- Business/Demo Layer: The “vod-demo” and “vod-demo-api” modules represent the business logic/demonstration layer that interacts with UI components and data sources.
- Scene Control Layer: The “vod-scenekit” module contains all UI components and scene controls for different video scenes (e.g., ShortVideoSceneView, FeedVideoSceneView). It encapsulates common behaviors like pull-to-refresh and load-more.
- Playback Control Layer: The “vod-playerkit” module is split into submodules:
- “vod-player”: Defines core player interfaces, media sources, playback controllers, video views and layers.
- “vod-player-volcengine”: Provides the actual implementation using the VolcEngine playback core, including initialization, factory methods, and configuration settings.
- Settings Layer: The “vod-settingskit” module handles playback settings and configuration UI.
- External Integration: Although not a separate module, note that the demo requires an externally provided AppId and License – typically set in the application’s App.java.

##### Relationships and Interactions
- The App Shell launches and orchestrates navigation between different demo scenes.
- The Demo Layer (vod-demo and vod-demo-api) interacts with the Scene Control layer (vod-scenekit) by providing API data and receiving user interactions.
- The Scene Control layer internally utilizes the Playback Control layer (vod-playerkit) to render video content. For instance, page views from vod-scenekit integrate with the Player (from vod-player) and its VolcEngine-backed implementation.
- Playback settings from vod-settingskit can be applied to the underlying player (moving through both the UI and the playback engine).

##### Architectural Patterns and Design Principles
- Modularity: The project is organized into clearly separated modules (business/demo, scene controls, playback engine, and settings), favoring a component-based or micro-modular architecture.
- Layered Architecture: There is a separation of concerns between UI scenes (scene kit), business logic (demo layer), and low-level playback implementation (player kit and its VolcEngine integration).
- Dependency Inversion: The demo code likely depends on external interfaces (e.g., vod-demo-api) rather than on internal implementation details, thus enabling easier swapping or extension of components.
- Encapsulation: Each module hides its internal complexities (e.g., playback configuration and scene control details) while exposing simple APIs for usage by higher layers.

##### Relevant Technologies, Frameworks, or Libraries
- Android ecosystem (using Gradle for builds, Android Studio as the IDE).
- Playback SDK integration (VolcEngine’s video playback core in vod-player-volcengine).
- Standard Android UI components (RecyclerView, ViewPager2) for rendering views in vod-scenekit.
- Testing frameworks indicated by the presence of androidTest and test directories.

##### Important Details
- Detail the flow: illustrate how the user interacts with scene components which then trigger playback through the player kit.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "App Layer"
        App["App Shell (Entry Point)"]:::appShell
    end

    subgraph "Business/Demo Layer"
        vodDemo["vod-demo (Demo Logic)"]:::businessLogic
        vodDemoApi{"vod-demo-api"}:::apiBoundary
    end

    subgraph "Scene Control Layer"
        vodSceneKit["vod-scenekit (UI Components)"]:::uiModule
    end

    subgraph "Playback Control Layer"
        vodPlayer["vod-player (Core Interfaces)"]:::coreEngine
        vodPlayerVolc["vod-player-volcengine (VolcEngine Implementation)"]:::coreEngine
    end

    subgraph "Settings Layer"
        vodSettings["vod-settingskit (Playback Settings)"]:::settingsModule
    end

    %% Connections
    App -->|"Navigation"| vodDemo
    App -->|"Init"| vodDemoApi
    vodDemo -->|"DataAPICall"| vodSceneKit
    vodDemoApi -->|"DataAPICall"| vodSceneKit
    vodSceneKit -->|"UIIntegration"| vodPlayer
    vodPlayer -->|"Implements"| vodPlayerVolc
    vodSettings -->|"Configuration"| vodPlayer

    %% Click Events
    click App "https://github.com/volcengine/vevoddemo-android/blob/main/app/src/main/java/com/bytedance/volc/voddemo/App.java"
    click vodDemo "https://github.com/volcengine/vevoddemo-android/blob/main/vod-demo/src/main/java/com/bytedance/volc/voddemo/VodSDK.java"
    click vodDemoApi "https://github.com/volcengine/vevoddemo-android/blob/main/vod-demo-api/src/main/java/com/bytedance/volc/voddemo/api/VodDemoApiService.java"
    click vodSceneKit "https://github.com/volcengine/vevoddemo-android/tree/main/vod-scenekit/src/main/java/com/bytedance/volc/vod/scenekit"
    click vodPlayer "https://github.com/volcengine/vevoddemo-android/tree/main/vod-playerkit/vod-player/src/main/java/com/bytedance/playerkit/player"
    click vodPlayerVolc "https://github.com/volcengine/vevoddemo-android/tree/main/vod-playerkit/vod-player-volcengine/src/main/java/com/bytedance/playerkit/player/volcengine"
    click vodSettings "https://github.com/volcengine/vevoddemo-android/blob/main/vod-settingskit/src/main/java/com/bytedance/volc/vod/settingskit/Settings.java"

    %% Styles
    classDef appShell fill:#a7d8de,stroke:#333,stroke-width:2px;
    classDef businessLogic fill:#ffdd94,stroke:#333,stroke-width:2px;
    classDef apiBoundary fill:#f9c74f,stroke:#333,stroke-width:2px;
    classDef uiModule fill:#90be6d,stroke:#333,stroke-width:2px;
    classDef coreEngine fill:#f9844a,stroke:#333,stroke-width:2px;
    classDef settingsModule fill:#f94144,stroke:#333,stroke-width:2px;
```
