hey all, I''m trying to do a: send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true I tried with all browsers and it always asks me to download the file or open it with a player. Is there a way to make it open in the embeded player (QT,Windows media player,Mplayer etc)? Only with konqueror if I open in new tab then I get the embeded player :/ Am I doing something wrong with rails or with mongrel? if it''s with mongrel , how could I configure it so it sends the right stuff? thanx in advance Pat
-----Original Message----- From: "Patrick Aljord" <patcito at gmail.com> Date: Fri, 16 Mar 2007 22:21:46 To:mongrel-users at rubyforge.org Subject: [Mongrel] how to send mp3 inline? hey all, I''m trying to do a: send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true I tried with all browsers and it always asks me to download the file or open it with a player. Is there a way to make it open in the embeded player (QT,Windows media player,Mplayer etc)? Only with konqueror if I open in new tab then I get the embeded player :/ Am I doing something wrong with rails or with mongrel? if it''s with mongrel , how could I configure it so it sends the right stuff? thanx in advance Pat _______________________________________________ Mongrel-users mailing list Mongrel-users at rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-users
AAA_4tyGthygtytygthyg -----Original Message----- From: "Patrick Aljord" <patcito at gmail.com> Date: Fri, 16 Mar 2007 22:21:46 To:mongrel-users at rubyforge.org Subject: [Mongrel] how to send mp3 inline? hey all, I''m trying to do a: send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true I tried with all browsers and it always asks me to download the file or open it with a player. Is there a way to make it open in the embeded player (QT,Windows media player,Mplayer etc)? Only with konqueror if I open in new tab then I get the embeded player :/ Am I doing something wrong with rails or with mongrel? if it''s with mongrel , how could I configure it so it sends the right stuff? thanx in advance Pat _______________________________________________ Mongrel-users mailing list Mongrel-users at rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-users
If you link to a raw audio/mp3 file, most browsers will force a download of it because most don''t include an mp3 player by default. You need to link to an HTML page that loads up some sort of mp3 player plugin explicitly (eg, via an object or embed tag). On 3/17/07, Patrick Aljord <patcito at gmail.com> wrote:> hey all, > I''m trying to do a: > send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true > > I tried with all browsers and it always asks me to download the file > or open it with a player. Is there a way to make it open in the > embeded player (QT,Windows media player,Mplayer etc)? Only with > konqueror if I open in new tab then I get the embeded player :/ > > Am I doing something wrong with rails or with mongrel? if it''s with > mongrel , how could I configure it so it sends the right stuff?
thanx that''s exactly what I did as a work around. I was just wondering there was another way. On 3/18/07, Eden Li <eden at mojiti.com> wrote:> If you link to a raw audio/mp3 file, most browsers will force a > download of it because most don''t include an mp3 player by default. > You need to link to an HTML page that loads up some sort of mp3 player > plugin explicitly (eg, via an object or embed tag). > > On 3/17/07, Patrick Aljord <patcito at gmail.com> wrote: > > hey all, > > I''m trying to do a: > > send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true > > > > I tried with all browsers and it always asks me to download the file > > or open it with a player. Is there a way to make it open in the > > embeded player (QT,Windows media player,Mplayer etc)? Only with > > konqueror if I open in new tab then I get the embeded player :/ > > > > Am I doing something wrong with rails or with mongrel? if it''s with > > mongrel , how could I configure it so it sends the right stuff? > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
afaik, no. On 3/18/07, Patrick Aljord <patcito at gmail.com> wrote:> thanx that''s exactly what I did as a work around. I was just wondering > there was another way.
you could try setting the Content-disposition header to "inline". Might work. Patrick Aljord wrote:> thanx that''s exactly what I did as a work around. I was just wondering > there was another way. > > On 3/18/07, Eden Li <eden at mojiti.com> wrote: >> If you link to a raw audio/mp3 file, most browsers will force a >> download of it because most don''t include an mp3 player by default. >> You need to link to an HTML page that loads up some sort of mp3 player >> plugin explicitly (eg, via an object or embed tag). >> >> On 3/17/07, Patrick Aljord <patcito at gmail.com> wrote: >>> hey all, >>> I''m trying to do a: >>> send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true >>> >>> I tried with all browsers and it always asks me to download the file >>> or open it with a player. Is there a way to make it open in the >>> embeded player (QT,Windows media player,Mplayer etc)? Only with >>> konqueror if I open in new tab then I get the embeded player :/ >>> >>> Am I doing something wrong with rails or with mongrel? if it''s with >>> mongrel , how could I configure it so it sends the right stuff? >> _______________________________________________ >> Mongrel-users mailing list >> Mongrel-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/mongrel-users >> > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
this is what I did in my view: <%= link_to_remote ''play in line'', :url=>{:action=>''playinline'',:songurl=>a.url ,:disposition=>''inline''}%> <div id="playa<%= Digest::MD5.hexdigest(a.url) %>"> </div> in my controller: def playinline @songurl=params[:songurl] @md5=Digest::MD5.hexdigest(params[:songurl]) end def play @tag=Rtag.find_by_url(params[''songurl'']) @file=@tag.rdevice.lastmountpoint+ at tag.url[1..-1] @file=@file[1..-1] if @file[0..1]==''//'' # render :layout=>false Mongrel::DirHandler::add_mime_type(''mp3'',''audio/mp3'') send_file @file, :type => ''audio/mp3'', :disposition => ''inline'' ,:stream=>true end in my playinline.rjs: page.replace_html ''playa''+ at md5, ''<embed src="''+url_for(:action=>''play'',:disposition=>''inline'',:songurl=>@songurl)+''" width="300" height="42" ></embed>'' works great Pat