Skip to content
Start here

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.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Stream Write
ParametersExpand Collapse
liveInputIdentifier string

A unique identifier for a live input.

maxLength32
params LiveInputUpdateParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
DefaultCreator param.Field[string]optional

Body param: Sets the creator ID asssociated with this live input.

DeleteRecordingAfterDays param.Field[float64]optional

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.

minimum30
Enabled param.Field[bool]optional

Body param: Indicates whether the live input is enabled and can accept streams.

Meta param.Field[unknown]optional

Body param: A user modifiable key-value store used to reference other systems of record for managing live inputs.

Recording param.Field[LiveInputUpdateParamsRecording]optional

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 []stringoptional

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 booloptional

Disables reporting the number of live viewers when this property is set to true.

Mode LiveInputUpdateParamsRecordingModeoptional

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.

One of the following:
const LiveInputUpdateParamsRecordingModeOff LiveInputUpdateParamsRecordingMode = "off"
const LiveInputUpdateParamsRecordingModeAutomatic LiveInputUpdateParamsRecordingMode = "automatic"
RequireSignedURLs booloptional

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 int64optional

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.

ReturnsExpand Collapse
type LiveInput struct{…}

Details about a live input.

Created Timeoptional

The date and time the live input was created.

formatdate-time
DeleteRecordingAfterDays float64optional

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.

minimum30
Enabled booloptional

Indicates whether the live input is enabled and can accept streams.

Meta unknownoptional

A user modifiable key-value store used to reference other systems of record for managing live inputs.

Modified Timeoptional

The date and time the live input was last modified.

formatdate-time
Recording LiveInputRecordingoptional

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 []stringoptional

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 booloptional

Disables reporting the number of live viewers when this property is set to true.

Mode LiveInputRecordingModeoptional

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.

One of the following:
const LiveInputRecordingModeOff LiveInputRecordingMode = "off"
const LiveInputRecordingModeAutomatic LiveInputRecordingMode = "automatic"
RequireSignedURLs booloptional

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 int64optional

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 LiveInputRtmpsoptional

Details for streaming to an live input using RTMPS.

StreamKey stringoptional

The secret key to use when streaming via RTMPS to a live input.

URL stringoptional

The RTMPS URL you provide to the broadcaster, which they stream live video to.

RtmpsPlayback LiveInputRtmpsPlaybackoptional

Details for playback from an live input using RTMPS.

StreamKey stringoptional

The secret key to use for playback via RTMPS.

URL stringoptional

The URL used to play live video over RTMPS.

Srt LiveInputSrtoptional

Details for streaming to a live input using SRT.

Passphrase stringoptional

The secret key to use when streaming via SRT to a live input.

StreamID stringoptional

The identifier of the live input to use when streaming via SRT.

URL stringoptional

The SRT URL you provide to the broadcaster, which they stream live video to.

SrtPlayback LiveInputSrtPlaybackoptional

Details for playback from an live input using SRT.

Passphrase stringoptional

The secret key to use for playback via SRT.

StreamID stringoptional

The identifier of the live input to use for playback via SRT.

URL stringoptional

The URL used to play live video over SRT.

Status LiveInputStatusoptional

The connection status of a live input.

One of the following:
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 stringoptional

A unique identifier for a live input.

maxLength32
WebRtc LiveInputWebRtcoptional

Details for streaming to a live input using WebRTC.

URL stringoptional

The WebRTC URL you provide to the broadcaster, which they stream live video to.

WebRtcPlayback LiveInputWebRtcPlaybackoptional

Details for playback from a live input using WebRTC.

URL stringoptional

The URL used to play live video over WebRTC.

Update a live input

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)
}
{
  "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"
    }
  }
}
Returns Examples
{
  "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"
    }
  }
}