Can use python to play MP3 file?
Gerhard Häring
gh_pythonlist at gmx.de
Fri Mar 1 21:04:53 EST 2002
Le 28/02/02 à 16:52, Tim H écrivit:
> "Gerhard Häring" <gerhard at bigfoot.de> wrote:
> > Ricky wrote:
> > > I hear that PHP can online play MP3 file. Is there any method that
> > > can make me play MP3 by using Python CGI?
> > >
> > > Thanks for any reply!
> >
> > Do you want to play the MP3 file on the server, like a jukebox. Or do
> > you want to stream MP3 files back to the client computer?
> >
> > (Of course you can do both with Python)
> >
> > Gerhard
>
> Do you have examples, links, hints to doing each with python?
Playing an MP3 file using pygame (http://www.pygame.org/):
import pygame.mixer as mixer
mixer.init(44100)
mixer.music.load("White Bird.mp3")
mixer.music.play()
mixer.music.get_busy()
print "Press enter to quit."
raw_input()
OTOH streaming MP3 files from the server to the client has IMHO little
to do with Python, it's more of a HTTP thing. As long as you've set the
correct content type and played the right tricks with HTML, it should
just work. FWIW, there's a streaming MP3 server written in Python at
Sourceforge: http://edna.sourceforge.net/
Gerhard
--
This sig powered by Python!
Außentemperatur in München: 4.0 °C Wind: 3.2 m/s
More information about the Python-list
mailing list