Olivier
2008-Sep-18 15:01 UTC
[asterisk-users] OT - How to stream a A-Law/wav file to a browser ?
Hi, How can I create a web page allowing people to listen (with their own PC) a couple of .wav/a-law files stored on a Linux server ? Chances are users would access this web page from Internet Explorer but if I could make it available to other browsers, that would be better. I googled a bit and couldn't find a tag such as media://myaudiofile.wav that would fulfill this spec. As much as possible, I would be happy to avoid configuring browser plugins and so on. So if this media:// could be already installed and running in users PCs, that would be fine. I've read Red5 servers/Flash players combination could respond but I'm not too confident about a-law support and Red5 installation complexity for a 100% pure beginner. What do you think ? Cheers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080918/327385d3/attachment.htm
Alex Balashov
2008-Sep-18 15:55 UTC
[asterisk-users] OT - How to stream a A-Law/wav file to a browser ?
How do you feel about converting them to RIFF/MSPCM WAV format and encoding them into MP3? On Thu, September 18, 2008 11:01 am, Olivier wrote:> Hi, > > How can I create a web page allowing people to listen (with their own PC) > a > couple of .wav/a-law files stored on a Linux server ? > Chances are users would access this web page from Internet Explorer but if > I > could make it available to other browsers, that would be better. > > I googled a bit and couldn't find a tag such as media://myaudiofile.wav > that > would fulfill this spec. > > As much as possible, I would be happy to avoid configuring browser plugins > and so on. > So if this media:// could be already installed and running in users PCs, > that would be fine. > > I've read Red5 servers/Flash players combination could respond but I'm not > too confident about a-law support and Red5 installation complexity for a > 100% pure beginner. > > What do you think ? > > Cheers > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > AstriCon 2008 - September 22 - 25 Phoenix, Arizona > Register Now: http://www.astricon.net > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-- Alex Balashov Evariste Systems Web : http://www.evaristesys.com/ Tel : (+1) (678) 954-0670 Direct : (+1) (678) 954-0671 Mobile : (+1) (706) 338-8599
Gordon Henderson
2008-Sep-18 16:17 UTC
[asterisk-users] OT - How to stream a A-Law/wav file to a browser ?
On Thu, 18 Sep 2008, Olivier wrote:> Hi, > > How can I create a web page allowing people to listen (with their own PC) a > couple of .wav/a-law files stored on a Linux server ? > Chances are users would access this web page from Internet Explorer but if I > could make it available to other browsers, that would be better. > > I googled a bit and couldn't find a tag such as media://myaudiofile.wav that > would fulfill this spec.If the web server is running php, then this will work: <? $action = $HTTP_GET_VARS["action"] ; $file = $HTTP_GET_VARS["file"] ; $caller = $HTTP_GET_VARS["caller"] ; if (empty ($action) || empty ($file)) die ("Something went wrong") ; // Open the file $fileName = "/prefix/" . $file ; $fd = @fopen ($fileName, "rb") ; if ($fd === FALSE) { Header ("Location: " . $caller . ".php?error=1") ; die () ; } // Send the headers to the browser $len = filesize ($fileName) ; Header ("Accept-Ranges: bytes"); Header ("Content-Length: $len") ; Header ("Keep-Alive: timeout=2, max=100") ; Header ("Connection: Keep-Alive") ; Header ("Content-Type: audio/x-wav") ; if ($action == "download") { Header ("Content-Disposition: attachment; filename=\"$fileName\""); Header ("Content-Description: File Transfer"); } // Transmit the file in 8K blocks while (!feof ($fd) && (connection_status () == 0)) { set_time_limit (0) ; print (fread ($fd, 1024*8)) ; flush () ; } fclose ($fd) ; ?> If this was called playback.php, then you'd reference it in other HTML code with: <a href="payback.php?action=play&file=music.wav&caller=thisFile">Click here to play</a> I've found that seems to let most browsers play (or download) most audio files, (most of the time ;-) The browser will (should) do whatever it's configured to do with audio files. I use this to let people playback voicemail and call recordings. Gordon
Philipp Kempgen
2008-Sep-18 16:54 UTC
[asterisk-users] OT - How to stream a A-Law/wav file to a browser ?
Gordon Henderson schrieb:> If the web server is running php, then this will work: > > <? > > $action = $HTTP_GET_VARS["action"] ; > $file = $HTTP_GET_VARS["file"] ; > $caller = $HTTP_GET_VARS["caller"] ; > > if (empty ($action) || empty ($file)) > die ("Something went wrong") ; > > // Open the file > > $fileName = "/prefix/" . $file ; > $fd = @fopen ($fileName, "rb") ;Without any validation of the filename? It could be "../../secret/file". Philipp Kempgen -- http://www.das-asterisk-buch.de - http://www.the-asterisk-book.com Amooma GmbH - Bachstr. 126 - 56566 Neuwied -> http://www.amooma.de Gesch?ftsf?hrer: Stefan Wintermeyer, Handelsregister: Neuwied B14998 --
Andres
2008-Sep-18 18:23 UTC
[asterisk-users] OT - How to stream a A-Law/wav file to a browser ?
Olivier wrote:> Hi, > > How can I create a web page allowing people to listen (with their own > PC) a couple of .wav/a-law files stored on a Linux server ? > Chances are users would access this web page from Internet Explorer > but if I could make it available to other browsers, that would be better. > > I googled a bit and couldn't find a tag such as > media://myaudiofile.wav that would fulfill this spec. > > As much as possible, I would be happy to avoid configuring browser > plugins and so on. > So if this media:// could be already installed and running in users > PCs, that would be fine. > > I've read Red5 servers/Flash players combination could respond but I'm > not too confident about a-law support and Red5 installation complexity > for a 100% pure beginner.This works for IE. It displays the Play Button of the Windows Media Player. No need to download files or anything. It plays right off the web page: <html> <body> <object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" width="35" height="32" align="absmiddle" id="VIDEO" style="width: 35px; height: 30px;"> <param name="URL" value="http://your WAV url goes here"> <param name="SendPlayStateChangeEvents" value="True"> <param name="AutoStart" value="False"> <param name="uiMode" value="mini"> <param name="PlayCount" value="1"> </object> <body> </html> Andres http://www.neuroredes.com> > What do you think ? > > Cheers > >------------------------------------------------------------------------ > >_______________________________________________ >-- Bandwidth and Colocation Provided by http://www.api-digital.com -- > >AstriCon 2008 - September 22 - 25 Phoenix, Arizona >Register Now: http://www.astricon.net > >asterisk-users mailing list >To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
Reasonably Related Threads
- from Adobe Flex / Flash Player 10 .flv Speex via Red5 to .wav PCM?
- compiling ffmpeg with --enable-libspeex (was Re: from Adobe Flex / Flash Player 10 .flv Speex via Red5 to .wav PCM?)
- Inquiry:How to convert *.wav files ?
- audio / sound recording with RoR app
- Red5