小编It_*_*rks的帖子

视频流-处理标头206(PHP到HTML5)

和往常一样,它永远对我不起作用...

我尝试流式传输视频,并且下面的代码做得很好:

function send_back_video($video_path)
{
    ob_clean();
    $mime = "application/octet-stream"; // The MIME type of the file, this should be replaced with your own.
    $size = filesize($video_path); // The size of the file

    // Send the content type header
    header('Content-type: ' . $mime);

    // Check if it's a HTTP range request
    if(isset($_SERVER['HTTP_RANGE']))
    {       
        // Parse the range header to get the byte offset
        $ranges = array_map(
            'intval', // Parse the parts into integer
            explode(
                '-', // The range separator
                substr($_SERVER['HTTP_RANGE'], 6) …
Run Code Online (Sandbox Code Playgroud)

video-streaming http-headers html5-video

5
推荐指数
0
解决办法
794
查看次数