Hello,
Try changing the PHP code as shown below.
while (($file = readdir($dh)) !== false) {
if ($file == ".") {
echo '..<br>';
} elseif ($file == "..") {
echo '..<br>';
} else {
echo ''. $file . '<br>';
echo '<br><video id="button_' . $i . '" autobuffer="" preload="auto" style="width:200px;height:300px" src="videos/' . $file . '" önclick="playVideo(this);"></video>';
$i = $i + 1;
}
}</br></br></br></br>
Your javascript function becomes something like one shown below.
function playVideo(vid) {
var starttime = 2;
var endtime = 6;
vid.play();
setTimeout(function() {
stopVideo(vid);
}, 125);
}
function stopVideo(vid) {
vid.pause();
}
Regards,