Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP服务于苹果产品的视频显示_Php_Ios_Iphone_Html - Fatal编程技术网

PHP服务于苹果产品的视频显示

PHP服务于苹果产品的视频显示,php,ios,iphone,html,Php,Ios,Iphone,Html,我正试图在我的Mac和iPhone上播放视频,但我无法让它正常工作。我的视频是由php提供的,我一直在阅读它与未发送的范围标头有关,但我不知道如何正确执行。 以下是我到目前为止的情况: HTML: 如果它实际上是一个范围头问题,那么有一个github项目,其中有一个代码示例,用于解决Safari/Mac的此问题: 如果这实际上是一个范围标头问题,那么有一个github项目,其中有一个代码示例,用于解决Safari/Mac的此问题: <video controls="true" autop

我正试图在我的Mac和iPhone上播放视频,但我无法让它正常工作。我的视频是由php提供的,我一直在阅读它与未发送的范围标头有关,但我不知道如何正确执行。 以下是我到目前为止的情况:

HTML:


如果它实际上是一个范围头问题,那么有一个github项目,其中有一个代码示例,用于解决Safari/Mac的此问题:


如果这实际上是一个范围标头问题,那么有一个github项目,其中有一个代码示例,用于解决Safari/Mac的此问题:

<video controls="true" autoplay muted loop> 
<source src="http://my_site.com/video/394934" type="video/mp4">
</video>
// Get file GUID
$file_guid = (int) get_input('file_guid', 0);

// Get file thumbnail size
$size = get_input('size', 'small');

$file = get_entity($file_guid);
if (!elgg_instanceof($file, 'object', 'file')) {
    exit;
}

$simpletype = $file->simpletype;
if ($simpletype == "image") {

// Get file thumbnail
switch ($size) {
    case "small":
        $thumbfile = $file->thumbnail;
        break;
    case "medium":
        $thumbfile = $file->smallthumb;
        break;
    case "large":
    default:
        $thumbfile = $file->largethumb;
        break;
}

// Grab the file
if ($thumbfile && !empty($thumbfile)) {
    $readfile = new ElggFile();
    $readfile->owner_guid = $file->owner_guid;
    $readfile->setFilename($thumbfile);
    $mime = $file->getMimeType();
    $contents = $readfile->grabFile();

    // caching images for 10 days
    header("Content-type: $mime");
    header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+10 days")), true);
    header("Pragma: public", true);
    header("Cache-Control: public", true);
    header("Content-Length: " . strlen($contents));

    echo $contents;
    exit;
}
}