From 278e7abd5b3e8c0e554535d80693d16ae5e9924b Mon Sep 17 00:00:00 2001 From: Maciej Klemarczyk Date: Sun, 29 Jul 2018 00:40:26 +0200 Subject: [PATCH] HD detecting was implemented. Quality order list was changed --- src/widgets/FluidPlayer.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/widgets/FluidPlayer.php b/src/widgets/FluidPlayer.php index db91b4e..9889396 100644 --- a/src/widgets/FluidPlayer.php +++ b/src/widgets/FluidPlayer.php @@ -51,11 +51,14 @@ public function init() public function run() { $htmlView = HtmlVideo::beginVideo($this->id, $this->videoOptions); + $sources = []; foreach ($this->sources as $key => $value) { if ($value instanceof VideoSource && $value->validate()) { - $htmlView .= self::prepareSourceTag($value); + $sources[$value->qualityOrder . '_' . $key] = self::prepareSourceTag($value); } } + krsort($sources, SORT_NATURAL); + $htmlView .= implode($sources); $htmlView .= HtmlVideo::endVideo(); return $htmlView; } @@ -72,6 +75,10 @@ protected function prepareSourceTag($source) $options['type'] = $source->type; $options['quality'] = $source->quality; + if ($source->isHdReady) { + $options['data-fluid-hd'] = 'true'; + } + return HtmlVideo::source($source->source, $options); }