---
title: "流式播放歌曲"
method: GET
path: "/songs/{id}/play.mp3"
tags: ["歌曲管理"]
---

# 流式播放歌曲

`GET /songs/{id}/play.mp3`

## Request

- Base URL: `https://localhost:58091/api/v1`
- URL: `https://localhost:58091/api/v1/songs/{id}/play.mp3`
- Auth: API key in header `Authorization`

按 song.ID 流式播放。HLS 电台返回播放列表或 302，HTTP-FLV 电台通过 play.flv 返回原始 FLV。play.mp3 仅用于电台，强制抽取首条音轨并返回 MP3 或转码错误，无需 radio_transcode 参数。配置为 audio_only 的电台通过 play 返回 MP3。无固定长度的 FLV 上游正常断开后，MP3 转码会重新访问电台入口并继续使用同一响应。

## Path parameters

- `id` integer, required

## Query parameters

- `access_token` string
- `format` string
- `quality` string
- `track` integer
- `prefetch` string
- `media` string
- `hls` string
- `normalize` string
- `radio_transcode` string
- `seek` number
- `speed` number

## Response `200`

音频文件

## Other responses

- `202`: 预拉取已触发
- `302`: 电台流重定向
- `403`: 纯音频转码的源或其子资源不在允许范围内
- `404`: 歌曲不存在或不适用播放路径
- `502`: 音源不可用或电台纯音频转码失败
- `503`: 纯音频转码工具不可用或并发已满
- `504`: 纯音频转码启动超时

## Changes

- **2026-11-21** `66a1a1ea3bea`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/songloft-org/apis/songloft-api/changes/songs/:id/play.mp3/get.md)

---

[API](https://skmtc.dev/songloft-org/apis/songloft-api.md) - [All operations](https://skmtc.dev/songloft-org/apis/songloft-api/llms.txt) - [OpenAPI document](https://skmtc.dev/songloft-org/apis/songloft-api/revisions/5bc05f13fffd?raw)
