1

We have a web service http://lullaby.shoresandbox.com/api/recordedsongs/stream/28 that streams an mp3 song. We are setting the following headers.

response.Content.Headers.Add("Content-Disposition", filename);
response.Content.Headers.Add("Content-Length", fileInfo.Length.ToString());

A sample URL from the web http://source.adminprotools.net/PartyBangaz/pbang019tk15.mp3 when opened in FireFox, the song is played and We could see the total duration of the song. But we are unable to see the total duration when we open our own song. Any help is greatly appreciated. We followed the link to stream a song.

dotcoder
  • 2,828
  • 10
  • 34
  • 50
  • Is Firefox making any additional range requests to support seeking? You may need to support those requests as well. – Brad Jul 31 '13 at 12:52
  • Firefox is not making additional requests – dotcoder Aug 02 '13 at 10:44
  • When do you set headers? In main function or in callback from constructor? – Vladimir Sep 04 '13 at 12:25
  • http://aspnet.codeplex.com/SourceControl/changeset/view/9cb7243bd9fe3b2df484bf2409af943f39533588#Samples/WebApi/PushContentControllerSample/PushContentController/Controllers/PushContentController.cs – Vladimir Sep 04 '13 at 12:26
  • This is asp.net web API. I am setting the headers in an action of a controller on the server side – dotcoder Sep 05 '13 at 09:18
  • Are you confident that the mp3 file itself has the duration tag set correctly? See this [link](http://msmvps.com/blogs/thinice/archive/2005/03/13/38384.aspx) – Automate This Sep 10 '13 at 21:10
  • I used the MP3Tag application and found that the files in question do have the duration set. – dotcoder Sep 11 '13 at 06:33

1 Answers1

0

I was trying to support the streaming by writing the code. I later realized the same can be achieved by giving the control to IIS. So i just return the URL of the static .mp3 file and leave the rest to the IIS server about how to stream it. It is working fine now.

dotcoder
  • 2,828
  • 10
  • 34
  • 50