Skip to content

Commit

Permalink
Add MIME type to video <source> tag (#1992)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Weiske authored and rhukster committed May 15, 2018
1 parent a1abcfd commit e60fd82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion system/src/Grav/Common/Page/Medium/VideoMedium.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ class VideoMedium extends Medium
protected function sourceParsedownElement(array $attributes, $reset = true)
{
$location = $this->url($reset);
$path = parse_url($location, PHP_URL_PATH);
$extension = pathinfo($path, PATHINFO_EXTENSION);
$mimeType = \Grav\Common\Utils::getMimeByExtension($extension);

return [
'name' => 'video',
'text' => '<source src="' . $location . '">Your browser does not support the video tag.',
'text' => '<source src="' . $location . '" type="' . $mimeType . '">Your browser does not support the video tag.',
'attributes' => $attributes
];
}
Expand Down

0 comments on commit e60fd82

Please sign in to comment.