Phonegap html5视频不播放 [英] Phonegap html5 video not playing

查看:152
本文介绍了Phonegap html5视频不播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在iPad中的phonegap应用中播放视频。

I am trying to play a video in a phonegap app in an iPad.

此视频给我错误:

MEDIA_ERR_SRC_NOT_SUPPORTED

播放是不是本地的,当我使用curl -I对视频,这是它带来的信息:

The video I am trying to play is not local, when I used curl -I on that video this is the info it brings:

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 13 Jan 2015 19:56:03 GMT
Content-Type: video/mp4
Content-Length: 12939401
Last-Modified: Thu, 20 Nov 2014 18:11:31 GMT
Connection: keep-alive
Keep-Alive: timeout=45
Accept-Ranges: bytes

我也尝试从外部网站加载另一个视频,它也工作(它也是一个mp4)。

I also tried to load another video from an external website, and it did work (it is also an mp4).

我的手机版本是3.5.0.0

My phonegap version is 3.5.0.0

至于我看到我得到一个mp4,

As far as I see I am getting an mp4, which is supported, can anyone see anything wrong in here?

推荐答案

确保服务器支持部分请求,因为我注意到这是一个要求iOS。

Make sure the server supports partial requests, as I've noticed that this is a requirement for iOS.

将视频网址复制到Chrome浏览器中,点击F12 - >网络标签查看请求,然后重新加载。您应该会看到这样的内容:

Copy the video URL into a Chrome browser, hit F12 -> network tab to view requests, then reload. You should see something like this:

GET    200 OK
GET    206 PARTIAL CONTENT
GET    206 PARTIAL CONTENT
...

这告诉你服务器支持部分内容请求,

This tells you that the server supports partial content requests, which is good.

如果您通过服务(而不是静态)自行提供视频,则需要在服务器端代码中明确支持此功能。例如,以下是一个ASP.NET Web API教程:

If you are serving up the video yourself via a service (rather than statically), you'll need to support this feature explicitly in your server-side code. For example, an ASP.NET Web API tutorial is here:

http://blogs.msdn.com/b/webdev/archive/2012/11 /23/asp-net-web-api-and-http-byte-range-support.aspx

这篇关于Phonegap html5视频不播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆