%PDF- %PDF-
| Direktori : /www/varak.net/video.varak.net/ |
| Current File : /www/varak.net/video.varak.net/player.php |
<?php
include("config.php");
$renderer = new \Player\PlayerRenderer($path, $_GET['file']);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php $head->render() ?>
<title><?php echo \Utils\Strings::truncate($renderer->file->name, 50)?></title>
</head>
<body>
<div class="container">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="index.php?dir=<?php echo urlencode($renderer->file->directory) ?>">
<?php echo \Utils\Strings::truncate($renderer->file->dirName, 80) ?>
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="./">Home <span class="sr-only">(current)</span></a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron" style="padding-top: 16px;">
<p><?php echo \Utils\Strings::removeSuffix($renderer->file->name) ?></p>
<div id="myPlayer"></div>
<div style="margin-top: 10px">
<ul id="carousel" class="elastislide-list">
<?php $renderer->file->renderDirectoryFiles() ?>
</ul>
</div>
</div>
</div> <!-- /container -->
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", function(event) {
var playerInstance = jwplayer("myPlayer");
var position = <?php echo isset($_GET['position']) ? $_GET['position'] : 0 ?>;
playerInstance.setup({
//autostart: <?php echo isset($_GET['autostart']) ? 'true' : 'false' ?>,
autostart: false,
playlist: [
<?php
$index = $i = 0;
$siblings = $renderer->file->getSiblings();
/** @var \App\File $sibling */
foreach ($siblings as $sibling) { ?>
{
title: "<?php echo $sibling->name?>",
description: "<?php echo $sibling->name?>",
image: "screen.php?file=<?php echo $sibling->fileLink; ?>",
file: "<?php echo "/videos".$sibling->fileLink ?>"<?php if(file_exists($videosPath."/videos".$sibling->subtitles)) { ?>,
//image: "/assets/sintel.jpg",
tracks: [{
file: "<?php echo "/videos".$sibling->subtitles ?>",
label: "Titulky",
kind: "captions",
"default": true
}]<?php } ?>
}<?php
if ($i < count($siblings) -1 ) {
echo ',';
}
if ($sibling->fileLink === $renderer->file->fileLink){
$index = $i;
}
$i++;
}?>
]
});
playerInstance.playlistItem(<?php echo $index?>).stop().on('complete', function () {
var index = playerInstance.getPlaylistIndex();
var maxIndex = <?php echo $i?>;
if (index < maxIndex) {
if (playerInstance.getFullscreen()) {
position = 0;
playerInstance.playlistItem(index+1);
} else {
redirect(playerInstance, index+1);
}
}
});
playerInstance.on('playlistItem', function () {
var index = <?php echo $index ?>;
var currentIndex = jwplayer().getPlaylistIndex();
if (index != currentIndex && !playerInstance.getFullscreen()) {
redirect(playerInstance, currentIndex);
}
});
playerInstance.on('play', function () {
var captions = playerInstance.getCaptionsList();
if (captions.length > 1)
{
playerInstance.setCurrentCaptions(1);
}
});
playerInstance.on('fullscreen', function () {
var isFullScreen = playerInstance.getFullscreen();
if (!isFullScreen) {
var index = <?php echo $index ?>;
var currentIndex = jwplayer().getPlaylistIndex();
if (index != currentIndex) {
redirect(playerInstance, currentIndex, playerInstance.getPosition());
}
}
});
playerInstance.load()
if (position) {
playerInstance.on('firstFrame', function () {
playerInstance.seek(position);
});
}
});
function redirect (player, index, position) {
var item = player.getPlaylistItem(index);
var fileName = item.file.substring(7);
var location = 'player.php?file='+encodeURIComponent(fileName)+'&autostart=true';
if (position) {
location += '&position='+encodeURIComponent(position);
}
window.location.href = location;
}
</script>
</body>
</html>