whosrdaddy
Vendor
I have this in my Controller:
my provider looks like this:
when I test this in FireFox (ie /mysite/GetWaveFile/test.wav), Mediaplayer opens automatically and plays test.wav.
In IE however, Media player is opened, Mediaplayer says "changing media" and the bombs out with the error "Windows Media player cannot play the file".
I suspect that FF is downloading the file and the opens it with WMP and that IE is doing something else.
if I change the line
return File(provider.GetWaveFile(id), "audio/x-wav");
to
return File(provider.GetWaveFile(id), "audio/x-wav", id);
I get a download dialog, which is expected since it adds the content-disposition header. This works in FF and IE, but I want to be able to play the wave file immediately.
Any suggestions?
/Daddy
-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
Code:
public FilePathResult GetWaveFile(string id)
{
var provider = new MessageFilesProvider();
return File(provider.GetWaveFile(id), "audio/x-wav");
}
my provider looks like this:
Code:
public interface IMessageFilesProvider
{
IEnumerable<string> Files();
string GetWaveFile(string fileName);
}
public class MessageFilesProvider : IMessageFilesProvider
{
private readonly IMessagePathProvider pathProvider;
public MessageFilesProvider(IMessagePathProvider pathProvider)
{
this.pathProvider = pathProvider;
}
public MessageFilesProvider() : this(ServiceLocator.Current.GetInstance<IMessagePathProvider>()) { }
public IEnumerable<string> Files()
{
var path = pathProvider.MessagePath(MessageType.RecordedMessages);
return Directory.GetFiles(path, "*.wav", SearchOption.TopDirectoryOnly);
}
public string GetWaveFile(string fileName)
{
var path = pathProvider.MessagePath(MessageType.ActiveMessages);
return Path.Combine(path, fileName);
}
}
when I test this in FireFox (ie /mysite/GetWaveFile/test.wav), Mediaplayer opens automatically and plays test.wav.
In IE however, Media player is opened, Mediaplayer says "changing media" and the bombs out with the error "Windows Media player cannot play the file".
I suspect that FF is downloading the file and the opens it with WMP and that IE is doing something else.
if I change the line
return File(provider.GetWaveFile(id), "audio/x-wav");
to
return File(provider.GetWaveFile(id), "audio/x-wav", id);
I get a download dialog, which is expected since it adds the content-disposition header. This works in FF and IE, but I want to be able to play the wave file immediately.
Any suggestions?
/Daddy
-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!