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
Release: 2016-09-14 09:41:30
Original
1643 people have browsed it

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>
Copy after login
Copy after login

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>
Copy after login
Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template