[英]iPhone web-app: HTML5 database and audio files
I'm having issues with audio files on the iPhone web-app. 我在iPhone网络应用程序上的音频文件有问题。 Seems as each time an audio file is played, it's loaded first then played, even if repeating the same audio on a page that hasn't refreshed (done via javascript). 似乎每次播放音频文件时,先加载它,然后再播放,即使在未刷新的页面上重复相同的音频(通过javascript完成)。 From what I've research manifest files would be great but they are for offline application. 根据我的研究,清单文件可能很棒,但是它们是供离线应用程序使用的。 I'm now researching HTML5 databases. 我现在正在研究HTML5数据库。
Does anyone know if HTML5 databases can store audio files such as mp3? 有谁知道HTML5数据库是否可以存储mp3等音频文件? The end result it then to pull the mp3 from the database. 最终结果便是从数据库中提取mp3。 It might still have to load the file each time from the database but I'm hoping it's quicker than retrieving it from a server. 每次仍可能必须从数据库加载文件,但我希望它比从服务器检索文件更快。
Thank you. 谢谢。
I think what you are after is possible , however you have a significant hurdle in that the implementation of HTML5 databases on most browsers is limited to 5mb as per w3c recommendations: 我认为您可以追求的目标是可能的 ,但是按照w3c的建议,大多数浏览器上的HTML5数据库实施限制为5mb ,这是您遇到的重大障碍 :
A mostly arbitrary limit of five megabytes per origin is recommended. 建议每个源的最大限制为5 MB。
Having said that the way its implemented in iPhone Safari is that databases can grow until they reach 5MB in size at which point the browser will ask the user if they wish to allow for the extra size, asking again at 10, 50, 100 and 500MB (see section "Estimated Database Size" in this post by html5doctor ). 话虽如此,它在iPhone Safari中的实现方式是数据库可以增长直到达到5MB大小,此时浏览器将询问用户是否希望允许额外的大小,并再次询问10、50、100和500MB (请参阅html5doctor在此文章中的 “估计的数据库大小” 部分 )。
There is no limit on the number of databases you can build per domain in safari, however according to this post by Cantina Consulting you can have a total of 50MB across all databases in a single domain . 对于 每个域可以在safari中建立的数据库数量没有限制 ,但是根据Cantina Consulting的这篇文章 , 单个域中的所有数据库总共可以有50MB 。
Given these parameters, a possible work-around for this implementation is to split your mp3 blobs across multiple databases , creating a new database each time your reach 4.9MB, however even if you follow this design it may not be ideal as you will still experience the following: 给定这些参数,此实现的一种可能的解决方法是将mp3 blob分散到多个数据库中 ,每次达到4.9MB时创建一个新数据库,但是,即使按照这种设计,它仍然不是理想的选择,因为您仍然会遇到下列:
Feel free to have a play around with this iPhone HTML5 SQL Client I put together, you may want to use something similar for experimenting with your local mp3 Database. 随意玩一下我放在一起的iPhone HTML5 SQL Client ,您可能想使用类似的方法来尝试本地mp3数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.