Updated on 2024-09-27 GMT+08:00

Querying an Ongoing Stream

Function

This API is used to query an ongoing stream.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/realtime/streams

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

publish_domain

Yes

String

Ingest domain name.

app

No

String

Application name.

offset

No

Integer

Offset, which is the position where the query starts. The value must be greater than or equal to 0.

limit

No

Integer

Number of records on each page. The value ranges from 1 to 100. The default value is 10.

stream

No

String

Stream name. If the stream parameter is carried, the app parameter cannot be set to the default value.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

X-Project-Id

No

String

Project ID. This parameter is mandatory for AK/SK authentication.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_page

Long

Total number of pages.

total_num

Long

Total number of records.

offset

Long

Offset.

limit

Long

Number of records per page.

request_id

String

Unique ID of the request.

streams

Array of OnlineInfo objects

Stream statistics.

Table 5 OnlineInfo

Parameter

Type

Description

publish_domain

String

Domain name.

app

String

Application name.

stream

String

Stream name.

video_codec

String

Video encoding format

  • H264

  • H265

audio_codec

String

Audio coding format. Value: AAC.

video_frame_rate

Long

Video frame rate, in fps.

audio_frame_rate

Long

Audio frame rate, in fps.

video_bitrate

Long

Video bitrate, in kbit/s.

audio_bitrate

Long

Audio bitrate, in kbit/s.

resolution

String

Video resolution.

client_ip

String

IP address of the device that pushes streams.

start_time

String

Time when stream pushing starts. The value is in UTC format, for example, 2006-01-02T15:04:05Z.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error Code

error_msg

String

Error description

Example Requests

GET https://{endpoint}/v1/{project_id}/realtime/streams?publish_domain=push.example.com&app=live&offset=0&limit=10

Example Responses

Status code: 200

Query succeeded.

{
  "total_page" : 1,
  "total_num" : 10,
  "offset" : 0,
  "limit" : 10,
  "request_id" : "56b9f4dc-b282-48e0-a1a9-c50ffb06b687",
  "streams" : [ {
    "publish_domain" : "push.example.com",
    "app" : "live",
    "stream" : "test",
    "video_codec" : "H264",
    "audio_codec" : "AAC",
    "video_frame_rate" : 15,
    "audio_frame_rate" : 43,
    "video_bitrate" : 588,
    "audio_bitrate" : 68,
    "resolution" : "640x360",
    "client_ip" : "192.168.0.100",
    "start_time" : "2006-01-02T15:04:05Z"
  } ]
}

Status code: 400

Query failed.

{
  "error_code" : "LIVE.100011001",
  "error_msg" : "Request Illegal"
}

Status Codes

Status Code

Description

200

Query succeeded.

400

Query failed.

Error Codes

See Error Codes.