Streams

Streams API endpoints

Streams are representations of video to be worked on by miners on the VideoCoin Network and output consumable video based on the transcoding profile given at creation.

Streams currently support video input over RTMP, WebRTC and FILE.

Properties

Property

Description

id

ID that VideoCoin uses to uniquely identify each stream

name

Name of the stream

output_url

Unique output URL of transcoded video

stream_contract_id

Stream ID in VideoCoin stream chain

stream_contract_address

Stream hex address in VideoCoin chain. Empty until stream is in prepared state

status

Status of the stream's operational state

Read "List of stream statuses" for more information

input_type

Type of input to create stream with

Read "List of input types" for more information

output_type

Type of output stream to produce

Read "List of output types" for more information

input_status

Status of the stream's video ingest

Read "List of ingest statuses" for more information

created_at

Date and time of when stream was initially created

updated_at

Date and time of when stream's state was last changed

ready_at

Date and time of when stream's ingest has received and completed processing input video data. This field will be null until stream is in ready state

completed_at

Date and time of when stream was called to stop. This field will be null until stream is in completed state

rtmp_url

Unique ingest RTMP URL for stream to receive video data from encoder. This URL is used for your encoder to send data to

List of stream statuses (status)

The status of a stream is affected by API calls made on a stream object. Below are the states that describe the lifecycle of a stream:

Status

Description

STREAM_STATUS_NEW

Initially created and no actions have been taken

STREAM_STATUS_PREPARING

Running and preparing input and output destinations

STREAM_STATUS_PREPARED

Preparation is finished and is ready to consume input data

STREAM_STATUS_PENDING

Receiving data and pending on miner to be assigned to stream

STREAM_STATUS_PROCESSING

Miner has started work on stream, but output is not ready for use

STREAM_STATUS_READY

Output destination is ready to be consumed

STREAM_STATUS_COMPLETED

Stream has successfully transcoded video and stream was explicitly stopped or encoder has stopped

STREAM_STATUS_CANCELLED

Stream has not yet received any input data and has been cancelled

STREAM_STATUS_FAILED

Stream has attempted to transcode video received, but problems with the transcoder or account caused it to fail

List of input type (input_type)

The type of input to be provided to ingest stream.

Input Type

Description

INPUT_TYPE_RTMP

The stream will be ingested over RTMP protocol

INPUT_TYPE_WEBRTC

The stream will be ingested over WEBRTC protocol

INPUT_TYPE_FILE

The stream will be ingested by file upload or file link

List of output type (input_type)

The type of output to be produces by stream.

Input Type

Description

OUTPUT_TYPE_HLS

HLS playlist LIVE or VOD depends on stream input type

List of ingest statuses (input_status)

The status of a stream's ingest is affected by the state of the encoder that's sending video data to the stream. Below are the states the ingest can be in:

Ingest Status

Description

INPUT_STATUS_NONE

The stream has been created or has ended and is not receiving any input

INPUT_STATUS_PENDING

Ingest is awaiting for incoming data

INPUT_STATUS_ACTIVE

Ingest is receiving data

INPUT_STATUS_ERROR

Ingest has been failed to process incoming data

get
Get Streams

https://console.videocoin.network/api/v1/streams
This API call gets all streams that belongs to a specific account:
Request
Response
Request
Headers
Authorization
required
string
Authorization bearer token
Response
200: OK
List of streams successfully retrieved.
{
"items": [
{
"id": "005fec0a-6637-479e-46b8-2820b6daf1fa",
"name": "Live Office",
"output_url": "https://streams.videocoin.network/005fec0a-6637-479e-46b8-2820b6daf1fa/index.m3u8",
"stream_contract_id": "3716579677242232723",
"stream_contract_address": "0x928e3CDdcf6a962266439A5BF4036573D452BabF",
"status": "STREAM_STATUS_NEW",
"input_status": "INPUT_STATUS_NONE",
"created_at": "2019-10-31T08:09:21Z",
"updated_at": "2019-10-31T08:09:21Z",
"ready_at": null,
"completed_at": null,
"rtmp_url": "rtmp://rtmp.studio.videocoin.network:1935/live/005fec0a-6637-479e-46b8-2820b6daf1fa",
"input_type": "INPUT_TYPE_RTMP",
"output_type": "OUTPUT_TYPE_HLS"
},
{
"id": "2bd9193e-260d-4cee-6d67-08e79260c1ad",
"name": "Live Streetst",
"output_url": "https://streams.videocoin.network/2bd9193e-260d-4cee-6d67-08e79260c1ad/index.m3u8",
"stream_contract_id": "5649666304257966074",
"stream_contract_address": "0xc6d37D66E830b68ba1F07f1f4E98aA592dc60F67",
"status": "STREAM_STATUS_COMPLETED",
"input_status": "INPUT_STATUS_NONE",
"created_at": "2019-10-28T21:18:37Z",
"updated_at": "2019-10-28T21:20:56Z",
"ready_at": "2019-10-28T21:19:32Z",
"completed_at": "2019-10-28T21:20:56Z",
"rtmp_url": "rtmp://rtmp.studio.videocoin.network:1935/live/2bd9193e-260d-4cee-6d67-08e79260c1ad",
"input_type": "INPUT_TYPE_RTMP",
"output_type": "OUTPUT_TYPE_HLS"
}
]
}

get
Get Stream

https://console.videocoin.network/api/v1/streams/{id}
This API call gets the details of the stream associated with the ID passed. The stream must belong to the account specified:
Request
Response
Request
Path Parameters
id
required
string
Stream ID
Headers
Authorization
required
string
Authorization bearer token
Response
200: OK
Stream successfully retrieved by it's id.
{
"id": "4a1c3973-8cf6-49af-4a56-7a1d49c2bac6",
"name": "Live",
"output_url": "https://streams.videocoin.network/4a1c3973-8cf6-49af-4a56-7a1d49c2bac6/index.m3u8",
"stream_contract_id": "2758350251200610030",
"stream_contract_address": "0x543f217337975955457a6E2E8c82a7ED1a7fF51d",
"status": "STREAM_STATUS_NONE",
"input_status": "INPUT_STATUS_NONE",
"created_at": "2019-11-06T19:31:03Z",
"updated_at": "2019-11-06T19:31:10Z",
"ready_at": null,
"completed_at": null,
"rtmp_url": "rtmp://rtmp.studio.videocoin.network:1935/live/4a1c3973-8cf6-49af-4a56-7a1d49c2bac6",
"input_type": "INPUT_TYPE_RTMP",
"output_type": "OUTPUT_TYPE_HLS"
}
404: Not Found
Stream was not found.
{
"message": "Not found",
"fields": null
}

post
Create Stream

https://console.videocoin.network/api/v1/streams
This API call creates a new stream with the specified name and output transcoding profile. A stream object is returned from this API call:
Request
Response
Request
Headers
Content-Type
required
string
Content-Type must be specified as application/json
Authorization
required
string
Authorization bearer token
Body Parameters
name
required
string
Name of stream being created. Length is between 1 and 255 symbols.
profile_id
required
string
ID of output transcoding profile that will be used to transcode the incoming stream. Read more under Profiles section
Response
200: OK
Stream has been successfully created.
{
"id": "4a1c3973-8cf6-49af-4a56-7a1d49c2bac6",
"name": "Live",
"output_url": "https://streams.videocoin.network/4a1c3973-8cf6-49af-4a56-7a1d49c2bac6/index.m3u8",
"stream_contract_id": "2758350251200610030",
"stream_contract_address": "",
"status": "STREAM_STATUS_NEW",
"input_status": "INPUT_STATUS_NONE",
"created_at": "2019-11-06T19:31:03.059408235Z",
"updated_at": "2019-11-06T19:31:03.059460430Z",
"ready_at": null,
"completed_at": null,
"rtmp_url": "rtmp://rtmp.studio.videocoin.network:1935/live/4a1c3973-8cf6-49af-4a56-7a1d49c2bac6",
"input_type": "INPUT_TYPE_RTMP",
"output_type": "OUTPUT_TYPE_HLS"
}
400: Bad Request
Stream has been failed to create because a required field is missing.
{
"message": "invalid argument",
"fields": {
"name": "Name is a required field"
}
}

delete
Delete Stream

https://console.videocoin.network/api/v1/streams/{id}
This API call deletes the stream with the specified ID:
Request
Response
Request
Path Parameters
id
required
string
Stream ID
Headers
Authorization
required
string
Authorization Bearer token
Response
200: OK
404: Not Found
Stream was not found.
{
"message": "Not found",
"fields": null
}

post
Run Stream

https://console.videocoin.network/api/v1/streams/{id}/run
This API call transitions a newly created stream to begin preparing input and output destinations:
Request
Response
Request
Path Parameters
id
required
string
Stream ID
Headers
Authorization
required
string
Authorization bearer token
Response
200: OK
Stream has been successfully ran.
404: Not Found
Stream was not found.
{
"message": "Not found",
"fields": null
}

post
Stop Stream

https://console.videocoin.network/api/v1/streams/{id}/stop
This API call stops or cancels a stream (depending on the stream's state). This is called implicitly when the encoder sending data to the input destination is stopped:
Request
Response
Request
Path Parameters
id
required
string
Stream ID
Headers
Authorization
required
string
Authorization Bearer token
Response
200: OK
Stream has been successfully cancelled.
404: Not Found
Stream was not found.
{
"message": "Not found",
"fields": null
}