任何HTTP标头都可以强制iOS下载视频(而不是流式传输) [英] Can any HTTP headers force iOS to download video (rather than streaming it)

查看:549
本文介绍了任何HTTP标头都可以强制iOS下载视频(而不是流式传输)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?我当前的标头设置为;

Is it possible? My current headers are set to;

Content-Disposition: attachment
Content-Type: video/x-m4v

我尝试设置非视频内容类型(应用程序/八位字节流),但它没有任何效果。是否有任何标题会强制iOS设备下载并保存(而不是流式传输)视频文件?

I tried setting a non-video content type (application/octet-stream) but it had no effect. Are there any headers that will force an iOS device to download and save (rather than stream) a video file?

推荐答案

你是设置 Content-Disposition 标题是因为您希望iOS上的Safari在遇到相同标题时与桌面浏览器类似?

Are you setting the Content-Disposition header because you expect Safari on iOS to act similar to desktop browsers when they come up against the same headers?

Mobile Safari不是这样的,因为iOS没有与桌面相同的文件系统范例。您可以将文件下载到iOS设备的唯一方法是将文件保存在您自己的应用程序的沙盒文件系统中。为此,您可以使用 NSURLConnection (和相关的)API。

Mobile Safari doesn't act like this because iOS doesn't have the same file system paradigm as the desktop. The only way you'd be able to download the file to an iOS device would be saving the file within the sandboxed filesystem of your own app. To do this, you would manually download the file using the NSURLConnection (and related) APIs.

这篇关于任何HTTP标头都可以强制iOS下载视频(而不是流式传输)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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