I develop music site.
On jsf
page I have HTML audio
tag
If audio file located in parent of WEB-INF
for example
WebContent
|-- META-INF
|-- WEB-INF
-- some.mp3
I just write next piece of code:
<audio ...>
<source src="#{request.contextPath}/some.mp3" type="audio/mpeg" />
</audio>
And after adding controls I could play/pause this audio.
But what should I do if my audio file does not store locally in WebContent
folder?
I know that audio files should store in DB like BLOB.
After downloading selected audio from DB how should I represent it?(String
array, some kind of Stream
?)
In all examples that I saw in the Web peoples play local audio files.
So, how to play audio (on jsf page) that store in database???
I hope you understand that I want.
audio
in parent ofWEB-INF
andsource
tag will looks like<source src="#{request.contextPath}/audio/#{myBean.audioTitle}" type="audio/mpeg" />
.... Secondly, code above will ask AudioServlet to download audio from database, translate it intoStream
and set it likeOutputStream
inresponse
??? – Bohdan Z.