YouTube links werkend

This commit is contained in:
mischa.spelt committed 2020-03-24 14:42:44 +01:00
1 parent 843e66be6a
commit 821e0687eb
2 files changed
+12 -3

No files matched your search

@@ -2,6 +2,17 @@
if(!isset($MEDIAPLAYER_INCLUDED)):
// Make sure mediaplayer JS is not applied more than once on a page.
View::share('MEDIAPLAYER_INCLUDED', true);
function createVideoElement($url) {
$type = "application/x-mpegurl";
if(strpos($url, "youtube.com") !== false) { $type = "video/youtube"; }
if(strpos($url, "youtu.be") !== false) { $type = "video/youtube"; }
?>
<video controls>
<source src="{!!$url!!}" type="{!!$type!!}" />
</video>
<?php
}
?>
@push('scripts')
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/mediaelement/4.2.16/mediaelement-and-player.min.js"></script>