Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(chore): increase presigned video request to 90 days
· 95e7b86a
Mark Harding
authored
Sep 26, 2019
95e7b86a
(fix): allow video to played if only 50% of transcodes available
· b0c1432e
Mark Harding
authored
Sep 26, 2019
b0c1432e
Hide whitespace changes
Inline
Side-by-side
Core/Media/TranscodingStatus.php
View file @
b0c1432e
...
@@ -80,7 +80,7 @@ class TranscodingStatus
...
@@ -80,7 +80,7 @@ class TranscodingStatus
public
function
isTranscodingComplete
()
public
function
isTranscodingComplete
()
{
{
$transcodes
=
$this
->
getTranscodes
();
$transcodes
=
$this
->
getTranscodes
();
return
(
count
(
$transcodes
)
==
=
$this
->
getExpectedTranscodeCount
());
return
(
count
(
$transcodes
)
>
=
$this
->
getExpectedTranscodeCount
());
}
}
/**
/**
...
@@ -90,7 +90,7 @@ class TranscodingStatus
...
@@ -90,7 +90,7 @@ class TranscodingStatus
{
{
return
array_reduce
(
$this
->
presets
,
function
(
$count
,
$preset
)
{
return
array_reduce
(
$this
->
presets
,
function
(
$count
,
$preset
)
{
return
$count
+
count
(
$preset
[
'formats'
]);
return
$count
+
count
(
$preset
[
'formats'
]);
},
0
)
;
},
0
)
/
2
;
// 50% is ok
}
}
/**
/**
...
...
Core/Media/Video/Manager.php
View file @
b0c1432e
...
@@ -65,6 +65,6 @@ class Manager
...
@@ -65,6 +65,6 @@ class Manager
return
null
;
return
null
;
}
}
return
(
string
)
$this
->
s3
->
createPresignedRequest
(
$cmd
,
'+
48 hour
s'
)
->
getUri
();
return
(
string
)
$this
->
s3
->
createPresignedRequest
(
$cmd
,
'+
90 day
s'
)
->
getUri
();
}
}
}
}
Spec/Core/Media/TranscodingStatusSpec.php
View file @
b0c1432e
...
@@ -26,6 +26,10 @@ class TranscodingStatusSpec extends ObjectBehavior
...
@@ -26,6 +26,10 @@ class TranscodingStatusSpec extends ObjectBehavior
[
[
'height'
=>
1080
,
'height'
=>
1080
,
'formats'
=>
[
'mp4'
,
'webm'
]
'formats'
=>
[
'mp4'
,
'webm'
]
],
[
'height'
=>
360
,
'formats'
=>
[
'mp4'
,
'webm'
]
]
]
]
]
]);
]);
...
@@ -52,12 +56,27 @@ class TranscodingStatusSpec extends ObjectBehavior
...
@@ -52,12 +56,27 @@ class TranscodingStatusSpec extends ObjectBehavior
$result
=
new
Result
([
'Contents'
=>
[
$result
=
new
Result
([
'Contents'
=>
[
[
'Key'
=>
'/test/123/1080.mp4'
],
[
'Key'
=>
'/test/123/1080.mp4'
],
[
'Key'
=>
'/test/123/1080.webm'
],
[
'Key'
=>
'/test/123/1080.webm'
],
[
'Key'
=>
'/test/123/360.mp4'
],
[
'Key'
=>
'/test/123/360.webm'
],
[
'Key'
=>
'/test/123/thumbnail-00000.png'
]
[
'Key'
=>
'/test/123/thumbnail-00000.png'
]
]]);
]]);
$this
->
beConstructedWith
(
$this
->
video
,
$result
,
$this
->
config
);
$this
->
beConstructedWith
(
$this
->
video
,
$result
,
$this
->
config
);
$this
->
hasSource
()
->
shouldReturn
(
false
);
$this
->
hasSource
()
->
shouldReturn
(
false
);
$this
->
getTranscodes
()
->
shouldReturn
([
'/test/123/1080.mp4'
,
'/test/123/1080.webm'
]);
$this
->
getTranscodes
()
->
shouldReturn
([
'/test/123/1080.mp4'
,
'/test/123/1080.webm'
,
'/test/123/360.mp4'
,
'/test/123/360.webm'
]);
$this
->
getThumbnails
()
->
shouldContain
(
'/test/123/thumbnail-00000.png'
);
$this
->
getThumbnails
()
->
shouldContain
(
'/test/123/thumbnail-00000.png'
);
$this
->
isTranscodingComplete
()
->
shouldReturn
(
true
);
$this
->
isTranscodingComplete
()
->
shouldReturn
(
true
);
}
}
public
function
it_should_say_still_transcoding
()
{
$result
=
new
Result
([
'Contents'
=>
[
[
'Key'
=>
'/test/123/360.mp4'
],
[
'Key'
=>
'/test/123/thumbnail-00000.png'
]
]]);
$this
->
beConstructedWith
(
$this
->
video
,
$result
,
$this
->
config
);
$this
->
hasSource
()
->
shouldReturn
(
false
);
$this
->
getTranscodes
()
->
shouldReturn
([
'/test/123/360.mp4'
]);
$this
->
getThumbnails
()
->
shouldContain
(
'/test/123/thumbnail-00000.png'
);
$this
->
isTranscodingComplete
()
->
shouldReturn
(
false
);
}
}
}