相关疑难解决方法(0)

使用php输出mp4视频

好吧,基本上我有一个项目要求视频对用户隐藏,同时仍能看到它们(通过使用php).这是我到目前为止所得到的:

video.php文件包含:

<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'path/to/movie.mp4');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_HEADER, 0);
$out = curl_exec($ch);
curl_close($ch);


header('Content-type: video/mp4');
header('Content-type: video/mpeg');
header('Content-disposition: inline');
header("Content-Transfer-Encoding:­ binary");
header("Content-Length: ".filesize($out));
echo $out;
exit();
?>
Run Code Online (Sandbox Code Playgroud)

并且应该显示的html文件正在使用html5.现在这里的事情......当我直接嵌入这个(不是)时它起作用.但它不适用于我的iPhone并且无法在标签中工作...如果我使用直接文件而不是php包装器,一切正常,在我的iPhone上也是如此...

所以我想我的问题是这样的:什么是正确的header()信息来完美复制可以通过iPhone和HMTL5流式传输的mp4?

解决方案源自:http://mobiforge.com/developing/story/content-delivery-mobile-devices

video.php文件:

<?php
$file = 'path/to/videofile.mp4';
$fp = @fopen($file, 'rb');

$size   = filesize($file); // File size
$length = $size;           // Content length
$start  = 0;               // Start byte
$end    = $size - 1;       // End byte

header('Content-type: video/mp4');
header("Accept-Ranges: 0-$length");
if (isset($_SERVER['HTTP_RANGE'])) …
Run Code Online (Sandbox Code Playgroud)

php iphone html5 mp4

27
推荐指数
2
解决办法
5万
查看次数

PHP流远程视频文件

假设我在远程服务器上有一个视频,这是它的 url

http://domain/video-path/video.mp4

使用可搜索的 php 流式传输此视频的正确方法是什么..

我知道如何使用 fopen 和 fread 流式传输视频,但它无法使用远程文件查找

php

2
推荐指数
1
解决办法
4022
查看次数

标签 统计

php ×2

html5 ×1

iphone ×1

mp4 ×1