Skip to content

Commit

Permalink
Merge pull request #1088 from Venoox/stream
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz authored Jun 6, 2023
2 parents 12117b8 + ddf231f commit 2ab9953
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/1088.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
stream: added metadata support
```
2 changes: 2 additions & 0 deletions stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ type StreamUploadFromURLParameters struct {
AllowedOrigins []string `json:"allowedOrigins,omitempty"`
RequireSignedURLs bool `json:"requireSignedURLs,omitempty"`
Watermark UploadVideoURLWatermark `json:"watermark,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
}

// StreamCreateVideoParameters are parameters used when creating a video.
Expand All @@ -115,6 +116,7 @@ type StreamCreateVideoParameters struct {
AllowedOrigins []string `json:"allowedOrigins,omitempty"`
RequireSignedURLs bool `json:"requireSignedURLs,omitempty"`
Watermark UploadVideoURLWatermark `json:"watermark,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
}

// UploadVideoURLWatermark represents UID of an existing watermark.
Expand Down
19 changes: 15 additions & 4 deletions stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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": {
Expand Down

0 comments on commit 2ab9953

Please sign in to comment.