diff --git a/provider/provider.go b/provider/provider.go index dcaa9e6c..05c56925 100644 --- a/provider/provider.go +++ b/provider/provider.go @@ -94,6 +94,7 @@ type OutputFile struct { VideoCodec string `json:"videoCodec"` Height int64 `json:"height"` Width int64 `json:"width"` + FileSize int64 `json:"fileSize"` } // SourceInfo contains information about media transcoded using the Transcoding diff --git a/provider/zencoder/zencoder.go b/provider/zencoder/zencoder.go index 6ad81599..41dd45f0 100644 --- a/provider/zencoder/zencoder.go +++ b/provider/zencoder/zencoder.go @@ -329,6 +329,7 @@ func (z *zencoderProvider) getJobOutputs(job *db.Job, outputMediaFiles []*zencod VideoCodec: mediaFile.VideoCodec, Width: int64(mediaFile.Width), Height: int64(mediaFile.Height), + FileSize: mediaFile.FileSizeInBytes, } if mediaFile.State == "finished" && mediaFile.Format == "" && strings.HasSuffix(mediaFile.Url, "m3u8") { file.Container = "m3u8" diff --git a/provider/zencoder/zencoder_fake_test.go b/provider/zencoder/zencoder_fake_test.go index fae8afaf..195d2d7d 100644 --- a/provider/zencoder/zencoder_fake_test.go +++ b/provider/zencoder/zencoder_fake_test.go @@ -39,20 +39,22 @@ func (z *FakeZencoder) GetJobDetails(id int64) (*zencoder.JobDetails, error) { SubmittedAt: "2016-11-05T05:02:57Z", OutputMediaFiles: []*zencoder.MediaFile{ { - Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4", - Format: "mp4", - VideoCodec: "h264", - Width: 1920, - Height: 1080, - DurationInMs: 10000, + Url: "https://mybucket.s3.amazonaws.com/destination-dir/output1.mp4", + Format: "mp4", + VideoCodec: "h264", + Width: 1920, + Height: 1080, + DurationInMs: 10000, + FileSizeInBytes: 66885256, }, { - Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm", - Format: "webm", - VideoCodec: "vp8", - Width: 1080, - Height: 720, - DurationInMs: 10000, + Url: "https://mybucket.s3.amazonaws.com/destination-dir/output2.webm", + Format: "webm", + VideoCodec: "vp8", + Width: 1080, + Height: 720, + DurationInMs: 10000, + FileSizeInBytes: 92140022, }, }, }, diff --git a/provider/zencoder/zencoder_test.go b/provider/zencoder/zencoder_test.go index 0ca234e4..4acbdd43 100644 --- a/provider/zencoder/zencoder_test.go +++ b/provider/zencoder/zencoder_test.go @@ -893,10 +893,12 @@ func TestZencoderJobStatus(t *testing.T) { "videoCodec": "h264", "height": float64(1080), "width": float64(1920), + "fileSize": float64(66885256), }, map[string]interface{}{ "height": float64(720), "width": float64(1080), + "fileSize": float64(92140022), "path": "s3://mybucket/destination-dir/output2.webm", "container": "webm", "videoCodec": "vp8", @@ -934,10 +936,12 @@ func TestZencoderJobStatus(t *testing.T) { "videoCodec": "h264", "height": float64(1080), "width": float64(1920), + "fileSize": float64(66885256), }, map[string]interface{}{ "height": float64(720), "width": float64(1080), + "fileSize": float64(92140022), "path": "s3://mybucket/destination-dir/output2.webm", "container": "webm", "videoCodec": "vp8",