diff --git a/.changelog/1088.txt b/.changelog/1088.txt new file mode 100644 index 00000000000..ac1759d7a4b --- /dev/null +++ b/.changelog/1088.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +stream: added metadata support +``` \ No newline at end of file diff --git a/stream.go b/stream.go index e12630495ae..af04468c2e6 100644 --- a/stream.go +++ b/stream.go @@ -103,6 +103,7 @@ type StreamUploadFromURLParameters struct { AllowedOrigins []string `json:"allowedOrigins,omitempty"` RequiredSignedURLs bool `json:"requiredSignedURLs,omitempty"` Watermark UploadVideoURLWatermark `json:"watermark,omitempty"` + Meta map[string]interface{} `json:"meta,omitempty"` } // StreamCreateVideoParameters are parameters used when creating a video. @@ -115,6 +116,7 @@ type StreamCreateVideoParameters struct { AllowedOrigins []string `json:"allowedOrigins,omitempty"` RequiredSignedURLs bool `json:"requiredSignedURLs,omitempty"` Watermark UploadVideoURLWatermark `json:"watermark,omitempty"` + Meta map[string]interface{} `json:"meta,omitempty"` } // UploadVideoURLWatermark represents UID of an existing watermark. diff --git a/stream_test.go b/stream_test.go index eb821cec61a..5472da1ce73 100644 --- a/stream_test.go +++ b/stream_test.go @@ -28,7 +28,9 @@ const ( "width": 1920 }, "maxDurationSeconds": 300, - "meta": {}, + "meta": { + "name": "My First Stream Video" + }, "modified": "2014-01-02T02:20:00Z", "uploadExpiry": "2014-01-02T02:20:00Z", "playback": { @@ -121,7 +123,9 @@ func createTestVideo() StreamVideo { Scale: 0.1, Position: "center", }, - Meta: map[string]interface{}{}, + Meta: map[string]interface{}{ + "name": "My First Stream Video", + }, NFT: StreamVideoNFTParameters{ Token: 5, Contract: "0x57f1887a8bf19b14fc0d912b9b2acc9af147ea85", @@ -155,6 +159,9 @@ func TestStream_StreamUploadFromURL(t *testing.T) { input := StreamUploadFromURLParameters{ AccountID: testAccountID, URL: "https://example.com/myvideo.mp4", + Meta: map[string]interface{}{ + "name": "My First Stream Video", + }, } out, err := client.StreamUploadFromURL(context.Background(), input) @@ -241,7 +248,9 @@ func TestStream_CreateVideoDirectURL(t *testing.T) { assert.Equal(t, ErrMissingMaxDuration, err) } - input := StreamCreateVideoParameters{AccountID: testAccountID, MaxDurationSeconds: 300} + input := StreamCreateVideoParameters{AccountID: testAccountID, MaxDurationSeconds: 300, Meta: map[string]interface{}{ + "name": "My First Stream Video", + }} out, err := client.StreamCreateVideoDirectURL(context.Background(), input) created, _ := time.Parse(time.RFC3339, "2014-01-02T02:20:00Z") @@ -291,7 +300,9 @@ func TestStream_ListVideos(t *testing.T) { "width": 1920 }, "maxDurationSeconds": 300, - "meta": {}, + "meta": { + "name": "My First Stream Video" + }, "modified": "2014-01-02T02:20:00Z", "uploadExpiry": "2014-01-02T02:20:00Z", "playback": {