Home >Backend Development >PHP Tutorial >The video tag on Apple cannot correctly read the video stream output in the background

The video tag on Apple cannot correctly read the video stream output in the background

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-09-14 09:41:301662browse

Written a small website, using the video tag for video playback, it is necessary to separate the video files (both MP4) and website files, so the video stream is output by reading the video in the background, and can be accessed normally on PC and Android, but It cannot be displayed on Apple, but videos with fixed addresses can be played on Apple, such as /test.mp4. The background code is as follows:

<code>    //$name 文件名, $path 文件路径
    header("Pragma: public");
    header("Expires: 0");
    header("Content-Type: application/octet-stream"); //文件mime类型
    header("Content-Disposition: attachment; filename=\"".$name."\";" ); 
    header("Content-Length: ".filesize($path));  //文件大小$fsize
    ob_clean();     flush();     readfile( $path );  </code>

It is said online that Range is not set in the http protocol, but no examples or detailed explanations are given.

Reply content:

Written a small website, using the video tag for video playback, it is necessary to separate the video files (both MP4) and website files, so the video stream is output by reading the video in the background, and can be accessed normally on PC and Android, but It cannot be displayed on Apple, but videos with fixed addresses can be played on Apple, such as /test.mp4. The background code is as follows:

<code>    //$name 文件名, $path 文件路径
    header("Pragma: public");
    header("Expires: 0");
    header("Content-Type: application/octet-stream"); //文件mime类型
    header("Content-Disposition: attachment; filename=\"".$name."\";" ); 
    header("Content-Length: ".filesize($path));  //文件大小$fsize
    ob_clean();     flush();     readfile( $path );  </code>

It is said online that Range is not set in the http protocol, but no examples or detailed explanations are given.

You can try changing the location of the video file. This may be a path problem.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn