BiliLive — Bilibili Live Streaming Viewer: Project Deep Dive

A Flutter-based Bilibili live streaming Android client. Forked from Simple Live, streamlined and optimized to focus exclusively on Bilibili live streaming, featuring category browsing, local favorites, and live room audio recording.

BiliLive — Bilibili Live Streaming Viewer: Project Deep Dive

Project: Flutter-based Bilibili live streaming Android client GitHub: BoooSAMA/dart_simple_live_bilibili Framework: Flutter 3.38 + Dart Upstream: xiaoyaocz/dart_simple_live (GPL-3.0) License: GPL-3.0


Table of Contents

  1. Project Overview
  2. Tech Stack
  3. Project Architecture
  4. Feature Details
  5. Core API & Data Flow
  6. v2.0 Refactoring Highlights
  7. v2.1 New Features
  8. Local Development & Build
  9. Comparison with the Original Project

1. Project Overview

One-Sentence Summary

BiliLive is an Android Bilibili live streaming viewer, streamlined and optimized from Simple Live, focused on delivering a clean and efficient Bilibili live browsing experience.

Project Background

The original project Simple Live is a multi-platform live streaming aggregation client supporting Bilibili, Huya, Douyu, Douyin, and more. This project was forked and heavily customized:

  • Removed multi-platform support (Huya, Douyu, Douyin, etc.)
  • Removed non-core features requiring a backend server (account login, synced follows)
  • Retained and optimized the core Bilibili live streaming experience
  • Added differentiated features like live room audio recording, pinned homepage categories, and local favorites

Core Goals

  • Provide a pure Bilibili live streaming browsing experience
  • Zero account dependency — all favorites and follows stored locally
  • Live room audio recording — save live audio as M4A files in real time
  • Optimized category browsing system — subcategory browsing and favorites
  • Overseas-friendly — bypass API endpoints that block overseas IPs

2. Tech Stack

CategoryTechnologyDescription
FrameworkFlutter 3.38Cross-platform UI (currently Android only)
LanguageDartApplication logic & UI
Live APIBilibili Live APIRoom info, danmaku, stream URLs
Local StorageHiveLightweight NoSQL local database
FFmpegffmpeg_kit_flutterLive audio recording engine
State ManagementGetXReactive state management
Platform ChannelMethodChannelFlutter ↔ Native communication

Key Dependencies

PackagePurpose
ffmpeg_kit_flutter_new_https_gplFFmpeg audio recording engine
file_pickerFile picker (recording storage path)
open_filexOpen files
share_plusFile sharing
hive / hive_flutterLocal data persistence
get (GetX)State management & routing
wakelock_plusPrevent device sleep

3. Project Architecture

Overall Structure

dart_simple_live_bilibili/
├── simple_live_core/                # Core library (Bilibili only)
│   ├── lib/src/
│   │   ├── bilibili/
│   │   │   ├── bilibili_site.dart         # Site registration
│   │   │   ├── bilibili_live_api.dart     # Bilibili live API wrapper
│   │   │   ├── bilibili_message.dart      # Danmaku/message protocol
│   │   │   └── models/                    # Data models
│   │   └── base/                          # Abstract base classes
│   └── pubspec.yaml

└── simple_live_app/                  # Flutter APP client
    ├── lib/
    │   ├── main.dart                        # App entry point
    │   ├── app.dart                         # App component
    │   ├── store/                           # GetX state management
    │   ├── pages/
    │   │   ├── home/                        # Home (recommendation + pinned tabs)
    │   │   ├── live_room/                   # Live room detail page
    │   │   ├── search/                      # Search page
    │   │   ├── follow/                      # Local favorites list
    │   │   ├── history/                     # Watch history
    │   │   └── settings/                    # Settings (including audio config)
    │   ├── widgets/                         # Reusable components
    │   └── utils/                           # Utility functions
    ├── android/
    └── pubspec.yaml

Architecture Layers

┌─────────────────────────────────────────────┐
│              UI Layer (Flutter Widgets)       │
│   Pages / Widgets / GetX Controllers          │
│   • Home recommendation + pinned tabs        │
│   • Live room (player + danmaku + recording)  │
│   • Search / Follow / History / Settings     │
└──────────────────┬──────────────────────────┘

┌──────────────────▼──────────────────────────┐
│          Business Logic Layer                │
│  • LiveRoomStore — room state management    │
│  • FollowStore — local favorites storage    │
│  • HistoryStore — watch history             │
│  • RecordingService — FFmpeg recording mgmt │
│  • SettingsStore — appearance/audio config  │
└──────────────────┬──────────────────────────┘

┌──────────────────▼──────────────────────────┐
│  simple_live_core (Bilibili API Layer)       │
│  • Room info API (base info / stream URL)   │
│  • Recommendation API (recommend / areas)    │
│  • Danmaku WebSocket protocol               │
│  • Search API                               │
└──────────────────┬──────────────────────────┘

┌──────────────────▼──────────────────────────┐
│          Native Layer / External Services    │
│  • FFmpeg (audio recording engine)          │
│  • Bilibili Live API (HTTP + WebSocket)     │
│  • Hive (local persistence)                 │
│  • Platform Channel communication           │
└──────────────────────────────────────────────┘

4. Feature Details

4.1 Live Room Browsing

FeatureDescription
Recommendation FeedHome recommendation tab, loads data immediately on startup
Category BrowsingTop category dropdown, expand to view subcategories
Subcategory DetailClick subcategory to enter detail page, fetch room list by area_id
Category FavoritesStar favorite subcategories, shown in “My Favorites” section
Pin Category to HomePin subcategories as home tabs for instant loading
SearchSearch live rooms and streamers
Profile PageView streamer info and room list

4.2 Live Playback

  • Multiple quality levels: Supports Bilibili’s available quality options
  • Danmaku display: WebSocket real-time danmaku with keyword blocking
  • Playback controls: Play/pause, fullscreen toggle

4.3 Local Features (No Account Needed)

All personal data stored locally, no Bilibili account required:

FeatureStorage Method
Follow/Favorite roomsHive local database
Watch historyHive local database
Category favoritesHive JSON serialization
Pinned category configHive persistence
Appearance settingsHive / SharedPreferences
Audio settingsHive / File system

4.4 Live Room Recording

See v2.1 New Features.

4.5 Sleep Timer

  • Set a timer to automatically stop playback or exit the app
  • Countdown display in the UI

5. Core API & Data Flow

5.1 API Endpoints

APIEndpointPurpose
RecommendationwebMain/getMoreRecListHome recommendation room list
Area room listroom/v1/area/getRoomListGet subcategory rooms by area_id
Room inforoom/v1/Room/get_infoGet basic room information
Stream URLroom/v1/Room/playUrlGet live stream URL
Searchlive/v1/room/searchSearch live rooms
Danmaku WebSocketbroadcastlv.chat.bilibili.comReal-time danmaku push

5.2 API Upgrade (v2.0)

v2.0 introduced significant API migration:

  • Recommendation: Migrated from second/getList and second/getListByArea to webMain/getMoreRecList (less IP blocking for overseas users)
  • Area rooms: Added getAreaRooms (room/v1/area/getRoomList), no WBI signature required, globally accessible, 30 rooms per page
  • Category matching: Three-level matching strategy (exact parent name → fuzzy parent name → fuzzy subcategory name) for improved accuracy

5.3 Image Loading Optimization

  • Cover image decoding resolution limit (cacheWidth: 400px)
  • Significantly reduced memory usage, fixed list scroll stutter

6. v2.0 Refactoring Highlights

6.1 Category Browsing System

Old issue: Category classification was not granular enough — no way to browse subcategory content directly.

New solution:

  1. Current category name displayed at top; click to open category picker
  2. Category picker supports expand/collapse for parent categories, showing all subcategories
  3. Click subcategory to enter a dedicated detail page using getAreaRooms API
  4. Subcategories can be starred as favorites, appearing in “My Favorites”

6.2 Local Favorites

Old issue: The original project removed the follow feature, requiring login.

New solution:

  1. Purely local favorites, persisted with Hive
  2. Restored “Follow” tab in bottom navigation
  3. Restored “Follow/Unfollow” button on live room detail page
  4. Follow list supports filtering (All / Live / Offline)
  5. Optimized cover image loading, reduced memory usage

6.3 Performance Optimization

  • Concurrency control: Fixed ConcurrentModificationError from concurrent loadData calls
  • Async safety: Generation counter prevents data corruption from async races
  • Image decoding: Cover image cacheWidth limited to 400px, greatly reducing memory
  • Kotlin upgrade: Upgraded to 2.3.21 for screen_brightness_android plugin compatibility

7. v2.1 New Features

7.1 Pinned Home Categories

  • Pin subcategories to home: Add a pin marker to any subcategory in the category picker, turning it into an independent home tab
  • Independent loading: Pinned subcategories load content automatically, pin icon shown in bottom menu
  • Persistence: Pin info saved to Hive via JSON serialization, auto-restored on restart
  • Unpin: Clear via bottom menu or settings page

7.2 Live Room Recording

Real-time live audio recording to M4A files:

FeatureDescription
Audio formatM4A (AAC encoding)
Recording engineFFmpeg -c:a copy stream copy, zero encoding loss
Recording controlStart/stop, recording duration in status bar
Accidental tap preventionConfirmation dialog on first recording, supports “Don’t show again”
Auto-reconnectFFmpeg -reconnect parameters for automatic reconnection
Save pathCustom directory via file picker, with write permission validation
File managementView recorded files list, share, open folder
LifecycleAuto-stop recording when switching rooms or exiting
Wake lockWakelock keeps device awake during recording

7.3 Home Loading Optimization

  • Immediate startup load: _initDefaultController triggers initial data request in onInit
  • Loading progress percentage: Refresh button shows current loading progress (e.g., 42%)
  • Custom tab preloading: Pinned subcategories participate in startup preloading, staggered 500ms apart to avoid high concurrency

8. Local Development & Build

8.1 Requirements

  • Flutter SDK: 3.38
  • Dart SDK: Included with Flutter

8.2 Build & Run

# Clone repository
git clone https://github.com/BoooSAMA/dart_simple_live_bilibili.git
cd dart_simple_live_bilibili

# Get dependencies
flutter pub get

# Run (connect Android device or start emulator)
flutter run

# Build APK
flutter build apk --release

Note: This project does not provide pre-built Release packages — you need to compile it yourself.

8.3 Project Structure

simple_live_core/          # Core library
  lib/src/bilibili/
    bilibili_site.dart         # Site registration & configuration
    bilibili_live_api.dart     # Bilibili live API wrapper
    bilibili_message.dart      # Danmaku WebSocket protocol

simple_live_app/           # Flutter APP
  lib/
    store/                     # GetX state management
    pages/                     # Pages
    widgets/                   # Components
    utils/                     # Utilities

9. Comparison with the Original Project

DimensionOriginal (xiaoyaocz/dart_simple_live)This Project (BoooSAMA/dart_simple_live_bilibili)
PlatformsBilibili + Huya + Douyu + Douyin etc.Bilibili only
Account systemLogin requiredPurely local, no login needed
Follow/FavoritesServer-syncedHive local storage
Category browsingBasic categoriesSubcategory details + favorites + pinned tabs
RecordingNonev2.1 FFmpeg recording
Code complexityHigh (multi-platform)Streamlined (Bilibili only)
Overseas compatibilitySome APIs blockedAlternative APIs, globally accessible
PerformanceBasicv2.0 greatly improved image loading & concurrency

Key Post-Fork Changes

  1. Removed multi-platform code: Kept only Bilibili-related code
  2. Removed account features: Login, follow sync, etc.
  3. Added local favorites: Hive-stored purely local favorites
  4. Category system overhaul: Subcategory browsing + favorites + home pinning
  5. API migration: Used overseas-friendly API endpoints
  6. Recording feature: FFmpeg audio recording

Appendix: Key File Index

FilePurpose
simple_live_core/lib/src/bilibili/bilibili_live_api.dartBilibili live API wrapper
simple_live_core/lib/src/bilibili/bilibili_message.dartDanmaku WebSocket protocol
simple_live_app/lib/pages/live_room/Live room detail (player + danmaku + recording)
simple_live_app/lib/pages/home/Home (recommendation + pinned tabs)
simple_live_app/lib/pages/follow/Local favorites list
simple_live_app/lib/store/GetX state management
92%
Flutter Dart Bilibili Live Streaming FFmpeg Android