音频元素源的HTML5本地存储 - 这可能吗? [英] HTML5 Local Storage of audio element source - is it possible?

查看:212
本文介绍了音频元素源的HTML5本地存储 - 这可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试用HTML5后期的音频和本地存储功能,并已运行到的东西,已经难倒我。

I've been experimenting with the audio and local storage features of html5 of late and have run into something that has me stumped.

我想能够缓存或存储音频元素的源本地以实现更快和脱机播放。问题是,我看不出这是可能与目前的执行情况。

I'd like to be able to cache or store the source of the audio element locally to enable speedier and offline playback. The problem is I can't see how this is possible with the current implementation.

我曾尝试使用WebKit的以下内容:

I have tried the following using WebKit:


  1. 创建清单文件来设置本地缓存,但该音频文件似乎不是一个缓存项由于可能的方式是流或东西

  1. Creating a manifest file to set up local caching but the audio file appears not to be a cacheable item maybe due to the way it is stream or something

我也试图使用JavaScript来把一个音频对象到本地存储,但MP3的大小,使这不可能的,因为内存问题(我认为)。

I have also attempted to use javascript to put an audio object into local storage but the size of the mp3 makes this impossible due to memory issues (i think).

我曾尝试使用数据uri和BASE64使用HTML作为可缓存,但再次文件大小使得这望而却步一个音频传输。此外音频元素似乎并不喜欢这个WebKit中(在Mozilla工作正常)

I have tried to use the data uri and base64 to use the html as a audio transport that can be cached but again the filesize makes this prohibitive. Also the audio element does not seem to like this in WebKit (works fine in mozilla)

我已尝试将数据放入本地数据库存储的几种方法。再次遭受同样问题的其他情况。

I have tried several methods of putting the data into the local database store. Again suffering the same issues as the other cases.

我很乐意听到任何其他想法的人可能会为我能如何使用缓存/本地存储WebKit中实现我的脱机播放的目标。

I'd love to hear any other ideas anyone may have as to how I could achieve my goal of offline playback using caching/local storage in WebKit.

推荐答案

所以它已经有一段时间,因为我问这个问题,我想我给我们如何解决它的一些信息。基本上我们带codeD使用类似的技术,这个数据到PNG的:

So it's been a while since I asked this question and I thought i'd give some info about how we solved it. Basically we encoded the data into PNG's using a similar technique to this:

<一个href=\"http://audioscene.org/scene-files/yury/pngencoding/sample.html\">http://audioscene.org/scene-files/yury/pngencoding/sample.html

然后缓存使用HTML5本地存储在移动装置上的图像,并访问它作为必要的。巴新的为pretty大,但这个工作对我们来说。

Then cached the image on the mobile device using html5 local storage and accessed it as needed. The PNG's were pretty big but this worked for us.

这篇关于音频元素源的HTML5本地存储 - 这可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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