January 29th, 2005, 12:58 AM
-
how to import media player to python?
hello,
can someone tell me how to import a windows media player into python.what are the modules to be imported?.
January 29th, 2005, 08:06 AM
-
There aren't any in the standard library. The winsound module is as close as it gets, but that just beeps and plays WAV files.
There are probably some out there (I started using the bass library with ctypes at one point, which worked very well until I got a bit lost).
On Windows, one of the core technologies is COM, which is a common-interface between a lot of different programs and languages. If there is a COM control written in one language, and your language also supports COM, you can use that control without too much hassle.
Python supports COM if you have the Win32 extensions, and Media Player is controllable with COM, so you can do...
Code:
from win32com.client import Dispatch
mp = Dispatch("WMPlayer.OCX.7")
tune = mp.newMedia("c:\\music\\song.mp3")
mp.currentPlaylist.appendItem(tune)
mp.controls.play()
Not just a windows media player, but The Windows Media Player.
February 21st, 2005, 02:36 AM
-
Well, you could either use COM, or, you could try making a small media player in pygame (or there are a few other libs)