Push

Start Push Publishing

SRT, RTMP 또는 MPEG2-TS Stream의Push Publishing을 시작합니다. 요청한 Stream이 Server에 존재하지 않으면, 이 Task는 예약됩니다. 이후 해당 Stream이 생성되면 Push Publishing이 자동으로 시작됩니다.

Request

chevron-rightPOST /v1/vhosts/{vhost}/apps/{app}:startPushhashtag

Header

Authorization: Basic {credentials}

# Authorization
    Credentials for HTTP Basic Authentication created with <AccessToken>

Body : SRT

{
  "id": "{unique_push_id}",
  "stream": {
    "name": "{output_stream_name}",
    "variantNames": []
  },
  "protocol": "srt",
  "url": "srt://{host}[:port]?mode=caller&latency=120000&timeout=500000",
  "streamKey": ""
}

# id (required)
    unique ID to identify the task
    
# stream (required)
    ## name (required)
        output stream name
        
    ## variantNames (optional)
        Array of track names to publsh. 
        This value is Encodes.[Video|Audio|Data].Name in the OutputProfile
        setting.
        
        If empty, all tracks will be sent.

# protocol (required)
    srt
    
# url (required) 
    address of destination.
    options can be set in query-string format.
    
# streamKey (optional)
    not used with mpegts

In SRT Push Publisher, only the caller connection mode is supported.

Body : RTMP

{
  "id": "{unique_push_id}",
  "stream": {
    "name": "{output_stream_name}",
    "variantNames": [ "h264_fhd", "aac" ]
  },
  "protocol": "rtmp",
  "url":"rtmp://{host}[:port]/{app_name}",
  "streamKey":"{stream_name}"
}

# id (required)
    unique ID to identify the task
    
# stream (required)
    ## name (required)
        output stream name
        
    ## variantNames (optional)
        Array of track names to publsh. 
        This value is Encodes.[Video|Audio|Data].Name in the OutputProfile
        setting.
        
        If empty, The first track among video tracks (by ID) and the first 
        track among audio tracks (by ID) are selected automatically.

# protocol (required)
    rtmp
    
# url (required) 
    address of destination
    
# streamKey (required)
    RTMP stream key

Body : MPEG2-TS

{
  "id": "{unique_push_id}",
  "stream": {
    "name": "{output_stream_name}",
    "variantNames": []
  },
  "protocol": "mpegts",
  "url": "udp://{host}[:port]",
  "streamKey": ""
}

# id (required)
    unique ID to identify the task
    
# stream (required)
    ## name (required)
        output stream name
        
    ## variantNames (optional)
        Array of track names to publsh. 
        This value is Encodes.[Video|Audio|Data].Name in the OutputProfile
        setting.
        
        If empty, all tracks will be sent.

# protocol (required)
    mpegts
    
# url (required) 
    address of destination
    
# streamKey (optional)
    not used with mpegts

Responses

chevron-right200 Okhashtag

The request has succeeded

Header

Content-Type: application/json

Body

Please note that responses are incorrectly returned in Json array format for version 0.15.3 and earlier.

{
    "statusCode": 200,
    "message": "OK",
    "response": {
        "id": "{unique_push_id}",
        "state": "ready",
            
        "vhost": "default",
        "app": "app",
        "stream": {
            "name": "{output_stream_name}",
            "trackIds": [],
            "variantNames": []
        },
            
        "protocol": "rtmp",
        "url": "rtmp://{host}[:port]/{app_name}",
        "streamKey": "{stream_name}",
            
        "sentBytes": 0,
        "sentTime": 0,
        "sequence": 0,
        "totalsentBytes": 0,
        "totalsentTime": 0,
            
        "createdTime": "2023-03-15T23:02:34.371+09:00",
        "startTime": "1970-01-01T09:00:00.000+09:00",
        "finishTime": "1970-01-01T09:00:00.000+09:00"
    }
}

# statusCode
    Same as HTTP Status Code
# message
    A human-readable description of the response code
# response
    Created push publishing task information
chevron-right400 Bad Requesthashtag

Invalid request.

chevron-right401 Unauthorizedhashtag

Authentication required

Header

WWW-Authenticate: Basic realm=”OvenMediaEngine”

Body

{
    "message": "[HTTP] Authorization header is required to call API (401)",
    "statusCode": 401
}
chevron-right404 Not Foundhashtag

The given vhost or application name could not be found.

Body

chevron-right409 Conflicthashtag

duplicate ID

Stop Push Publishing

Request

chevron-rightPOST /v1/vhosts/{vhost}/apps/{app}:stopPushhashtag

Header

Body

Responses

chevron-right200 Okhashtag

The request has succeeded

Header

Body

chevron-right400 Bad Requesthashtag

Invalid request.

chevron-right401 Unauthorizedhashtag

Authentication required

Header

Body

chevron-right404 Not Foundhashtag

The given vhost/application name or id of recording task could not be found.

Body

Get Push Publishing State

Request

chevron-rightPOST /v1/vhosts/{vhost}/apps/{app}:pusheshashtag

Header

Body

Responses

chevron-right200 Okhashtag

The request has succeeded

Header

Body

The response is Json array format.

chevron-right401 Unauthorizedhashtag

Authentication required

Header

Body

chevron-right404 Not Foundhashtag

The given vhost or application name could not be found.

Body

State of Push Publishing

Push Publishing Task는 아래 표에 표시된 State를 가집니다. 이 State는 Start Push Publishing 및 Get Push Publishing State API의 Response에서 확인할 수 있습니다.

State
Description

ready

Waiting for the stream to be created.

connecting

Connecting to destination

pushing

Connected and streaming

stopping

Disconnection / stop in progress

stopped

Push is disconnected / stopped

error

Push encountered an error

Last updated