【问题标题】:How do I replace the JSON music file in Android UAMP from Android?如何从 Android 替换 Android UAMP 中的 JSON 音乐文件?
【发布时间】:2021-01-06 18:51:47
【问题描述】:

我是安卓新手。

我正在使用通用 Android 媒体播放器示例 code 作为另一个应用程序的基础,但我不知道如何更新默认音乐 JSON。

代码在 Kotlin 中。在确定 JSON 在哪里以及如何更新它方面的任何帮助将不胜感激?

【问题讨论】:

    标签: android json kotlin


    【解决方案1】:

    UAMP 示例代码使用external JSON file,格式如下:

    {
      "music": [
        {
          "id": "wake_up_01",
          "title": "Intro - The Way Of Waking Up (feat. Alan Watts)",
          "album": "Wake Up",
          "artist": "The Kyoto Connection",
          "genre": "Electronic",
          "source": "https://storage.googleapis.com/uamp/The_Kyoto_Connection_-_Wake_Up/01_-_Intro_-_The_Way_Of_Waking_Up_feat_Alan_Watts.mp3",
          "image": "https://storage.googleapis.com/uamp/The_Kyoto_Connection_-_Wake_Up/art.jpg",
          "trackNumber": 1,
          "totalTrackCount": 13,
          "duration": 90,
          "site": "http://freemusicarchive.org/music/The_Kyoto_Connection/Wake_Up_1957/"
        },
        ...
      ]
    }
    

    这个变量在MusicService.kt中声明

    private val remoteJsonSource: Uri = Uri.parse("https://storage.googleapis.com/uamp/catalog.json")
    

    【讨论】:

    • 请将您的代码作为文本而不是链接。
    • 我对回答很陌生。我只是写了链接,以减少直接对相关文件的回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-27
    • 2017-11-29
    • 1970-01-01
    • 2017-11-29
    • 2022-06-28
    • 1970-01-01
    相关资源
    最近更新 更多