Skip to content
This repository has been archived by the owner on Jul 14, 2019. It is now read-only.

Commit

Permalink
Video source type was fixed for using as source type instead of quali…
Browse files Browse the repository at this point in the history
…ty type.
  • Loading branch information
mklemarczyk committed Jul 28, 2018
1 parent a4d8d84 commit a63115f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/helpers/HtmlVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class HtmlVideo extends \yii\helpers\BaseHtml
public static function beginVideo($id, $options = [])
{
$options['id'] = $id;

return static::beginTag('video', $options);
}

Expand Down
20 changes: 16 additions & 4 deletions src/models/VideoSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,29 @@ class VideoSource extends Model
*/
public $sourceOptions;

private static $qualityList = ['114p', '240p', '360p', '480p', '720p', '1080p', '1140p', '2160p', '4320p'];
private static $hdQualityList = ['720p', '1080p', '1140p', '2160p', '4320p'];

public function rules()
{
return [
[['source', 'title'], 'trim'],
[['source', 'title'], 'required'],

['type', 'default', 'value' => '720p'],
['quality', 'default', 'value' => 'SD'],
['quality', 'default', 'value' => '720p'],

['type', 'in', 'range' => ['114p', '240p', '360p', '480p', '720p', '1080p', '1140p', '2160p', '4320p']],
['quality', 'in', 'range' => ['SD', 'HD']],
['quality', 'in', 'range' => ['114p', '240p', '360p', '480p', '720p', '1080p', '1140p', '2160p', '4320p']],
['type', 'in', 'range' => ['video/mp4', 'video/webm', 'video/ogg', 'application/dash+xml', 'application/x-mpegURL']],
];
}

public function getIsHdReady()
{
return false !== array_search($this->quality, self::$hdQualityList);
}

public function getQualityOrder()
{
return array_search($this->quality, self::$qualityList);
}
}

0 comments on commit a63115f

Please sign in to comment.