2

I have a database in MS SQL Server'08 with mp3 files as BLOB objects (I use filestream for storing).

There's a WCF service which works with database (linq).

There's a client application on html+javascript (and nothing more).

How to play one of the audio files from server on the client?I tried to send a byte array which represents mp3 file, but it's a problem how to play this array as sound using javascript.

Thanks

Ilya Blokh
  • 11,923
  • 11
  • 52
  • 84
  • MP3 files in the database? YUCK! Store them as files and put the path in the database instead. Seriously - putting files in the DB is bad practice. You already have an efficient system on your server for storing files - the filesystem. Why task a database with providing inefficient duplicate functionality? Putting all that binary data in the DB is going to make it perform poorly and it will eventually grind to a halt. – Chris Baker Aug 05 '11 at 19:25
  • 1
    @Chris - Did you miss the part where the OP explains that they are using the `FileStream` functionality? Which does store it on the file system rather than in the data files. – Martin Smith Aug 06 '11 at 05:21

1 Answers1

0

You need to use a server side script to serve up the MP3 out of the database.

If you are using SQL Server, I assume you will need to use the .Net Framework to fetch rows from the database.

js1568
  • 7,012
  • 2
  • 27
  • 47
  • I wrote a WCF service which can send to client a byte array which represents a mp3 file, but how to play this byte array as an audio using javascript?Or it's better not to send a byte array and do smth else? – Ilya Blokh Aug 07 '11 at 06:00