Your Single Radio – 单电台流媒体应用项目分析
Your Single Radio – 单电台流媒体应用
项目概述
Your Single Radio 是一个Android单电台流媒体应用程序,允许用户收听单个网络电台流媒体。应用具有现代化的UI设计,支持音频可视化、专辑封面显示和后台播放功能。
- 项目类型:Android移动应用
- 主要功能:
- 单电台流媒体播放
- 实时音频流处理
- 专辑封面自动获取
- 动态背景效果
- 推送通知
- 社交分享
- 多广告网络集成
- 离线模式支持
- 技术栈:
- 平台:Android (API 23-36)
- 语言:Java 17
- 媒体播放:Media3 ExoPlayer
- 网络:Retrofit + OkHttp
- 图片加载:Glide
- 推送:Firebase Cloud Messaging
- 广告:AdMob, Facebook Audience, Unity Ads等
模块结构
your-radio-app/
├── android_studio/
│ └── YourSingleRadio/
│ ├── app/
│ │ ├── src/
│ │ │ └── main/
│ │ │ ├── java/com/app/yoursingleradioapp/
│ │ │ │ ├── activities/ # 活动页面
│ │ │ │ ├── adapters/ # 适配器
│ │ │ │ ├── fragments/ # 碎片
│ │ │ │ ├── models/ # 数据模型
│ │ │ │ ├── services/ # 服务
│ │ │ │ ├── utils/ # 工具类
│ │ │ │ └── listeners/ # 监听器
│ │ │ ├── res/ # 资源文件
│ │ │ │ ├── layout/ # 布局文件
│ │ │ │ ├── drawable/ # 图片资源
│ │ │ │ ├── values/ # 值资源
│ │ │ │ └── ...
│ │ │ └── AndroidManifest.xml # 应用配置
│ │ ├── build.gradle # 模块构建配置
│ │ └── proguard-rules.pro # 代码混淆规则
│ ├── build.gradle # 项目构建配置
│ └── settings.gradle # 项目设置
├── config_json/
│ └── config.json # 应用配置文件
├── push_notification/
│ └── push_notification/ # PHP推送服务
│ ├── push.php # 推送脚本
│ └── functions.php # 功能函数
└── documentation/
└── documentation.html # 文档入口
核心业务逻辑
1. 音频播放流程
启动应用 → 加载配置 → 初始化ExoPlayer → 连接流媒体URL → 播放音频 → 显示元数据/专辑封面
2. 配置系统
应用通过远程JSON配置(config.json)管理:
- 电台信息(名称、流派、流媒体URL)
- 界面设置(背景图片、模糊效果)
- 广告配置(AdMob、Facebook等)
- 社交链接
3. 媒体元数据处理
- 实时获取流媒体元数据(歌曲信息)
- 自动下载专辑封面
- 动态背景颜色提取
4. 推送通知
- Firebase Cloud Messaging集成
- 远程推送控制
- PHP后端推送服务
核心代码分析
配置结构 (config.json)
{
"radio": [{
"radio_name": "Your Single Radio",
"radio_genre": "Entertainment",
"radio_url": "http://...",
"radio_image_url": "https://...",
"background_image_url": "https://...",
"blur_radio_background": "true",
"song_metadata": "true",
"image_album_art": "true",
"auto_play": "false"
}],
"settings": [{
"app_status": "1",
"privacy_policy_url": "...",
"more_apps_url": "..."
}],
"ads": [{
"ad_status": "1",
"ad_type": "admob",
"admob_banner_unit_id": "...",
"admob_interstitial_unit_id": "..."
}],
"socials": [...]
}
主要依赖 (build.gradle)
dependencies {
// Media3 ExoPlayer - 媒体播放
def media3_version = "1.8.0"
implementation "androidx.media3:media3-exoplayer:$media3_version"
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
implementation "androidx.media3:media3-exoplayer-rtsp:$media3_version"
implementation "androidx.media3:media3-exoplayer-dash:$media3_version"
// Firebase - 推送通知
implementation platform('com.google.firebase:firebase-bom:34.6.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-messaging'
// 网络请求
implementation 'com.squareup.retrofit2:retrofit:3.0.0'
implementation 'com.squareup.retrofit2:converter-gson:3.0.0'
// 图片加载
implementation 'com.github.bumptech.glide:glide:5.0.5'
// UI组件
implementation 'com.google.android.material:material:1.12.0'
}
推送服务 (push_notification/push.php)
分析时间:2026-03-10
版本:6.1.1