<?php
/*************************  
  Copyright (c) 2004-2026 TinyWebGallery
  written by Michael Dempfle
 
  This program is free software; you can redistribute it and/or modify 
  it under the terms of the TinyWebGallery license (based on the GNU  
  General Public License as published by the Free Software Foundation;  
  either version 2 of the License, or (at your option) any later version. 
  See license.txt for details.
 
  TWG version: 2.8
 
  $Date: 2009-06-17 22:57:10 +0200 (Mi, 17 Jun 2009) $
  $Revision: 73 $
**********************************************/

define( '_VALID_TWG', '42' ); 
include "i_basic.inc.php";

$configphp = $basedir . "/" . $twg_album . "/config.php";
	if (file_exists($configphp)){
			include $configphp;
}
$configphp_lang = $basedir . "/" . $twg_album . "/config_".$default_language.".php";
if (file_exists($configphp_lang)){
  include $configphp_lang;
}

if ($twg_root == $install_dir . "../index.php") { // this is the default and wrong for the slideshow !
$twg_root = $install_dir . "index.php";
}


require '../language/language_default.php';
require '../language/language_' . $default_language . '.php';
if (isset($charset)) {
  header("Content-Type: text/html;charset=" . $charset);
}

// https://videojs.com/getting-started/#customize


?>
<!DOCTYPE HTML>
<html>
<head>
    <title></title>
    <link href="https://vjs.zencdn.net/7.11.4/video-js.css" rel="stylesheet" />
    <script src="https://vjs.zencdn.net/7.11.4/video.min.js"></script>
<style>
html, body {height: 100%; width: 100%; overflow: hidden; margin:0px; padding:0px;}
</style>
</head>
<body><?php
@ob_start();
 $preview = getTWGHttpRoot() . twg_urlencode($basedir . "/" . $twg_album . "/" . mb_convert_encoding($image, 'UTF-8', 'ISO-8859-1'));
 $movies = array_reverse (getHtml5MovieNames($twg_album, $image));
if ($twg_album) {
    $videofilename = ($basedir . "/" . $twg_album . "/video.php");
} else {
    $videofilename = ($basedir . "/video.php");
}

$autoplay = "";
if (isset($_GET['autostart'])) {
    $autoplay = "autoplay: 'play',";
}

// we check videostreaming
if (file_exists($videofilename)) { 
    include $videofilename;
} 
@ob_end_clean();
echo '<span id=videoHtml5 style="width:100%;height:100%;overflow:hidden;">
         <video id="player_a" '.$auto_param.' controls style="width:100%;height:100%" class="video-js"
          preload="auto"  data-setup="{}" poster="'. $preview . '">';
      
       foreach ($movies as $movie) {    
         $extension = getExtension($movie);
         if ($video_flash_site != "") {
             $moviePath = $video_flash_site . twg_urlencode(mb_convert_encoding($movie, 'UTF-8', 'ISO-8859-1'));
         } else {
             $moviePath = getTWGHttpRoot() . twg_urlencode($basedir . "/" . $twg_album . "/" . mb_convert_encoding($movie, 'UTF-8', 'ISO-8859-1'));
         }
         echo '<source src="'.$moviePath.'" type="video/'.$extension.'" />';
       }  
       echo '</video>   
        </span>';  
    ?>

    <script type="text/javascript">
    var player = videojs('player_a', {
        <?php echo $autoplay; ?>
    });
    </script>  
</body>
</html>