跳转到内容
EN

Update a stream

Code Mode: praxis.media.streams.update

HTTP: PATCH /media/v1/streams/{stream_id}

Change the settings of a stream you own; send only the fields to change. reconnect_window_s and max_continuous_duration_s take the same ranges as on create. recording is merged onto the current settings (send {rendition: sd} to change only the rendition; a null optional field such as library_id clears it). pipeline_id is stored as given (null clears it). input can change only the url of a pull stream and only while it is idle or disabled; a push stream has no address to change and a live pull stream answers 409. An empty patch, an unknown field or an invalid value answers 400. Example: {“reconnect_window_s”:120,“recording”:{“mode”:“automatic”}}.

签名

praxis.media.streams.update(args:{path:{/** e.g. "mst_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ stream_id:string};body:{input?:{/** pull means Praxis pulls the address in url; push means your encoder or app sends to the push address returned when the stream is created. e.g. "pull" */ kind:"pull"|"push";/** Only for kind push; omit it for a push over the Praxis socket from a browser or app. e.g. "rtmp" */ protocol?:"rtmp"|"srt";/** The address to pull, present only when kind is pull: https, http (HLS .m3u8, HTTP-FLV) or rtmp, rtmps. e.g. "https://live.example.com/room/index.m3u8" */ url?:string};/** The new reconnect window in seconds, 0 to 1800. e.g. 120 */ reconnect_window_s?:number;/** The new maximum continuous duration in seconds, 60 to 43200. e.g. 3600 */ max_continuous_duration_s?:number;recording?:{/** automatic records every broadcast into a Media asset; off records nothing (the default). e.g. "off" */ mode?:"automatic"|"off";/** Which rendition to record: source keeps the stream as it arrives; highest, sd and lowest pick among the renditions the source offers; audio_only keeps no video. e.g. "source" */ rendition?:"source"|"highest"|"sd"|"lowest"|"audio_only";/** The Media library the recordings go to; omit to use the default library of your organization. */ library_id?:string;/** The folder inside the library the recordings are placed in; omit for the library root. */ asset_folder?:string;/** Delete each recording this many days after it was made; omit to keep recordings until you delete them. e.g. 30 */ delete_after_days?:number};playback?:{/** true keeps the newest segments of the broadcast readable so a player can follow it live (about a minute of media at a time); false (the default) keeps nothing f e.g. true */ enabled?:boolean};/** The new pipeline id, or null to detach the pipeline. */ pipeline_id?:(string)|null}}):Promise<{/** The stream id (mst_ and 26 lowercase base32 characters); stable and never reused. e.g. "mst_zpnqd7a2kxwg3vhr5tj4bfm6ec" */ id:string;/** Always media.stream; tells a stream from other objects in a mixed list. e.g. "media.stream" */ object:"media.stream";/** idle means no source is connected; waiting means a pulled source is not live yet (no failure and no charge beyond the poll); active means media is flowing and a e.g. "idle" */ status:"idle"|"waiting"|"active"|"disabled";input:{/** pull means Praxis pulls the address in url; push means your encoder or app sends to the push address returned when the stream is created. e.g. "pull" */ kind:"pull"|"push";/** Only for kind push; omit it for a push over the Praxis socket from a browser or app. e.g. "rtmp" */ protocol?:"rtmp"|"srt";/** The address to pull, present only when kind is pull: https, http (HLS .m3u8, HTTP-FLV) or rtmp, rtmps. e.g. "https://live.example.com/room/index.m3u8" */ url?:string};/** Seconds a dropped source may take to come back and continue the same broadcast. e.g. 60 */ reconnect_window_s:number;/** Seconds one broadcast may run before it ends. e.g. 43200 */ max_continuous_duration_s:number;recording:{/** automatic records every broadcast into a Media asset; off records nothing (the default). e.g. "off" */ mode?:"automatic"|"off";/** Which rendition to record: source keeps the stream as it arrives; highest, sd and lowest pick among the renditions the source offers; audio_only keeps no video. e.g. "source" */ rendition?:"source"|"highest"|"sd"|"lowest"|"audio_only";/** The Media library the recordings go to; omit to use the default library of your organization. */ library_id?:string;/** The folder inside the library the recordings are placed in; omit for the library root. */ asset_folder?:string;/** Delete each recording this many days after it was made; omit to keep recordings until you delete them. e.g. 30 */ delete_after_days?:number};playback?:{/** true keeps the newest segments of the broadcast readable so a player can follow it live (about a minute of media at a time); false (the default) keeps nothing f e.g. true */ enabled?:boolean};/** The processing attached to the stream, or null for none. */ pipeline_id:(string)|null;/** The Media asset the current broadcast is being recorded into, or null when no broadcast is recording. */ active_asset_id:(string)|null;/** The assets of the broadcasts before the current one, newest first. */ recent_asset_ids:Array<string>;/** The live health of the broadcast in progress; null unless the stream is active. */ health:(({/** Kilobits per second received over the last minute (bytes received over the media time they cover); null when no segment arrived in that minute. e.g. 2500 */ bitrate_kbps:(number)|null;/** Milliseconds from a segment's wall-clock start to the moment it was processed, averaged over the last minute. e.g. 1800 */ latency_ms:(number)|null;/** Segments the source skipped in this broadcast. e.g. 0 */ dropped_segments:number;/** Times the source dropped and came back inside the reconnect window in this broadcast. e.g. 1 */ reconnects:number;/** When the newest segment was processed, RFC 3339 UTC; null before the first segment of the broadcast. e.g. "2026-11-28T12:05:00.000Z" */ last_segment_at:(string)|null}))|null;usage:{/** The broadcast in progress; null unless the stream is active. */ broadcast:(({/** Seconds the stream was live, to the millisecond. e.g. 90.5 */ stream_seconds:number;/** Seconds of processing (pipeline processors and alert judgments) run for the stream, to the millisecond. e.g. 1.25 */ processor_seconds:number;/** Bytes recorded from the stream. e.g. 18500000 */ recorded_bytes:number}))|null;/** Across every broadcast of the stream. */ total:({/** Seconds the stream was live, to the millisecond. e.g. 90.5 */ stream_seconds:number;/** Seconds of processing (pipeline processors and alert judgments) run for the stream, to the millisecond. e.g. 1.25 */ processor_seconds:number;/** Bytes recorded from the stream. e.g. 18500000 */ recorded_bytes:number})};/** When the stream was created, RFC 3339 UTC. e.g. "2026-11-28T12:00:00.000Z" */ created_at:string;/** When the stream last changed (a setting or its status), RFC 3339 UTC. e.g. "2026-11-28T12:05:00.000Z" */ updated_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.

请求体

必填内容类型说明
是application/json

响应

状态码内容类型说明
200application/jsonThe stream after the change.
400application/jsonThe patch is empty, carries an unknown field or an invalid value (the error names the field). Correct it and send again.
404application/jsonNo stream with this id in your organization, or Media Streams is not released for it.
409application/jsonThe source of a waiting or active pull stream cannot change. Disable the stream with streams.disable.create, change it, then enable it again.