Sencha Touch 和保存本地媒体

发布于 2024-12-21 09:29:21 字数 380 浏览 2 评论 0原文

有谁知道是否可以使用 Sencha Touch 将互联网上的媒体保存到本地设备上?从到目前为止我所看到的情况来看,我知道绝对可以在设备上本地保存 XML 或 JSON 数据,但我没有找到在本地存储媒体的方法。

更具体地说,我希望编写一个应用程序,为用户提供一系列音频研讨会 - 就像播客一样。用户将能够直接从互联网流式传输这些音频文件,但我还需要为用户提供保存剧集/研讨会供以后使用的功能。当用户正在旅行并且没有可靠的互联网连接或数据计划时,这非常重要。

主要交付设备将在 iOS(iPhone、iPad、iPod Touch)上,我希望能够在 Android 设备上使用相同的技术 - 但这将是第二阶段。

如果可能的话,我将如何节省材料?如果有的话,这样做的限制是什么?任何对此的想法将不胜感激。

Does anyone know if it is possible to save media from the internet on the local device using Sencha Touch? From what I've seen so far, I understand it's definitely possible to save XML or JSON data locally on the device, but I have had no luck finding ways to store media locally.

To be more specific, I am looking to program an app that provides the user with a series of audio seminars - like podcasts, really. The user would be able to stream those audio files directly from the internet, but I also need to provide the user with the ability to save an episode/seminar for later. This will be important for when a user is traveling and does not have a reliable internet connection or data plan.

The primary delivery device would be on iOS (iPhone, iPad, iPod Touch) and I would hope to be able to use the same technology on Android devices - but that would be a secondary phase.

If this is possible, how would I go about saving material? And what, if any, would be the limitations on doing so? Any thoughts on this would be greatly appreciated.

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

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

发布评论

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

评论(2

待"谢繁草 2024-12-28 09:29:21

我使用 Sencha Touch 1 和 PhoneGap 做了类似的事情来制作混合应用程序。

基本上,我使用 Sencha Touch 下载 JSON 等,并使用 LocalStorage 来保存数据。 Sencha Touch 不支持将媒体/文件/等下载到实际设备,因为该框架无法访问文件系统。

然后,我使用 PhoneGap 的 API 进入设备的本机文件系统,将文件下载到应用程序的文档目录,并将文件名/路径传递给 Sencha Touch 以在应用程序中使用。

我假设您希望根据您的问题创建一个混合应用程序,但如果这严格来说是一个网络应用程序,那么您无能为力。

要补充上述一点,您可以对文件进行 Base64 编码并将其存储在 LocalStorage 中,但这不是一个可持续的模型,因为 LocalStorage 只为您提供 5mb 的空间。如果超过 5mb,系统会提示用户(是、否)允许 LocalStorage 使用更多空间(以 5mb 为增量)。由于您参考的文件每个可能有 5mb,因此您可以看到这对于您和用户来说很快就会变得难以管理。

编辑:
请参阅 http://phonegap.com/ 了解本机包装器
http://blog.clearlyinnovative.com /post/2056122828/phonegap-plugin-for-downloading-url-all-the-code 用于phonegap下载插件
https://github.com/aaronksaunders/FileDownLoadApp 代码

I have done something similar using Sencha Touch 1 and PhoneGap to produce a hybrid app.

Basically, I use Sencha Touch to download the JSON, etc and LocalStorage to hold the data. Downloading media/files/etc to the actual device is not supported in Sencha Touch as the framework doesn't have access to a file system.

I then use PhoneGap's API's to tap into the device's native file system and download files to the app's Documents directory and pass the file names/paths to Sencha Touch for use in the app.

I'm assuming you are looking to create a hybrid app based on your question but if this is strictly a web app then there isn't much you can do.

TO add to the above point, you possibly could base64 encode the file and store it within LocalStorage but this isn't a sustainable model as LocalStorage only gives you 5mb of space. If you go over 5mb, the user is prompted (yes, no) to allow LocalStorage to use more space (in 5mb increments). Since the files your reference have the potential to be 5mb each, you can see how this could quickly become unmanageable for both you and the user.

EDIT:
See http://phonegap.com/ for the native wrapper
http://blog.clearlyinnovative.com/post/2056122828/phonegap-plugin-for-downloading-url-all-the-code for the phonegap download plugin
and https://github.com/aaronksaunders/FileDownLoadApp for the code

水中月 2024-12-28 09:29:21

查看此网站。向下滚动到离线存储数据。他们讨论 Sencha Touch 提供了一组数据存储和代理类,使处理来自(和去往)各种来源(服务器端和客户端)的数据变得非常容易......希望这有所帮助,欢呼。

Check this website out. Scroll down to storing data offline. They discuss Sencha Touch provides a set of data store and proxy classes that make it very easy to work with data from (and going to) a variety of sources - both server- and client-side... hope this helped, cheers.

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