Spotify Client
一个 Fabric 模组,将 Spotify 带入 Minecraft:一个常驻的“正在播放”小部件、播放快捷键以及用于搜索、浏览库、管理播放列表和控制播放的游戏内客户端。
本模组与 Spotify 或 Mojang 均无关联。 此模组通过官方 Spotify Web API 作为你个人 Spotify 账号的远程控制器。音频由你的 Spotify 应用(电脑、手机、音箱等)播放,而非 Minecraft。
功能
正在播放小部件
- 封面艺术、标题、艺术家、进度条和播放设备
- 位置(任意屏幕角落 + 偏移量)、大小、宽度、背景不透明度和强调色
- 可选:暂停时隐藏,F3 调试屏时隐藏(F1 时始终隐藏)
- 在设置中调整时的实时预览
播放快捷键
- 播放/暂停、下一首、上一首、打开客户端、显示/隐藏小部件
- 在游戏内和客户端内部均可用;可绑定键盘媒体键
游戏内客户端
- 搜索歌曲、专辑、播放列表和艺术家
- 你的播放列表、喜欢的歌曲、已保存的专辑、队列和最近播放的歌曲
- 专辑和艺术家页面
- 喜欢/取消喜欢歌曲、保存专辑、关注播放列表和艺术家
- 创建、编辑和删除播放列表;添加、移除和重新排序歌曲
- 加入队列、前往专辑、前往艺术家(右键点击任意行)
- 传输控制、随机播放、重复播放、进度条、音量和设备切换
要求
|
|
| Minecraft |
26.2 |
| Mod loader |
Fabric Loader 0.19.5 或更高版本 |
| Java |
25 |
| 必需模组 |
Fabric API |
| 可选模组 |
Mod Menu(添加设置按钮) |
| Spotify |
Spotify Premium,以及一个免费的 Spotify Developer 应用(见下文) |
安装
- 为 Minecraft 26.2 安装 Fabric Loader。
- 从最新版本下载
spotify-client-<version>.jar,并将其与 Fabric API 一起放入你的 mods 文件夹。
- 启动游戏。
Spotify 设置
Spotify 要求每个第三方应用都必须拥有自己的 Client ID。你可以在 Spotify Developer 仪表板中免费创建一次。
- 打开 Spotify Developer dashboard 并登录。
- 点击 Create app:
- 给它起任何名字和描述;
- 在 Redirect URIs 下,精确添加
http://127.0.0.1:43127/callback;
- 在 Which API/SDKs are you planning to use? 下,勾选 Web API;
- 接受条款并保存。
- 在应用的 User Management 选项卡中,添加所有将使用此应用的用户的 Spotify 账户电子邮件地址,包括你自己。
- 复制应用的 Client ID(不需要 Client Secret)。
- 在 Minecraft 中,打开设置(来自客户端的 ⚙ Settings,或来自 Mod Menu),进入 Account,粘贴 Client ID 并点击 Log in。
- 在浏览器中批准访问权限。一旦页面显示登录成功,你可以关闭它并返回游戏。
设置屏幕显示带有 Copy 按钮的重定向 URI。如果你更改重定向端口,请在你的 Spotify 应用中更新重定向 URI 以匹配。
用法
默认按键
| Action |
Default key |
| 打开客户端 |
Y |
| 播放 / 暂停 |
Numpad 5 |
| 下一首 |
Numpad 6 |
| 上一首 |
Numpad 4 |
| 显示 / 隐藏小部件 |
未绑定 |
在 Settings → Keys(点击按键,然后按下新的按键;Escape 取消,Backspace 解除绑定)或 Options → Controls → Spotify Client 中更改它们。
在客户端中
- 左键点击 歌曲进行播放,点击播放列表或专辑以打开它。
- 右键点击 歌曲、播放列表、专辑或艺术家(或在歌曲上点击
...)以查看更多操作。
- Space 切换播放/暂停;Backspace 返回上一页。
- 点击或拖动进度条和音量条;在音量条上滚动以调整音量。
- 点击右下角的设备名称以切换设备。
- 没有播放?先在设备上打开 Spotify,然后在 Devices 中选择它。
设置
| Tab |
Options |
| Account |
登录/登出、Client ID、重定向端口、重定向 URI、设置步骤 |
| Widget |
可见性、屏幕角落、偏移量、大小、宽度、不透明度、内容、强调色 |
| Playback |
在快捷栏上方播报曲目更改、小部件更新频率 |
| Keys |
所有按键绑定 |
设置会立即保存到 config/spotify-client.json。
限制
这些限制源于 Spotify 对处于开发模式的应用的规则:
- Spotify Premium 是应用所有者和控制播放所必需的。
- 开发应用最多可以有 5 个用户,需在 User Management 中手动添加。超过此数量后,每个人都应创建自己的应用并使用自己的 Client ID。
- 搜索每页返回 10 个结果;向下滚动时会自动加载更多结果。
- 仅列出你拥有或合作制作的播放列表中的歌曲。其他播放列表仍可使用 Play 播放。
- 艺术家“热门歌曲”不可用;艺术家页面显示专辑和单曲。
- 智能随机播放 无法通过 Spotify Web API 获得;仅支持常规随机播放。
- API 使用量计入共享配额。如果 Spotify 对请求进行速率限制,模组将等待并重试。
隐私和安全
- 模组仅与 Spotify(
accounts.spotify.com, api.spotify.com)以及用于封面艺术的 Spotify 图像服务器通信。
- 登录使用带有 PKCE 的 OAuth Authorization Code 流程:不存储也不需要 Client Secret。
- 登录期间,临时本地服务器在
127.0.0.1(默认端口 43127)监听以接收授权,然后关闭。
- 登录令牌本地存储在
config/spotify-client-spotify-tokens.json 中。请勿共享此文件:它将允许访问你的 Spotify 账户。从设置中注销以删除它。
- 数据不会发送到其他地方。
故障排除
| 提示信息 |
解决方案 |
| 请先输入客户端 ID |
在 设置 → 账户 中粘贴你应用的 Client ID。 |
| 重定向端口已被占用 |
选择另一个端口,并在你的 Spotify 应用中更新重定向 URI。 |
| 失败:请检查 Client ID 和重定向 URI |
你 Spotify 应用中的重定向 URI 必须与设置中显示的完全一致。 |
| 浏览器登录被拒绝 |
重新登录并授权访问。确保你的账户已添加至应用的“用户管理”列表中。 |
| 没有可用的 Spotify 设备 |
在电脑或手机上打开 Spotify,然后重试或在 设备 中选择它。 |
| 需要 Spotify Premium |
播放控制功能需要 Premium 账户。 |
| 缺少 Spotify 权限 |
从设置中注销后重新登录。 |
| Spotify 请求过多 |
等待几秒。在 设置 → 播放 中延长更新间隔可减少请求次数。 |
从源码构建
需要 JDK 25。
./gradlew build
模组 jar 文件会生成在 build/libs/ 目录中。若要启动开发客户端:
./gradlew runClient
许可证
Spotify Client 遵循 PolyForm Strict License 1.0.0 开源可用协议,并对整合包提供额外许可。
简而言之(以 LICENSE 文件为准):
- ✅ 你可以阅读代码并将该模组用于非商业目的。
- ✅ 你可以在免费、非商业的整合包中包含未修改的模组 jar 文件,但需注明出处并提供项目页面链接。
- ❌ 你不得修改该模组、分发修改后的版本、重新分发源代码,或单独重新上传该 jar 文件。
- ❌ 禁止商业用途。
贡献指南
本项目不接受贡献。所有 Pull Request 将在未经审查的情况下被关闭。
Spotify 是 Spotify AB 的商标。Minecraft 是 Mojang AB 的商标。本项目与这两家公司均无隶属、背书或赞助关系。
Spotify Client
A client-side Fabric mod that brings Spotify into Minecraft: an always-on "now playing" widget, playback keys, and an in-game client to search, browse your library, manage playlists and control playback.
Not affiliated with Spotify or Mojang. This mod is a remote control for your own Spotify account through the official Spotify Web API. Audio plays from your Spotify app (computer, phone, speaker…), not from Minecraft.
Features
Now playing widget
- Cover art, title, artist, progress bar and playing device
- Position (any screen corner + offsets), size, width, background opacity and accent color
- Optional: hide while paused, hide with the F3 debug screen (always hidden with F1)
- Live preview while adjusting it in the settings
Playback keys
- Play / pause, next, previous, open the client, show / hide the widget
- Work in game and inside the client; keyboard media keys can be bound
In-game client
- Search tracks, albums, playlists and artists
- Your playlists, Liked Songs, saved albums, queue and recently played tracks
- Album and artist pages
- Like / unlike tracks, save albums, follow playlists and artists
- Create, edit and delete playlists; add, remove and reorder tracks
- Add to queue, go to album, go to artist (right-click any row)
- Transport controls, shuffle, repeat, seek bar, volume and device switching
Requirements
|
|
| Minecraft |
26.2 |
| Mod loader |
Fabric Loader 0.19.5 or newer |
| Java |
25 |
| Required mod |
Fabric API |
| Optional mod |
Mod Menu (adds a settings button) |
| Spotify |
Spotify Premium, and a free Spotify Developer app (see below) |
Installation
- Install Fabric Loader for Minecraft 26.2.
- Download
spotify-client-<version>.jar from the latest release and put it, with Fabric API, in your mods folder.
- Launch the game.
Spotify setup
Spotify requires every third-party app to have its own Client ID. You create it once, for free, in the Spotify Developer dashboard.
- Open the Spotify Developer dashboard and log in.
- Click Create app:
- give it any name and description;
- under Redirect URIs, add exactly
http://127.0.0.1:43127/callback;
- under Which API/SDKs are you planning to use?, check Web API;
- accept the terms and save.
- In the app's User Management tab, add the Spotify account email of everyone who will use this app, including yourself.
- Copy the app's Client ID (you don't need the Client Secret).
- In Minecraft, open the settings (from the client with ⚙ Settings, or from Mod Menu), go to Account, paste the Client ID and click Log in.
- Approve the access in your browser. Once the page says the login succeeded, you can close it and go back to the game.
The settings screen shows the redirect URI with a Copy button. If you change the redirect port, update the redirect URI in your Spotify app to match.
Usage
Default keys
| Action |
Default key |
| Open the client |
Y |
| Play / pause |
Numpad 5 |
| Next track |
Numpad 6 |
| Previous track |
Numpad 4 |
| Show / hide widget |
Unbound |
Change them in Settings → Keys (click a key, then press the new one; Escape cancels, Backspace unbinds) or in Options → Controls → Spotify Client.
In the client
- Left click a track to play it, a playlist or album to open it.
- Right click a track, playlist, album or artist (or click
... on a track) for more actions.
- Space toggles play / pause; Backspace goes back to the previous page.
- Click or drag the seek bar and the volume bar; scroll over the volume bar to adjust it.
- Click the device name in the bottom right corner to switch devices.
- Nothing plays? Open Spotify on a device first, then pick it in Devices.
Settings
| Tab |
Options |
| Account |
Log in / out, Client ID, redirect port, redirect URI, setup steps |
| Widget |
Visibility, screen corner, offsets, size, width, opacity, content, accent color |
| Playback |
Announce track changes above the hotbar, widget update frequency |
| Keys |
All key bindings |
Settings are saved immediately to config/spotify-client.json.
Limitations
These come from Spotify's rules for apps in development mode:
- Spotify Premium is required for the app owner and to control playback.
- A development app can have up to 5 users, added manually in User Management. Beyond that, each person should create their own app and use their own Client ID.
- Search returns 10 results per page; more results load automatically as you scroll.
- Tracks are only listed for playlists you own or collaborate on. Other playlists can still be played with Play.
- Artist "top tracks" are not available; artist pages show albums and singles.
- Smart shuffle is not available through the Spotify Web API; only regular shuffle is supported.
- API usage counts against a shared quota. If Spotify rate-limits requests, the mod waits and retries.
Privacy and security
- The mod talks only to Spotify (
accounts.spotify.com, api.spotify.com) and to Spotify's image servers for cover art.
- Login uses the OAuth Authorization Code flow with PKCE: no Client Secret is stored or needed.
- During login, a temporary local server listens on
127.0.0.1 (default port 43127) to receive the authorization, then shuts down.
- Login tokens are stored locally in
config/spotify-client-spotify-tokens.json. Do not share this file: it gives access to your Spotify account. Log out from the settings to delete it.
- No data is sent anywhere else.
Troubleshooting
| Message |
Solution |
| Enter the Client ID first |
Paste your app's Client ID in Settings → Account. |
| Redirect port already in use |
Choose another port, and update the redirect URI in your Spotify app. |
| Failed: check the Client ID and Redirect URI |
The redirect URI in your Spotify app must match the one shown in the settings exactly. |
| Login refused in the browser |
Log in again and approve the access. Make sure your account is listed in the app's User Management. |
| No Spotify device available |
Open Spotify on your computer or phone, then try again or pick it in Devices. |
| Spotify Premium is required |
Playback control requires a Premium account. |
| Missing Spotify permissions |
Log out and log in again from the settings. |
| Too many Spotify requests |
Wait a few seconds. A longer update interval in Settings → Playback reduces requests. |
Building from source
Requires JDK 25.
./gradlew build
The mod jar is created in build/libs/. To start a development client:
./gradlew runClient
License
Spotify Client is source available under the PolyForm Strict License 1.0.0, with an additional permission for modpacks.
In short (the LICENSE file is what applies):
- ✅ You can read the code and use the mod for noncommercial purposes.
- ✅ You can include the unmodified mod jar in free, noncommercial modpacks, with credit and a link to the project page.
- ❌ You cannot modify the mod, distribute modified versions, redistribute the source code, or reupload the jar on its own.
- ❌ No commercial use.
Contributing
This project does not accept contributions. Pull requests will be closed without review.
Spotify is a trademark of Spotify AB. Minecraft is a trademark of Mojang AB. This project is not affiliated with, endorsed by, or sponsored by either company.
评论 0
登录后参与评分
还没有评论,来抢沙发吧