使用 PostgreSQL 附带的 Apache/PHP 服务器向 iOS 设备提供视频

发布于 2024-10-20 16:45:16 字数 1739 浏览 1 评论 0原文

我正在开发一个系统,其中服务器将向设备(iDevice 或其他设备)提供视频,然后要求用户对视频进行评分。我决定使用 PostgreSQL 作为我的数据库,并让它安装 Apache 和 PHP 服务器来工作(如此处找到的 http://www.enterprisedb.com/products-services-training/pgdownload)。

然而,该服务器的配置似乎与典型的 Apache/PHP 安装不太一样。当 iDevice 尝试从服务器下载视频时,iDevice 会出现以下错误:

无法播放电影 - 服务器配置不正确

我做了一些研究,并了解到 iDevices 需要字节范围请求功能,因此我检查了服务器的访问日志并发现了以下内容:

xx.xx.xx.xx - - [08/Mar/2011:11:45:56 -0700]“获取 temp.mp4 HTTP/1.1”206 2
xx.xx.xx.xx - - [08/Mar/2011:11:45:56 -0700]“GET temp.mp4 HTTP/1.1”200 17760579

(其中“17760579”是特定文件的确切大小(以字节为单位) )
它们应该看起来像这样:

xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700]“获取 temp.mp4 HTTP/1.1”206 2
xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700]“获取 temp.mp4 HTTP/1.1”206 25947357
xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700]“获取 temp.mp4 HTTP/1.1”206 60637
xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700]“GET temp.mp4 HTTP/1.1”206 25880928

所以,我知道我的服务器没有处理某些字节-正确范围请求。但是,使用 curl 检查此功能会返回正确的结果:

curl --range 0-99 http://url/temp.mp4 -o /dev/null
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
  0   100    0   100    0     0   8574      0 --:--:-- --:--:-- --:--:-- 10000

我已确保视频 MIME 类型配置正确。

我不知道从这里该去哪里。该服务器中某处的某些内容配置错误。

更新: 以下是适当的版本号:

服务器版本:Apache/2.2.16 (Unix)
服务器建成:2010 年 10 月 7 日 00:26:09
PHP版本5.3.3
x86_64-apple-darwin 上的 PostgreSQL 9.0.2

I am developing a system in which a server will serve a video to a device (iDevice or otherwise) and then ask the user to rate the video. I had decided to use PostgreSQL for my database, and let it install an Apache and PHP server to work against (as found here http://www.enterprisedb.com/products-services-training/pgdownload).

It seems, however, that this server isn't configured quite like a typical Apache/PHP install. When an iDevice attempts to download a video from the server, the iDevice gives this error:

Cannot play movie—The server is not correctly configured

I've done some research, and learned that iDevices require byte-range request functionality, so I checked my server's access logs and found this:

xx.xx.xx.xx - - [08/Mar/2011:11:45:56 -0700] "GET temp.mp4 HTTP/1.1" 206 2
xx.xx.xx.xx - - [08/Mar/2011:11:45:56 -0700] "GET temp.mp4 HTTP/1.1" 200 17760579

(where "17760579" was the exact size in bytes of the particular file)
They should look something like this:

xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700] "GET temp.mp4 HTTP/1.1" 206 2
xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700] "GET temp.mp4 HTTP/1.1" 206 25947357
xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700] "GET temp.mp4 HTTP/1.1" 206 60637
xx.xx.xx.xx - - [07/Mar/2011:18:04:11 -0700] "GET temp.mp4 HTTP/1.1" 206 25880928

So, I know that my server isn't dealing with some byte-range requests properly. However, using curl to check for this functionality returns a proper result:

curl --range 0-99 http://url/temp.mp4 -o /dev/null
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
  0   100    0   100    0     0   8574      0 --:--:-- --:--:-- --:--:-- 10000

I've ensured that the video MIME types are properly configured.

I'm not sure where to go from here. Something, somewhere, is misconfigured in this server.

Update:
Here are appropriate version numbers:

Server version: Apache/2.2.16 (Unix)
Server built: Oct 7 2010 00:26:09
PHP version 5.3.3
PostgreSQL 9.0.2 on x86_64-apple-darwin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

柳若烟 2024-10-27 16:45:16

iOS 设备使用一种名为“HTTP Live Streaming”的流媒体服务,它是在苹果发布 Quicktime Streaming Server (QSS) 时开发的。

除非您的服务器配置为进行实时流式传输,否则您的视频将简单地下载,然后播放。不按要求播放。

另一种选择是 RTSP 流媒体,但我不确定评级系统如何与所有这些一起发挥作用。这听起来像是 iPhone / iOS 应用程序的工作。

iOS Devices use a streaming service called "HTTP Live Streaming", it was developed when apple released the Quicktime Streaming Server (QSS).

Unless your server is configured to do live streaming, your videos will simply download, and then play. Not play on demand.

Another option is RTSP streaming, but I'm not sure how the rating system comes into play with all of this. That sounds like a job for an iPhone / iOS app.

回忆凄美了谁 2024-10-27 16:45:16

我不知道如何解决这个问题。我最初在对问题的评论中使用了在网站上找到的 PostgreSQL/Apache/PHP 安装包,因为这是一种安装所有三个并确保它们顺利工作的方法。显然,由于生成的服务器没有提供我需要的功能,我可以选择从头开始安装所有内容。我使用此处找到的说明来实现此结果。说明有点过时,但过程有效。

I couldn't figure out how to fix this problem. I had initially used the PostgreSQL/Apache/PHP install package found at the site in my comment on the question because it was a way to install all three and make sure they worked without hassle. Obviously, since the resulting server didn't provide the functionality I needed, I had the option of installing everything from scratch. I used the instructions found here to achieve this result. The instructions are a bit out of date, but the process worked.

唐婉 2024-10-27 16:45:16

Apache 需要安装并启用 mod_h264 才能正确处理具有字节范围请求的 mp4。你检查过这个mod的存在吗?

Apache needs mod_h264 installed and enabled to properly handle mp4's with the byte range requests. Have you checked for the presence of this mod?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文