48 lines
1.6 KiB
PHP
Executable File
48 lines
1.6 KiB
PHP
Executable File
<?php
|
|
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/5.0.5/mediaelement-and-player.min.js"></script>
|
|
<script type="text/javascript" src="/js/mediaplayer_plugins.min.js"></script>
|
|
<script type="text/javascript">
|
|
var pluginPath = 'https://cdnjs.cloudflare.com/ajax/libs/mediaelement/5.0.5/';
|
|
var features = ['playpause','skipback','jumpforward','current','progress','duration','volume','airplay','chromecast','fullscreen'];
|
|
$("audio").mediaelementplayer({
|
|
pluginPath: pluginPath,
|
|
stretching: 'responsive',
|
|
features: features,
|
|
skipBackInterval: 15,
|
|
jumpForwardInterval: 15,
|
|
});
|
|
$("video").mediaelementplayer({
|
|
pluginPath: pluginPath,
|
|
videoWidth: '100%',
|
|
videoHeight: '100%',
|
|
enableAutosize: true,
|
|
features: features,
|
|
skipBackInterval: 15,
|
|
jumpForwardInterval: 15,
|
|
});
|
|
</script>
|
|
@endpush
|
|
|
|
@push('styles')
|
|
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/mediaelement/4.2.16/mediaelementplayer.css" />
|
|
<link rel="stylesheet" href="/css/mediaplayer_plugins.min.css" />
|
|
@endpush
|
|
|
|
<?php endif; ?>
|