How can I generate a js or php temporary link that will work BEFORE full video buffering, after which the link to the video will not be available ... For example

<video width="320" height="240" controls> <source src="/videos/fh879y8.dat" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> </video> 

Only the use of the database comes to mind, but as it seems to ME, this is not a rational use of the database and, after buffering, reset the URL. There are some options without a database. Hover the idea in which direction to dig ....

  • I don’t quite understand if it’s honestly so I’m writing in comments. In general, I can offer, say, until the session ends to display the video (this is in php). And in JS you can set the time and at the end of this time set via CSS display: none. I have a little bit of my ideas, but I hope ... - darkwoolf

1 answer 1

I could come up with php

  <?php //newEmptyPHP.php $hash = $_GET['hash']; $filename = $_GET['filename']; $ip = md5(getenv("REMOTE_ADDR")."key".date("i")); //var_dump($ip); if ($hash == $ip and $_SERVER["HTTP_REFERER"] != '') { $url = $_SERVER['REQUEST_URI']; $url = explode("?", $url); $url = $url[1]; if (isset($url)) { $filename .="?" . $url; } header("Content-Type: video/x-mp4"); header("X-Accel-Redirect:/rvp/" . $filename); readfile("/rvp/".$filename); die(); } echo "403"; ?> <?php //index.php $ip = md5(getenv("REMOTE_ADDR")."key".date("i")); ?> <video width="320" height="240" controls> <source src="/newEmptyPHP.php?hash=<?php echo $ip;?>&filename=video1.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'> </video> 

In turn, the request occurs along the path "/newEmptyPHP.php?hash=2d093474d45b8e7eba4a342c474c696d&filename=video1.mp4" which is already in the video tag. and even if there is a download link, it will not work as SERVER ["HTTP_REFERER"]. How correctly I do not know but it seems to work. In its own way you can understand it will act until the minute of the request is equal to the current minute