Skip to content

feat: internet radio player with presets, favorites and background playback - #123

Closed
danijar2000 wants to merge 1 commit into
AndyShaman:mainfrom
danijar2000:radio
Closed

feat: internet radio player with presets, favorites and background playback#123
danijar2000 wants to merge 1 commit into
AndyShaman:mainfrom
danijar2000:radio

Conversation

@danijar2000

Copy link
Copy Markdown
Contributor

Add an internet radio feature to BYDMate, available as a dedicated tab and as a compact player on the Dashboard.
Playback

  • RadioPlayerService: Media3/ExoPlayer foreground service with a media notification, audio focus handling and automatic reconnect on stream drop.
  • Survives screen-off and app backgrounding so audio keeps playing while driving. Stations
  • RadioPresets: 6 built-in stations seeded into the database on first run.
  • Users can add custom stations by URL; RadioUrlValidator rejects malformed and non-HTTP(S) input before it reaches the player.
  • RadioIconLoader fetches and caches station artwork. Data layer
  • RadioStationEntity + RadioStationDao, exposed through RadioRepository.
  • AppDatabase migration 18 -> 19 creates the radio_stations table; schema 19.json checked in. UI
  • New Radio screen and navigation entry (hidden while the feature is off).
  • Dashboard playback controls for the currently playing station.
  • Radio section in Settings with a master on/off toggle, disabled by default so existing users see no change until they opt in.
  • Strings localized for en, pt, zh and ru. Tests
  • Migration18to19Test, RadioRepositorySeedTest, RadioEnabledDefaultTest, RadioUrlValidatorTest.

@danijar2000
danijar2000 force-pushed the radio branch 2 times, most recently from 09a1c9f to 2a7efd1 Compare July 28, 2026 10:57
Add internet radio to BYDMate: a dedicated tab, a compact player on the
Dashboard and a cell on the floating widget. Off by default — existing users
see no change until they switch it on in Settings.

Playback
- RadioPlayerService is a Media3 MediaSessionService driving ExoPlayer.
  ExoPlayer rather than the framework MediaPlayer because most Russian
  stations serve HE-AAC (.aacp) mounts, which MediaPlayer fails to decode on
  DiLink — Radio Record and Русское Радио never started.
- The session gives the media notification and the head unit's own transport
  buttons (steering wheel, dashboard) for free; RadioController is the app's
  single handle on it.
- The whole station list is the player's playlist with repeat-all, so prev/next
  cycle stations and wrap at both ends.
- Bounded retry with backoff re-prepares a dropped stream instead of giving up,
  which is the normal case in a moving car.

Stations
- Eight built-ins seeded on first open: Европа Плюс, Love Radio, Хит FM,
  Radio Record, Ретро FM, Дорожное радио, Радио Шансон, Наше Радио.
- Logos for five of them are bundled as drawables, so a tile renders identically
  with no connectivity; the rest fall back to a colored monogram.
- Users can add a station by hand, or search the public directories:
  radio-browser.info (open, community-maintained) and Radio Record's own
  catalogue, queried in parallel and merged. A source that fails contributes
  nothing rather than failing the search.

Data saver
- Settings toggle plays built-in stations from a lighter mount where one exists;
  stations added from a directory carry their own low_bitrate_url.
- The swap happens at playback time and is never written to the database, so
  turning the setting off restores full bitrate with nothing to undo. A station
  the user re-pointed at their own stream is left alone.

Data layer
- RadioStationEntity + RadioStationDao behind RadioRepository.
- AppDatabase migration 18 -> 19 creates radio_stations; schema 19.json checked
  in. RadioUrlValidator rejects malformed and non-HTTP(S) input.

Tests
- Migration18to19Test, RadioRepositorySeedTest, RadioEnabledDefaultTest,
  RadioUrlValidatorTest, RadioTracksTest, RadioDirectoryParseTest.

Strings localized for en, pt, zh and ru.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@AndyShaman

Copy link
Copy Markdown
Owner

Данияр, посмотрел PR внимательно. Работа серьёзная - сервис на Media3, миграция базы, тесты, тумблер выключен по умолчанию. Видно, что делал вдумчиво, спасибо за такой вклад.

Но влить это в BYDMate я не готов, и дело не в качестве кода. Приложение - про данные машины и автоматизацию, я сознательно держу его в этих рамках: без стриминга, без внешних каталогов, без второй медиасистемы рядом со штатной. Радио тянет за собой ExoPlayer, аудиофокус рядом с голосовым агентом, поддержку потоков и логотипов - этот груз придётся нести годами, и он размывает то, за что люди ставят приложение.

Что предлагаю. Твоё радио отлично живёт отдельным приложением - а BYDMate уже умеет с ним дружить: запуск тапом по виджету, из автоматизаций, голосом, а с версии 3.9 его можно держать в трети экрана рядом с навигатором через разделение экрана. Оформи его самостоятельным APK - добавлю ссылку в README и в Благодарности. Такая связка полезнее пользователям, чем всё в одном.

PR закрою, но код не выбрасывай - как отдельное приложение это уже почти готовый продукт.

@AndyShaman AndyShaman closed this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants