# Live Inputs ## List live inputs `client.Stream.LiveInputs.List(ctx, params) (*LiveInputListResponse, error)` **get** `/accounts/{account_id}/stream/live_inputs` Lists the live inputs created for an account. To get the credentials needed to stream to a specific live input, request a single live input. ### Parameters - `params LiveInputListParams` - `AccountID param.Field[string]` Path param: Identifier. - `IncludeCounts param.Field[bool]` Query param: Includes the total number of videos associated with the submitted query parameters. ### Returns - `type LiveInputListResponse struct{…}` - `LiveInputs []LiveInputListResponseLiveInput` - `Created Time` The date and time the live input was created. - `DeleteRecordingAfterDays float64` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled bool` Indicates whether the live input is enabled and can accept streams. - `Meta unknown` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Modified Time` The date and time the live input was last modified. - `UID string` A unique identifier for a live input. - `Range int64` The total number of remaining live inputs based on cursor position. - `Total int64` The total number of live inputs that match the provided filters. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) liveInputs, err := client.Stream.LiveInputs.List(context.TODO(), stream.LiveInputListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", liveInputs.LiveInputs) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "liveInputs": [ { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "uid": "66be4bf738797e01e1fca35a7bdecdcd" } ], "range": 1000, "total": 35586 } } ``` ## Retrieve a live input `client.Stream.LiveInputs.Get(ctx, liveInputIdentifier, query) (*LiveInput, error)` **get** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}` Retrieves details of an existing live input. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `query LiveInputGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type LiveInput struct{…}` Details about a live input. - `Created Time` The date and time the live input was created. - `DeleteRecordingAfterDays float64` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled bool` Indicates whether the live input is enabled and can accept streams. - `Meta unknown` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Modified Time` The date and time the live input was last modified. - `Recording LiveInputRecording` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `AllowedOrigins []string` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `HideLiveViewerCount bool` Disables reporting the number of live viewers when this property is set to `true`. - `Mode LiveInputRecordingMode` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `const LiveInputRecordingModeOff LiveInputRecordingMode = "off"` - `const LiveInputRecordingModeAutomatic LiveInputRecordingMode = "automatic"` - `RequireSignedURLs bool` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `TimeoutSeconds int64` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `Rtmps LiveInputRtmps` Details for streaming to an live input using RTMPS. - `StreamKey string` The secret key to use when streaming via RTMPS to a live input. - `URL string` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `RtmpsPlayback LiveInputRtmpsPlayback` Details for playback from an live input using RTMPS. - `StreamKey string` The secret key to use for playback via RTMPS. - `URL string` The URL used to play live video over RTMPS. - `Srt LiveInputSrt` Details for streaming to a live input using SRT. - `Passphrase string` The secret key to use when streaming via SRT to a live input. - `StreamID string` The identifier of the live input to use when streaming via SRT. - `URL string` The SRT URL you provide to the broadcaster, which they stream live video to. - `SrtPlayback LiveInputSrtPlayback` Details for playback from an live input using SRT. - `Passphrase string` The secret key to use for playback via SRT. - `StreamID string` The identifier of the live input to use for playback via SRT. - `URL string` The URL used to play live video over SRT. - `Status LiveInputStatus` The connection status of a live input. - `const LiveInputStatusConnected LiveInputStatus = "connected"` - `const LiveInputStatusReconnected LiveInputStatus = "reconnected"` - `const LiveInputStatusReconnecting LiveInputStatus = "reconnecting"` - `const LiveInputStatusClientDisconnect LiveInputStatus = "client_disconnect"` - `const LiveInputStatusTTLExceeded LiveInputStatus = "ttl_exceeded"` - `const LiveInputStatusFailedToConnect LiveInputStatus = "failed_to_connect"` - `const LiveInputStatusFailedToReconnect LiveInputStatus = "failed_to_reconnect"` - `const LiveInputStatusNewConfigurationAccepted LiveInputStatus = "new_configuration_accepted"` - `UID string` A unique identifier for a live input. - `WebRtc LiveInputWebRtc` Details for streaming to a live input using WebRTC. - `URL string` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `WebRtcPlayback LiveInputWebRtcPlayback` Details for playback from a live input using WebRTC. - `URL string` The URL used to play live video over WebRTC. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) liveInput, err := client.Stream.LiveInputs.Get( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", liveInput.UID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "recording": { "allowedOrigins": [ "example.com" ], "hideLiveViewerCount": false, "mode": "off", "requireSignedURLs": false, "timeoutSeconds": 0 }, "rtmps": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "rtmpsPlayback": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "srt": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "srt://live.cloudflare.com:778" }, "srtPlayback": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "rtmps://live.cloudflare.com:443/live/" }, "status": "connected", "uid": "66be4bf738797e01e1fca35a7bdecdcd", "webRTC": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/publish" }, "webRTCPlayback": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/play" } } } ``` ## Create a live input `client.Stream.LiveInputs.New(ctx, params) (*LiveInput, error)` **post** `/accounts/{account_id}/stream/live_inputs` Creates a live input, and returns credentials that you or your users can use to stream live video to Cloudflare Stream. ### Parameters - `params LiveInputNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `DefaultCreator param.Field[string]` Body param: Sets the creator ID asssociated with this live input. - `DeleteRecordingAfterDays param.Field[float64]` Body param: Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled param.Field[bool]` Body param: Indicates whether the live input is enabled and can accept streams. - `Meta param.Field[unknown]` Body param: A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Recording param.Field[LiveInputNewParamsRecording]` Body param: Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `AllowedOrigins []string` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `HideLiveViewerCount bool` Disables reporting the number of live viewers when this property is set to `true`. - `Mode LiveInputNewParamsRecordingMode` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `const LiveInputNewParamsRecordingModeOff LiveInputNewParamsRecordingMode = "off"` - `const LiveInputNewParamsRecordingModeAutomatic LiveInputNewParamsRecordingMode = "automatic"` - `RequireSignedURLs bool` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `TimeoutSeconds int64` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. ### Returns - `type LiveInput struct{…}` Details about a live input. - `Created Time` The date and time the live input was created. - `DeleteRecordingAfterDays float64` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled bool` Indicates whether the live input is enabled and can accept streams. - `Meta unknown` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Modified Time` The date and time the live input was last modified. - `Recording LiveInputRecording` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `AllowedOrigins []string` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `HideLiveViewerCount bool` Disables reporting the number of live viewers when this property is set to `true`. - `Mode LiveInputRecordingMode` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `const LiveInputRecordingModeOff LiveInputRecordingMode = "off"` - `const LiveInputRecordingModeAutomatic LiveInputRecordingMode = "automatic"` - `RequireSignedURLs bool` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `TimeoutSeconds int64` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `Rtmps LiveInputRtmps` Details for streaming to an live input using RTMPS. - `StreamKey string` The secret key to use when streaming via RTMPS to a live input. - `URL string` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `RtmpsPlayback LiveInputRtmpsPlayback` Details for playback from an live input using RTMPS. - `StreamKey string` The secret key to use for playback via RTMPS. - `URL string` The URL used to play live video over RTMPS. - `Srt LiveInputSrt` Details for streaming to a live input using SRT. - `Passphrase string` The secret key to use when streaming via SRT to a live input. - `StreamID string` The identifier of the live input to use when streaming via SRT. - `URL string` The SRT URL you provide to the broadcaster, which they stream live video to. - `SrtPlayback LiveInputSrtPlayback` Details for playback from an live input using SRT. - `Passphrase string` The secret key to use for playback via SRT. - `StreamID string` The identifier of the live input to use for playback via SRT. - `URL string` The URL used to play live video over SRT. - `Status LiveInputStatus` The connection status of a live input. - `const LiveInputStatusConnected LiveInputStatus = "connected"` - `const LiveInputStatusReconnected LiveInputStatus = "reconnected"` - `const LiveInputStatusReconnecting LiveInputStatus = "reconnecting"` - `const LiveInputStatusClientDisconnect LiveInputStatus = "client_disconnect"` - `const LiveInputStatusTTLExceeded LiveInputStatus = "ttl_exceeded"` - `const LiveInputStatusFailedToConnect LiveInputStatus = "failed_to_connect"` - `const LiveInputStatusFailedToReconnect LiveInputStatus = "failed_to_reconnect"` - `const LiveInputStatusNewConfigurationAccepted LiveInputStatus = "new_configuration_accepted"` - `UID string` A unique identifier for a live input. - `WebRtc LiveInputWebRtc` Details for streaming to a live input using WebRTC. - `URL string` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `WebRtcPlayback LiveInputWebRtcPlayback` Details for playback from a live input using WebRTC. - `URL string` The URL used to play live video over WebRTC. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) liveInput, err := client.Stream.LiveInputs.New(context.TODO(), stream.LiveInputNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", liveInput.UID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "recording": { "allowedOrigins": [ "example.com" ], "hideLiveViewerCount": false, "mode": "off", "requireSignedURLs": false, "timeoutSeconds": 0 }, "rtmps": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "rtmpsPlayback": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "srt": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "srt://live.cloudflare.com:778" }, "srtPlayback": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "rtmps://live.cloudflare.com:443/live/" }, "status": "connected", "uid": "66be4bf738797e01e1fca35a7bdecdcd", "webRTC": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/publish" }, "webRTCPlayback": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/play" } } } ``` ## Update a live input `client.Stream.LiveInputs.Update(ctx, liveInputIdentifier, params) (*LiveInput, error)` **put** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}` Updates a specified live input. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `params LiveInputUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `DefaultCreator param.Field[string]` Body param: Sets the creator ID asssociated with this live input. - `DeleteRecordingAfterDays param.Field[float64]` Body param: Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled param.Field[bool]` Body param: Indicates whether the live input is enabled and can accept streams. - `Meta param.Field[unknown]` Body param: A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Recording param.Field[LiveInputUpdateParamsRecording]` Body param: Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `AllowedOrigins []string` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `HideLiveViewerCount bool` Disables reporting the number of live viewers when this property is set to `true`. - `Mode LiveInputUpdateParamsRecordingMode` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `const LiveInputUpdateParamsRecordingModeOff LiveInputUpdateParamsRecordingMode = "off"` - `const LiveInputUpdateParamsRecordingModeAutomatic LiveInputUpdateParamsRecordingMode = "automatic"` - `RequireSignedURLs bool` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `TimeoutSeconds int64` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. ### Returns - `type LiveInput struct{…}` Details about a live input. - `Created Time` The date and time the live input was created. - `DeleteRecordingAfterDays float64` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled bool` Indicates whether the live input is enabled and can accept streams. - `Meta unknown` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Modified Time` The date and time the live input was last modified. - `Recording LiveInputRecording` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `AllowedOrigins []string` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `HideLiveViewerCount bool` Disables reporting the number of live viewers when this property is set to `true`. - `Mode LiveInputRecordingMode` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `const LiveInputRecordingModeOff LiveInputRecordingMode = "off"` - `const LiveInputRecordingModeAutomatic LiveInputRecordingMode = "automatic"` - `RequireSignedURLs bool` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `TimeoutSeconds int64` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `Rtmps LiveInputRtmps` Details for streaming to an live input using RTMPS. - `StreamKey string` The secret key to use when streaming via RTMPS to a live input. - `URL string` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `RtmpsPlayback LiveInputRtmpsPlayback` Details for playback from an live input using RTMPS. - `StreamKey string` The secret key to use for playback via RTMPS. - `URL string` The URL used to play live video over RTMPS. - `Srt LiveInputSrt` Details for streaming to a live input using SRT. - `Passphrase string` The secret key to use when streaming via SRT to a live input. - `StreamID string` The identifier of the live input to use when streaming via SRT. - `URL string` The SRT URL you provide to the broadcaster, which they stream live video to. - `SrtPlayback LiveInputSrtPlayback` Details for playback from an live input using SRT. - `Passphrase string` The secret key to use for playback via SRT. - `StreamID string` The identifier of the live input to use for playback via SRT. - `URL string` The URL used to play live video over SRT. - `Status LiveInputStatus` The connection status of a live input. - `const LiveInputStatusConnected LiveInputStatus = "connected"` - `const LiveInputStatusReconnected LiveInputStatus = "reconnected"` - `const LiveInputStatusReconnecting LiveInputStatus = "reconnecting"` - `const LiveInputStatusClientDisconnect LiveInputStatus = "client_disconnect"` - `const LiveInputStatusTTLExceeded LiveInputStatus = "ttl_exceeded"` - `const LiveInputStatusFailedToConnect LiveInputStatus = "failed_to_connect"` - `const LiveInputStatusFailedToReconnect LiveInputStatus = "failed_to_reconnect"` - `const LiveInputStatusNewConfigurationAccepted LiveInputStatus = "new_configuration_accepted"` - `UID string` A unique identifier for a live input. - `WebRtc LiveInputWebRtc` Details for streaming to a live input using WebRTC. - `URL string` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `WebRtcPlayback LiveInputWebRtcPlayback` Details for playback from a live input using WebRTC. - `URL string` The URL used to play live video over WebRTC. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) liveInput, err := client.Stream.LiveInputs.Update( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", liveInput.UID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "deleteRecordingAfterDays": 45, "enabled": true, "meta": { "name": "test stream 1" }, "modified": "2014-01-02T02:20:00Z", "recording": { "allowedOrigins": [ "example.com" ], "hideLiveViewerCount": false, "mode": "off", "requireSignedURLs": false, "timeoutSeconds": 0 }, "rtmps": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "rtmpsPlayback": { "streamKey": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "url": "rtmps://live.cloudflare.com:443/live/" }, "srt": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "srt://live.cloudflare.com:778" }, "srtPlayback": { "passphrase": "2fb3cb9f17e68a2568d6ebed8d5505eak3ceaf8c9b1f395e1b76b79332497cada", "streamId": "f256e6ea9341d51eea64c9454659e576", "url": "rtmps://live.cloudflare.com:443/live/" }, "status": "connected", "uid": "66be4bf738797e01e1fca35a7bdecdcd", "webRTC": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/publish" }, "webRTCPlayback": { "url": "https://customer-m033z5x00ks6nunl.cloudflarestream.com/b236bde30eb07b9d01318940e5fc3edake34a3efb3896e18f2dc277ce6cc993ad/webRTC/play" } } } ``` ## Delete a live input `client.Stream.LiveInputs.Delete(ctx, liveInputIdentifier, body) error` **delete** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}` Prevents a live input from being streamed to and makes the live input inaccessible to any future API calls. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `body LiveInputDeleteParams` - `AccountID param.Field[string]` Identifier. ### Example ```go package main import ( "context" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) err := client.Stream.LiveInputs.Delete( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } } ``` #### Response ```json {} ``` ## Domain Types ### Live Input - `type LiveInput struct{…}` Details about a live input. - `Created Time` The date and time the live input was created. - `DeleteRecordingAfterDays float64` Indicates the number of days after which the live inputs recordings will be deleted. When a stream completes and the recording is ready, the value is used to calculate a scheduled deletion date for that recording. Omit the field to indicate no change, or include with a `null` value to remove an existing scheduled deletion. - `Enabled bool` Indicates whether the live input is enabled and can accept streams. - `Meta unknown` A user modifiable key-value store used to reference other systems of record for managing live inputs. - `Modified Time` The date and time the live input was last modified. - `Recording LiveInputRecording` Records the input to a Cloudflare Stream video. Behavior depends on the mode. In most cases, the video will initially be viewable as a live video and transition to on-demand after a condition is satisfied. - `AllowedOrigins []string` Lists the origins allowed to display videos created with this input. Enter allowed origin domains in an array and use `*` for wildcard subdomains. An empty array allows videos to be viewed on any origin. - `HideLiveViewerCount bool` Disables reporting the number of live viewers when this property is set to `true`. - `Mode LiveInputRecordingMode` Specifies the recording behavior for the live input. Set this value to `off` to prevent a recording. Set the value to `automatic` to begin a recording and transition to on-demand after Stream Live stops receiving input. - `const LiveInputRecordingModeOff LiveInputRecordingMode = "off"` - `const LiveInputRecordingModeAutomatic LiveInputRecordingMode = "automatic"` - `RequireSignedURLs bool` Indicates if a video using the live input has the `requireSignedURLs` property set. Also enforces access controls on any video recording of the livestream with the live input. - `TimeoutSeconds int64` Determines the amount of time a live input configured in `automatic` mode should wait before a recording transitions from live to on-demand. `0` is recommended for most use cases and indicates the platform default should be used. - `Rtmps LiveInputRtmps` Details for streaming to an live input using RTMPS. - `StreamKey string` The secret key to use when streaming via RTMPS to a live input. - `URL string` The RTMPS URL you provide to the broadcaster, which they stream live video to. - `RtmpsPlayback LiveInputRtmpsPlayback` Details for playback from an live input using RTMPS. - `StreamKey string` The secret key to use for playback via RTMPS. - `URL string` The URL used to play live video over RTMPS. - `Srt LiveInputSrt` Details for streaming to a live input using SRT. - `Passphrase string` The secret key to use when streaming via SRT to a live input. - `StreamID string` The identifier of the live input to use when streaming via SRT. - `URL string` The SRT URL you provide to the broadcaster, which they stream live video to. - `SrtPlayback LiveInputSrtPlayback` Details for playback from an live input using SRT. - `Passphrase string` The secret key to use for playback via SRT. - `StreamID string` The identifier of the live input to use for playback via SRT. - `URL string` The URL used to play live video over SRT. - `Status LiveInputStatus` The connection status of a live input. - `const LiveInputStatusConnected LiveInputStatus = "connected"` - `const LiveInputStatusReconnected LiveInputStatus = "reconnected"` - `const LiveInputStatusReconnecting LiveInputStatus = "reconnecting"` - `const LiveInputStatusClientDisconnect LiveInputStatus = "client_disconnect"` - `const LiveInputStatusTTLExceeded LiveInputStatus = "ttl_exceeded"` - `const LiveInputStatusFailedToConnect LiveInputStatus = "failed_to_connect"` - `const LiveInputStatusFailedToReconnect LiveInputStatus = "failed_to_reconnect"` - `const LiveInputStatusNewConfigurationAccepted LiveInputStatus = "new_configuration_accepted"` - `UID string` A unique identifier for a live input. - `WebRtc LiveInputWebRtc` Details for streaming to a live input using WebRTC. - `URL string` The WebRTC URL you provide to the broadcaster, which they stream live video to. - `WebRtcPlayback LiveInputWebRtcPlayback` Details for playback from a live input using WebRTC. - `URL string` The URL used to play live video over WebRTC. # Outputs ## List all outputs associated with a specified live input `client.Stream.LiveInputs.Outputs.List(ctx, liveInputIdentifier, query) (*SinglePage[Output], error)` **get** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs` Retrieves all outputs associated with a specified live input. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `query LiveInputOutputListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type Output struct{…}` - `Enabled bool` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `StreamKey string` The streamKey used to authenticate against an output's target. - `UID string` A unique identifier for the output. - `URL string` The URL an output uses to restream. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.Stream.LiveInputs.Outputs.List( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputOutputListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "enabled": true, "streamKey": "uzya-f19y-g2g9-a2ee-51j2", "uid": "baea4d9c515887b80289d5c33cf01145", "url": "rtmp://a.rtmp.youtube.com/live2" } ] } ``` ## Create a new output, connected to a live input `client.Stream.LiveInputs.Outputs.New(ctx, liveInputIdentifier, params) (*Output, error)` **post** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs` Creates a new output that can be used to simulcast or restream live video to other RTMP or SRT destinations. Outputs are always linked to a specific live input — one live input can have many outputs. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `params LiveInputOutputNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `StreamKey param.Field[string]` Body param: The streamKey used to authenticate against an output's target. - `URL param.Field[string]` Body param: The URL an output uses to restream. - `Enabled param.Field[bool]` Body param: When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. ### Returns - `type Output struct{…}` - `Enabled bool` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `StreamKey string` The streamKey used to authenticate against an output's target. - `UID string` A unique identifier for the output. - `URL string` The URL an output uses to restream. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) output, err := client.Stream.LiveInputs.Outputs.New( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", stream.LiveInputOutputNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), StreamKey: cloudflare.F("uzya-f19y-g2g9-a2ee-51j2"), URL: cloudflare.F("rtmp://a.rtmp.youtube.com/live2"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", output.UID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "enabled": true, "streamKey": "uzya-f19y-g2g9-a2ee-51j2", "uid": "baea4d9c515887b80289d5c33cf01145", "url": "rtmp://a.rtmp.youtube.com/live2" } } ``` ## Update an output `client.Stream.LiveInputs.Outputs.Update(ctx, liveInputIdentifier, outputIdentifier, params) (*Output, error)` **put** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}` Updates the state of an output. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `outputIdentifier string` A unique identifier for the output. - `params LiveInputOutputUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `Enabled param.Field[bool]` Body param: When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. ### Returns - `type Output struct{…}` - `Enabled bool` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `StreamKey string` The streamKey used to authenticate against an output's target. - `UID string` A unique identifier for the output. - `URL string` The URL an output uses to restream. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) output, err := client.Stream.LiveInputs.Outputs.Update( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", "baea4d9c515887b80289d5c33cf01145", stream.LiveInputOutputUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Enabled: cloudflare.F(true), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", output.UID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "enabled": true, "streamKey": "uzya-f19y-g2g9-a2ee-51j2", "uid": "baea4d9c515887b80289d5c33cf01145", "url": "rtmp://a.rtmp.youtube.com/live2" } } ``` ## Delete an output `client.Stream.LiveInputs.Outputs.Delete(ctx, liveInputIdentifier, outputIdentifier, body) error` **delete** `/accounts/{account_id}/stream/live_inputs/{live_input_identifier}/outputs/{output_identifier}` Deletes an output and removes it from the associated live input. ### Parameters - `liveInputIdentifier string` A unique identifier for a live input. - `outputIdentifier string` A unique identifier for the output. - `body LiveInputOutputDeleteParams` - `AccountID param.Field[string]` Identifier. ### Example ```go package main import ( "context" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/stream" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) err := client.Stream.LiveInputs.Outputs.Delete( context.TODO(), "66be4bf738797e01e1fca35a7bdecdcd", "baea4d9c515887b80289d5c33cf01145", stream.LiveInputOutputDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } } ``` #### Response ```json {} ``` ## Domain Types ### Output - `type Output struct{…}` - `Enabled bool` When enabled, live video streamed to the associated live input will be sent to the output URL. When disabled, live video will not be sent to the output URL, even when streaming to the associated live input. Use this to control precisely when you start and stop simulcasting to specific destinations like YouTube and Twitch. - `StreamKey string` The streamKey used to authenticate against an output's target. - `UID string` A unique identifier for the output. - `URL string` The URL an output uses to restream.