Skip to content

Commit

Permalink
Merge pull request #1190 from ryotarai/fix-duration-of-video-type
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz authored Jun 6, 2023
2 parents 4ad0491 + 5584c5b commit 8719971
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changelog/1190.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
stream: Fix a bug that cannot unmarshal video duration number.
```

```release-note:breaking-change
stream: StreamVideo.Duration has changed from int to float64.
```
2 changes: 1 addition & 1 deletion stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
type StreamVideo struct {
AllowedOrigins []string `json:"allowedOrigins,omitempty"`
Created *time.Time `json:"created,omitempty"`
Duration int `json:"duration,omitempty"`
Duration float64 `json:"duration,omitempty"`
Input StreamVideoInput `json:"input,omitempty"`
MaxDurationSeconds int `json:"maxDurationSeconds,omitempty"`
Meta map[string]interface{} `json:"meta,omitempty"`
Expand Down
6 changes: 3 additions & 3 deletions stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (
"example.com"
],
"created": "2014-01-02T02:20:00Z",
"duration": 300,
"duration": 300.5,
"input": {
"height": 1080,
"width": 1920
Expand Down Expand Up @@ -86,7 +86,7 @@ func createTestVideo() StreamVideo {
return StreamVideo{
AllowedOrigins: []string{"example.com"},
Created: &created,
Duration: 300,
Duration: 300.5,
Input: StreamVideoInput{Height: 1080, Width: 1920},
MaxDurationSeconds: 300,
Modified: &modified,
Expand Down Expand Up @@ -285,7 +285,7 @@ func TestStream_ListVideos(t *testing.T) {
"example.com"
],
"created": "2014-01-02T02:20:00Z",
"duration": 300,
"duration": 300.5,
"input": {
"height": 1080,
"width": 1920
Expand Down

0 comments on commit 8719971

Please sign in to comment.