跳转到内容
EN

Get the address and capability to play a stream live

Code Mode: praxis.media.streams.playbackToken.create

HTTP: POST /media/v1/streams/{stream_id}/playback-token

Mint a playback capability for the stream: an address of its live HLS playlist that a browser player can open with no API key. Call it from your own server and hand the address to the page, so the API key never reaches the browser; the Praxis Kit LiveStreamPlayer takes it as playbackUrl. The stream must have playback.enabled set (or record automatically), otherwise nothing is kept to play and the answer is 409. The response carries {url, expires_at}: the token is valid for one hour, any number can be held at once, and it opens this stream’s playlist and nothing else. The playlist shows the newest six segments of the broadcast in progress with PROGRAM-DATE-TIME on each, and ends (EXT-X-ENDLIST) when the stream is idle or disabled. Example: POST /media/v1/streams/mst_zpnqd7a2kxwg3vhr5tj4bfm6ec/playback-token with no body.

签名

praxis.media.streams.playbackToken.create(args:{path:{/** e.g. "mst_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ stream_id:string}}):Promise<{/** Always media.stream.playback. e.g. "media.stream.playback" */ object:"media.stream.playback";/** The address of the live HLS playlist with the token in it. e.g. "https://api.deepraxis.com/media/v1/streams/mst_zpnqd7a2kxwg3vhr5tj4bfm6ec/live.m3u8?token=Qm9v" */ url:string;/** When the token stops opening the playlist, RFC 3339 UTC, one hour after it was minted; a player that is already playing keeps the segments it asked for. e.g. "2026-11-28T13:00:00.000Z" */ expires_at:string}>;

参数

名称位置类型必填说明
stream_idpathstring是The stream’s id, the id field returned by streams.create or streams.list (mst_ followed by 26 lowercase base32 characters); a stream of another organization answers 404.

响应

状态码内容类型说明
200application/jsonThe playlist address and its capability.
401application/jsonThe request carries no valid API key or session. Send a key of your organization.
404application/jsonNo stream with this id in your organization, or Media Streams is not released for it. List your streams to find the id.
409application/jsonThe stream has nothing to play: set playback.enabled to true (streams.update) or record it automatically, then ask again.