HFP-2766 Allow setting bitrate for video files

pull/63/head
Frode Petterson 2019-06-20 16:10:18 +02:00
parent 2c15047e50
commit 9e749eda92
1 changed files with 5 additions and 1 deletions

View File

@ -3899,6 +3899,10 @@ class H5PContentValidator {
$file->codecs = htmlspecialchars($file->codecs, ENT_QUOTES, 'UTF-8', FALSE); $file->codecs = htmlspecialchars($file->codecs, ENT_QUOTES, 'UTF-8', FALSE);
} }
if (isset($file->bitrate)) {
$file->bitrate = intval($file->bitrate);
}
if (isset($file->quality)) { if (isset($file->quality)) {
if (!is_object($file->quality) || !isset($file->quality->level) || !isset($file->quality->label)) { if (!is_object($file->quality) || !isset($file->quality->level) || !isset($file->quality->label)) {
unset($file->quality); unset($file->quality);
@ -3940,7 +3944,7 @@ class H5PContentValidator {
*/ */
public function validateVideo(&$video, $semantics) { public function validateVideo(&$video, $semantics) {
foreach ($video as &$variant) { foreach ($video as &$variant) {
$this->_validateFilelike($variant, $semantics, array('width', 'height', 'codecs', 'quality')); $this->_validateFilelike($variant, $semantics, array('width', 'height', 'codecs', 'quality', 'bitrate'));
} }
} }