![]() |
Show MP3 file inline - no download dialog! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Show MP3 file inline - no download dialog! (/showthread.php?tid=37432) |
Show MP3 file inline - no download dialog! - El Forum - 01-10-2011 [eluser]Matt Larsen[/eluser] Hey, I'm trying to create an "embed file" script. For example: Code: <embed src="http://mysite.com/embed/1"></embed> The script works perfectly for images. One of the files i'm testing is an MP3. This file type doesn't seem to work. I've executed the URL, and I get a download dialog. I've assumed this to be the problem. When I execute the URL with the image file type, I simply get the image (no download dialog). Here's my code: Code: function embed($file_id = 0) Are there any other headers I should include? Or is there a header I need to change? Thanks very much for your time, Matt Show MP3 file inline - no download dialog! - El Forum - 01-10-2011 [eluser]AlexJ[/eluser] Only image and plaintext files and files the browser know, will be opened in a browser window (I think IE is the only exception to this, it also downloades plaintext). So if the mimetype is not in a certain browserlist (like PDF, plaintext, images) etc, it wont work This is more a HTTP problem than a CI problem Show MP3 file inline - no download dialog! - El Forum - 01-10-2011 [eluser]ranjudsokomora[/eluser] Matt Larsen, I wouldn't suggest streaming an MP3 via Mime type to the browser. You might want to try to use an external player such as JWFlash. You could then build a very simple view that would play the file, of course you will have to sent it a location. Just a thought. Show MP3 file inline - no download dialog! - El Forum - 01-10-2011 [eluser]Matt Larsen[/eluser] Thanks guys. I'll look into JWFlash. By the way, I figured it out! "audio/mpeg3" isn't completely correct. Apparently, it's supposed to be "audio/mpeg" (no 3 on the end). Cheers, Matt |