Skip to content

Commit

Permalink
Merge pull request #94 from apivideo/feat/live-restreaming
Browse files Browse the repository at this point in the history
Feat/live restreaming
  • Loading branch information
bot-api-video committed Jun 28, 2023
2 parents c76e0e5 + 620d32b commit 88625aa
Show file tree
Hide file tree
Showing 30 changed files with 324 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ docs/RawStatisticsListLiveStreamAnalyticsResponse.md
docs/RawStatisticsListPlayerSessionEventsResponse.md
docs/RawStatisticsListSessionsResponse.md
docs/RefreshTokenPayload.md
docs/RestreamsRequestObject.md
docs/RestreamsResponseObject.md
docs/TokenCreationPayload.md
docs/TokenListResponse.md
docs/UploadToken.md
Expand Down Expand Up @@ -144,6 +146,8 @@ src/ApiVideo.Test/Model/RawStatisticsListLiveStreamAnalyticsResponseTests.cs
src/ApiVideo.Test/Model/RawStatisticsListPlayerSessionEventsResponseTests.cs
src/ApiVideo.Test/Model/RawStatisticsListSessionsResponseTests.cs
src/ApiVideo.Test/Model/RefreshTokenPayloadTests.cs
src/ApiVideo.Test/Model/RestreamsRequestObjectTests.cs
src/ApiVideo.Test/Model/RestreamsResponseObjectTests.cs
src/ApiVideo.Test/Model/TokenCreationPayloadTests.cs
src/ApiVideo.Test/Model/TokenListResponseTests.cs
src/ApiVideo.Test/Model/UploadTokenTests.cs
Expand Down Expand Up @@ -241,6 +245,8 @@ src/ApiVideo/Model/RawStatisticsListLiveStreamAnalyticsResponse.cs
src/ApiVideo/Model/RawStatisticsListPlayerSessionEventsResponse.cs
src/ApiVideo/Model/RawStatisticsListSessionsResponse.cs
src/ApiVideo/Model/RefreshTokenPayload.cs
src/ApiVideo/Model/RestreamsRequestObject.cs
src/ApiVideo/Model/RestreamsResponseObject.cs
src/ApiVideo/Model/TokenCreationPayload.cs
src/ApiVideo/Model/TokenListResponse.cs
src/ApiVideo/Model/UploadToken.cs
Expand Down
2 changes: 1 addition & 1 deletion .openapi-generator/oas_apivideo.yaml-defaut-cli.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
aae56c93a2e3a6a1d04f6bd5a6ec47ba503646799e98307d3139e8ceb92a730c
3eb2afd3380a2e1194d21245be70de774173595baf3a06fefd0c9c8d1c7f7f58
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog
All changes to this project will be documented in this file.

## [1.3.0] - 2023-06-19
## [1.3.0] - 2023-06-28
- Introducing live streams restream feature
- Introducing new analytics endpoints

## [1.2.7] - 2022-09-13
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ Method | HTTP request | Description
- [RawStatisticsListPlayerSessionEventsResponse](docs/RawStatisticsListPlayerSessionEventsResponse.md)
- [RawStatisticsListSessionsResponse](docs/RawStatisticsListSessionsResponse.md)
- [RefreshTokenPayload](docs/RefreshTokenPayload.md)
- [RestreamsRequestObject](docs/RestreamsRequestObject.md)
- [RestreamsResponseObject](docs/RestreamsResponseObject.md)
- [TokenCreationPayload](docs/TokenCreationPayload.md)
- [TokenListResponse](docs/TokenListResponse.md)
- [UploadToken](docs/UploadToken.md)
Expand Down
1 change: 1 addition & 0 deletions docs/LiveStream.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**Assets** | [**LiveStreamAssets**](LiveStreamAssets.md) | | [optional]
**PlayerId** | **string** | The unique identifier for the player. | [optional]
**Broadcasting** | **bool** | Whether or not you are broadcasting the live video you recorded for others to see. True means you are broadcasting to viewers, false means you are not. | [optional]
**Restreams** | [**List<RestreamsResponseObject>**](RestreamsResponseObject.md) | Returns the list of RTMP restream destinations. |
**CreatedAt** | **DateTime** | When the player was created, presented in ISO-8601 format. | [optional]
**UpdatedAt** | **DateTime** | When the player was last updated, presented in ISO-8601 format. | [optional]

Expand Down
1 change: 1 addition & 0 deletions docs/LiveStreamCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
**Record** | **bool** | Whether you are recording or not. True for record, false for not record. | [optional] [default to false]
**Public** | **bool** | Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. Learn more about the Private Video feature [here](https://docs.api.video/docs/private-videos). | [optional]
**PlayerId** | **string** | The unique identifier for the player. | [optional]
**Restreams** | [**List<RestreamsRequestObject>**](RestreamsRequestObject.md) | Use this parameter to add, edit, or remove RTMP services where you want to restream a live stream. The list can only contain up to 5 destinations. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

1 change: 1 addition & 0 deletions docs/LiveStreamUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
**Public** | **bool** | Whether your video can be viewed by everyone, or requires authentication to see it. A setting of false will require a unique token for each view. Learn more about the Private Video feature [here](https://docs.api.video/docs/private-videos). | [optional]
**Record** | **bool** | Use this to indicate whether you want the recording on or off. On is true, off is false. | [optional]
**PlayerId** | **string** | The unique ID for the player associated with a live stream that you want to update. | [optional]
**Restreams** | [**List<RestreamsRequestObject>**](RestreamsRequestObject.md) | Use this parameter to add, edit, or remove RTMP services where you want to restream a live stream. The list can only contain up to 5 destinations. This operation updates all restream destinations in the same request. If you do not want to modify an existing restream destination, you need to include it in your request, otherwise it is removed. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

3 changes: 3 additions & 0 deletions docs/LiveStreamsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ var liveStreamCreationPayload = new LiveStreamCreationPayload()
name = "My Live Stream Video",
_public = true,
playerid = "pl4f4ferf5erfr5zed4fsdd",
restreams = new List<RestreamsRequestObject>(){
new RestreamsRequestObject(){name="My RTMP server", streamKey="dw-dew8-q6w9-k67w-1ws8", serverUrl="rtmp://my.broadcast.example.com/app" }
}
};

try
Expand Down
13 changes: 13 additions & 0 deletions docs/RestreamsRequestObject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# ApiVideo.Model.RestreamsRequestObject
Adding restream destinations is optional. However, if you set a restream destination, you must provide all attributes for each destination.

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | Use this parameter to define a name for the restream destination. |
**ServerUrl** | **string** | Use this parameter to set the RTMP URL of the restream destination. |
**StreamKey** | **string** | Use this parameter to provide the unique key of the live stream that you want to restream. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

12 changes: 12 additions & 0 deletions docs/RestreamsResponseObject.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ApiVideo.Model.RestreamsResponseObject

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | Returns the name of a restream destination. | [optional]
**ServerUrl** | **string** | Returns the RTMP URL of a restream destination. | [optional]
**StreamKey** | **string** | Returns the unique key of the live stream that is set up for restreaming. | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

6 changes: 3 additions & 3 deletions src/Api/LiveStreamsApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public ApiResponse<LiveStream> createWithHttpInfo(LiveStreamCreationPayload live
if (liveStreamCreationPayload != null && liveStreamCreationPayload.name == null) {
throw new ApiException(400,"Missing required parameter 'liveStreamCreationPayload.Name' when calling LiveStreamsApi->create");
}

// verify the required parameter 'liveStreamCreationPayload' is set
if (liveStreamCreationPayload == null)
throw new ApiException(400, "Missing required parameter 'liveStreamCreationPayload' when calling LiveStreamsApi->create");
Expand Down Expand Up @@ -214,11 +214,11 @@ public ApiResponse<LiveStream> updateWithHttpInfo(string liveStreamId, LiveStrea
if (liveStreamUpdatePayload == null)
throw new ApiException(400,"Missing required parameter 'liveStreamUpdatePayload' when calling LiveStreamsApi->update");


if (liveStreamUpdatePayload == null)
throw new ApiException(400,"Missing required parameter 'liveStreamUpdatePayload' when calling LiveStreamsApi->update");


// verify the required parameter 'liveStreamId' is set
if (liveStreamId == null)
throw new ApiException(400, "Missing required parameter 'liveStreamId' when calling LiveStreamsApi->update");
Expand Down
8 changes: 8 additions & 0 deletions src/Model/LiveStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ public class LiveStream {
[JsonProperty(PropertyName = "broadcasting")]
public Nullable<bool> broadcasting { get; set; }
/// <summary>
/// Returns the list of RTMP restream destinations.
/// </summary>
/// <value>Returns the list of RTMP restream destinations.</value>
[DataMember(Name="restreams", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "restreams")]
public List<RestreamsResponseObject> restreams { get; set; }
/// <summary>
/// When the player was created, presented in ISO-8601 format.
/// </summary>
/// <value>When the player was created, presented in ISO-8601 format.</value>
Expand Down Expand Up @@ -98,6 +105,7 @@ public class LiveStream {
sb.Append(" Assets: ").Append(assets).Append("\n");
sb.Append(" PlayerId: ").Append(playerid).Append("\n");
sb.Append(" Broadcasting: ").Append(broadcasting).Append("\n");
sb.Append(" Restreams: ").Append(restreams).Append("\n");
sb.Append(" CreatedAt: ").Append(createdat).Append("\n");
sb.Append(" UpdatedAt: ").Append(updatedat).Append("\n");
sb.Append("}\n");
Expand Down
8 changes: 8 additions & 0 deletions src/Model/LiveStreamCreationPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public class LiveStreamCreationPayload {
[DataMember(Name="playerId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "playerId")]
public string playerid { get; set; }
/// <summary>
/// Use this parameter to add, edit, or remove RTMP services where you want to restream a live stream. The list can only contain up to 5 destinations.
/// </summary>
/// <value>Use this parameter to add, edit, or remove RTMP services where you want to restream a live stream. The list can only contain up to 5 destinations.</value>
[DataMember(Name="restreams", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "restreams")]
public List<RestreamsRequestObject> restreams { get; set; }


/// <summary>
Expand All @@ -61,6 +68,7 @@ record = false;
sb.Append(" Record: ").Append(record).Append("\n");
sb.Append(" Public: ").Append(_public).Append("\n");
sb.Append(" PlayerId: ").Append(playerid).Append("\n");
sb.Append(" Restreams: ").Append(restreams).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down
8 changes: 8 additions & 0 deletions src/Model/LiveStreamUpdatePayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ public class LiveStreamUpdatePayload {
[DataMember(Name="playerId", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "playerId")]
public string playerid { get; set; }
/// <summary>
/// Use this parameter to add, edit, or remove RTMP services where you want to restream a live stream. The list can only contain up to 5 destinations. This operation updates all restream destinations in the same request. If you do not want to modify an existing restream destination, you need to include it in your request, otherwise it is removed.
/// </summary>
/// <value>Use this parameter to add, edit, or remove RTMP services where you want to restream a live stream. The list can only contain up to 5 destinations. This operation updates all restream destinations in the same request. If you do not want to modify an existing restream destination, you need to include it in your request, otherwise it is removed.</value>
[DataMember(Name="restreams", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "restreams")]
public List<RestreamsRequestObject> restreams { get; set; }


/// <summary>
Expand All @@ -53,6 +60,7 @@ public class LiveStreamUpdatePayload {
sb.Append(" Public: ").Append(_public).Append("\n");
sb.Append(" Record: ").Append(record).Append("\n");
sb.Append(" PlayerId: ").Append(playerid).Append("\n");
sb.Append(" Restreams: ").Append(restreams).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down
61 changes: 61 additions & 0 deletions src/Model/RestreamsRequestObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace ApiVideo.Model {

/// <summary>
/// Adding restream destinations is optional. However, if you set a restream destination, you must provide all attributes for each destination.
/// </summary>
[DataContract]
public class RestreamsRequestObject {
/// <summary>
/// Use this parameter to define a name for the restream destination.
/// </summary>
/// <value>Use this parameter to define a name for the restream destination.</value>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string name { get; set; }
/// <summary>
/// Use this parameter to set the RTMP URL of the restream destination.
/// </summary>
/// <value>Use this parameter to set the RTMP URL of the restream destination.</value>
[DataMember(Name="serverUrl", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serverUrl")]
public string serverurl { get; set; }
/// <summary>
/// Use this parameter to provide the unique key of the live stream that you want to restream.
/// </summary>
/// <value>Use this parameter to provide the unique key of the live stream that you want to restream.</value>
[DataMember(Name="streamKey", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "streamKey")]
public string streamkey { get; set; }


/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class RestreamsRequestObject {\n");
sb.Append(" Name: ").Append(name).Append("\n");
sb.Append(" ServerUrl: ").Append(serverurl).Append("\n");
sb.Append(" StreamKey: ").Append(streamkey).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}

}
}
61 changes: 61 additions & 0 deletions src/Model/RestreamsResponseObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace ApiVideo.Model {

/// <summary>
///
/// </summary>
[DataContract]
public class RestreamsResponseObject {
/// <summary>
/// Returns the name of a restream destination.
/// </summary>
/// <value>Returns the name of a restream destination.</value>
[DataMember(Name="name", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "name")]
public string name { get; set; }
/// <summary>
/// Returns the RTMP URL of a restream destination.
/// </summary>
/// <value>Returns the RTMP URL of a restream destination.</value>
[DataMember(Name="serverUrl", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "serverUrl")]
public string serverurl { get; set; }
/// <summary>
/// Returns the unique key of the live stream that is set up for restreaming.
/// </summary>
/// <value>Returns the unique key of the live stream that is set up for restreaming.</value>
[DataMember(Name="streamKey", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "streamKey")]
public string streamkey { get; set; }


/// <summary>
/// Get the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString() {
var sb = new StringBuilder();
sb.Append("class RestreamsResponseObject {\n");
sb.Append(" Name: ").Append(name).Append("\n");
sb.Append(" ServerUrl: ").Append(serverurl).Append("\n");
sb.Append(" StreamKey: ").Append(streamkey).Append("\n");
sb.Append("}\n");
return sb.ToString();
}

/// <summary>
/// Get the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public string ToJson() {
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
"createdAt" : "2020-07-29T10:45:35.000Z",
"updatedAt" : "2020-07-29T10:45:35.000Z",
"streamKey" : "cc1b4df0-d1c5-4064-a8f9-9f0368385135",
"restreams" : [ {
"name" : "YouTube",
"serverUrl" : "rtmp://youtube.broadcast.example.com",
"streamKey" : "cc1b4df0-d1c5-4064-a8f9-9f0368385135"
}, {
"name" : "Twitch",
"serverUrl" : "rtmp://twitch.broadcast.example.com",
"streamKey" : "cc1b4df0-d1c5-4064-a8f9-9f0368385135"
} ],
"name" : "Live From New York",
"public" : true,
"record" : true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "This value should not be blank.",
"name" : "restreams[0][name]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "Missing app name: rtmp://[host]/[app name].",
"name" : "restreams[0][serverUrl]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "RTMP URL should have the following format: rtmp://[host]/[app name].",
"name" : "restreams[0][serverUrl]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "This collection should contain 5 elements or less.",
"name" : "restreams"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type" : "https://docs.api.video/reference/invalid-attribute",
"title" : "An attribute is invalid.",
"status" : 400,
"detail" : "This value should not be null.",
"name" : "restreams[0][name]"
}

0 comments on commit 88625aa

Please sign in to comment.