zijunchiang 906fa210e4 V1.4.8: 按现场日志复盘优化取址等待与远程日志(含 15 秒白等修复)
依据用户提供的 1.4.7 现场日志(21 行,5 次点歌全部成功)复盘出四点:

1. 【行为,最大】每次点歌白等 15 秒。
   日志里每首歌前都有一条「JS-BRIDGE 15s 未就绪」,紧跟着「NATIVE-SONG 取址成功 用时=3xx~7xxms」——
   即取址本身只要 0.3~0.7 秒,但用户从按下点歌到开始下载要等 15.7 秒。
   原因: 桥一旦不可用,SongApiClient 每次都仍等满 15 秒。
   修复: KtvJsBridge 新增「已判定不可用」状态(markUnavailable/isUnavailable),
   首次判定后后续点歌直接走原生通道;桥万一恢复(热更新重载成功)自动清除该状态。

2. 【日志去噪】持久状态只记一次。
   原来「15s 未就绪」按每次点歌一条 WARN 输出,一天几百条且无新增信息。
   现在只在状态首次变化时记一条 ERROR。

3. 【可定位】补上"为什么不可用"。
   旧日志里没有任何 KtvApi 未导出/WebView 初始化失败的行,说明 init 回调根本没触发。
   KtvJsBridge.init 增加 20 秒看门狗: onPageFinished 未回调时明确上报
   「初始化超时:onPageFinished 未回调或 KtvApi 未导出」;
   init 异常与 KtvApi 未导出也统一收敛到 markUnavailable。

4. 【上下文完整】启动关键行不再有 undefined。
   旧日志的 STORAGE 行 serverip/clientip/user/traceid 全是 undefined(记在设备上下文之前),
   而且 AppPaths.storageFacts() 会真实建目录、写探针、读 /proc/mounts —— 却跑在主线程。
   现在把 STORAGE 移入 reportDeviceBootInfo() 的后台线程、在 refreshLogDeviceContext()
   与 MiliLog.awaitServerIp() 之后上报: 上下文完整且不再阻塞主线程。

5. 【新增状态样本】每 6 小时一条 HEALTH(版本/在线/可用空间/曲库是否存在及大小/根目录)。
   日志此前只有事件没有状态样本,无法排查"随时间变化"的问题(空间变少、曲库丢失、长期离线)。

6. 【字段一致】「请求源=」不再为空: 走原生兜底时 JS 的 reportSongResult 不会触发,
   现在 SongUrlResolver 记录 lastHost,SongApiClient.lastSongSourceHost() 依次回退。

AGENTS.md 增补「写日志的五条约定」(只记一次/上下文完整/不做重活/可自我定位/状态样本+事件)。

版本 1.4.7(27) 到 1.4.8(28);签名证书不变。ktv_api.js 未改动,KTV_BRIDGE_API 仍为 8。
2026-09-26 20:38:52 +08:00

Maidong KTV Logo

Maidong KTV

A local karaoke application for Android TV and landscape song-selection devices

Remote Control · Song Discovery · Request Queue · Download Management · Stable Playback

Core Features

  • Full TV remote navigation with directional keys, confirmation, back, and long-press actions.
  • Consistent focus feedback for buttons, lists, cards, switches, and dialogs.
  • Home entries for charts, song titles, singers, frequently played songs, favorites, categories, and local songs.
  • Online and local search with language filters, paging, and initial-letter keyboard input.
  • Singer browsing with portrait tags and singer-specific song lists.
  • Song ordering, batch ordering, queue prioritization, favorites, and file management.
  • Real-time synchronization across queued, played, and downloaded song lists.
  • New requests join the end of the queue without interrupting the current requested song.
  • Automatic playback when requested songs are available, including smooth transitions from public playback.

Playback

  • IJK-based playback for local and downloaded songs.
  • Continuous playback while navigating between pages or switching between windowed and full-screen modes.
  • Play, pause, skip, replay, progress display, and seeking controls.
  • Original-vocal and accompaniment switching without changing the current play or pause state.
  • Synchronized playback state across windowed controls, full-screen controls, and status overlays.
  • Song title overlays, temporary mode prompts, and persistent pause indicators.
  • Video ratio, automatic full screen, audio-video synchronization, and public playback settings.
  • Maximum song volume and configurable original-vocal and accompaniment behavior.

Downloads And Data

  • Background downloads with progress, resume support, and automatic retry.
  • Automatic cleanup and retry after download or decryption failures.
  • Recognition, counting, and playback of downloaded local songs.
  • Segmented database download, verification, merge, and atomic update.
  • Directory creation, database scanning, and download startup only after storage permission is granted.
  • Local disk and USB song scanning, reserved storage settings, and automatic cleanup.
  • Unified Maidong KTV data storage to avoid conflicts with other applications.

Settings

  • Data settings for library updates, local scanning, reserved space, automatic cleanup, and database maintenance.
  • Playback settings for public playback, automatic full screen, video ratio, synchronization, and title overlays.
  • Sound settings for volume behavior, maximum song volume, original vocals, and accompaniment.
  • Interface settings for language, floating controls, carousel content, and song title overlays.
  • Dialog selections remain temporary until confirmed and provide clear remote-control focus feedback.

Interface And Interaction

  • Landscape TV layout optimized for long-distance viewing.
  • Consistent state and meaning across top, windowed, and full-screen playback controls.
  • Stable focus during list refreshes, paging, tab changes, and song ordering.
  • Focus changes color only and preserves each control's original dimensions, corners, and layout.
  • A consistent circular Maidong logo across the home screen, player, and application information.

Project Notice

This repository: https://gitea.kasugano.cn/zijunchiang/maidong-ktv

UI/feature framework credit: https://gitee.com/yangyachao-X/maidong-ktv

This repository reworks the upstream "Maidong KTV" UI and feature framework, and the core/data layer was rewritten with DSH (DeepSeek Harness): library sync, song-source integration, device auth, risk-control handling, remote logging, and ad blocking are all new implementations.

Highlights of the reworked data layer:

  • Library: synced exclusively from the official Muse service (mconn.cherryonline.cn mls-api/v1/sqlite/sync); the code host carries source only, no database files.
  • Song source: w.w345.my (i.php token → do.php playback URL) with fixed device identity and reproduced signing; ad/mismatched resources (e.g. wb66.cn/.../719.ts) are blocked and retried.
  • JS hot-update: app/src/main/assets/mobile/ktv_api.js, requires the KTV_BRIDGE_API: 7 marker.

Building

Requirements: JDK 17, Android SDK (compileSdk 35, minSdk 21, targetSdk 25), Gradle wrapper 8.13 (bundled).

cd maidong-ktv
export JAVA_HOME=/path/to/jdk-17
export ANDROID_HOME=/path/to/android-sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
./gradlew assembleRelease

The release signing config in app/build.gradle expects ../../ktv_keystore.jks (one level above the repo root) with alias ktv / password 123456; adjust paths or use signingConfigs.debug for a quick unsigned build. Output: app/build/outputs/apk/release/app-release.apk (dual ABI: armeabi-v7a + arm64-v8a). Install with adb install -r <apk>.

For non-commercial learning purposes only. Respect upstream copyright and song licensing.

S
Description
麦动KTV Android 项目源码(DSH 重写内核与数据源)
Readme
18 MiB
2026-10-18 11:41:38 +08:00
Languages
Kotlin 50.7%
Python 41.5%
Java 4.6%
JavaScript 2.7%
HTML 0.3%
Other 0.2%