HTML5 using src using raw binary data


If an audio file is stored in database and then we want to use this file as a blob or binary in an application where audio source is according to session then binary data is returned through ${sessionScope.user.music}. To load the audio file in an audio tag, data:audio/mp3;base64 works well.

As for the image, image tag is used as follows:

<img src="data:image/gif;base64,source “,width="30" height="25" alt="My Image">

Similarly for audio, audio tag data:audio/mp3 is used.

Updated on: 30-Jan-2020

677 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements