I know you can store images as blob data and then have that blob data put within an image tag, which will display as it would with a regular image file. Is this possible with audio as well? I want to do this because I want it so that the audio is recorded, saved as blob data, and then sent to a server where then other users can access that blob data and replay the audio simply from that blob data.
Asked
Active
Viewed 2,754 times
0
-
Modern browser should accept a `data:` url for every element. – t.niese Mar 23 '15 at 05:58
-
have you tried the htm – Lucky Mar 23 '15 at 05:59
1 Answers
1
Yes, it is also possible with Audio - in browsers that implement Blob URLs, anyway.
The browser simply (and universally) knows how to 'read' blob URLs, as it does any valid URL. Only, instead of making a request it accesses the local blob cache.
Data URLs work in the same manner and are probably easier to use when 'transferring data from the server' - as their name implies they contain all the data embedded within the URL. For downloading previously shared content, consider keeping the Audio stream a separate resource and using normal URLs / resources.
Anyway, for the details like how to actually capture the data, see Capturing Audio & Video in HTML5.

user2864740
- 60,010
- 15
- 145
- 220
-
The problem I had was when given the url, it seemed only to be a temporary thing when I left my browser tab that had the audio. Once it exited, the audio no longer exists. If I were to transfer the url to the server and someone else viewed the url, would they still hear the audio? – user3864563 Mar 23 '15 at 06:16
-
@user3864563 Well, that *is* a Blob URL.. it is a *local non-persisted resource* (basically a tag for a *local cache entry*). You must send the *actual data* back to the web-server and then send the *actual data* to other clients (who create their *own local Blob URLs for the underlying data*). This is why a Data URL is likely easier to deal with then doing this additional processing. Blob URLs can be [converted to Data URLs](http://stackoverflow.com/questions/14952052/convert-blob-url-to-normal-url) and Data URLs *contain all data*. – user2864740 Mar 23 '15 at 06:17