T
T
Troodi Larson2018-09-20 00:33:20
PHP
Troodi Larson, 2018-09-20 00:33:20

Batch output of a file, streaming without downloading (video)?

There is a task: to hide the final url of the file, in our case the video. That is, the url on the video -> the server changes the url to its own -> the end user.
For the server that changes the url, is it possible to just give it either in portions, or just stream the file to the video player without downloading it? How reasonable is this approach?
Something like:

<?
header("Content-Type: video/mp4");
echo file_get_contents('ссылка_до_видео');
?>

However, here we are downloading to a file in the RAM. And I would like to give portions. Without full download of the file. That is, make a flow.
PS Store video on the intermediate will not work. Because very large volumes.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladlen Hellsite, 2018-09-20
@troodi

There are quite a few examples on google , but PHP provides an API for dealing with readfile streams .

Tip
For this function, you can use a URL as the filename if the fopen wrappers option has been enabled. See the description of the fopen() function for more information on determining the filename. See also a list of supported URL wrappers, their capabilities, usage notes, and a list of predefined constants in Supported protocols and wrappers.

A
Alexander Novikov, 2018-09-20
@AlexndrNovikov

It is better to do this not at the PHP level, but at the Nginx level:
https://github.com/arut/nginx-rtmp-module
Nginx RTMP is essentially one of the standard solutions for Video on demand tasks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question