wx.MediaCtrl how play a streaming media audio?

Hi

I am trying to use wx.MediaCtrl on windows for playing http audio stream… The Play() method on MediaCtrl is failing :frowning: I’ve tried with different streams with no luck. Can you please tell me whats going wrong or show me an example of how to play streaming media?

#!/usr/bin/python

import wx
import wx.media
class MediaFrame(wx.Frame):
def init(self,id,title):
wx.Frame.init(self,None,id,title,)
self.panel = wx.Panel(self)
try:
self.mc = wx.media.MediaCtrl(self.panel,szBackend=wx.media.MEDIABACKEND_DIRECTSHOW)

    except NotImplementedError:
        print "media control not found"

   
   
    self.Bind(wx.media.EVT_MEDIA_LOADED,self.OnMediaLoaded)
    self.playbtn = wx.Button(self.panel,-1,"Play",)
    self.Bind(wx.EVT_BUTTON,self.OnPlay,self.playbtn)

    wx.CallAfter(self.DoLoadMedia)
   

def DoLoadMedia(self):
    print "Called"
    self.playbtn.Disable()
    if not self.mc.LoadFromURI("[

http://192.168.1.3:8000/ices](http://192.168.1.3:8000/ices)"):
print “Failed to load media”
else:
self.mc.SetInitialSize()
self.playbtn.Enable()

def OnMediaLoaded(self,):

    print "media Loaded"
    self.playbtn.Enable()
   
   
def OnPlay(self,evt):
    print "Onplay called"
    if not self.mc.Play():
        print "Failed to play"

    else:
        self.mc.SetInitialSize()

if name==“main” :
app = wx.PySimpleApp()
f = MediaFrame(-1,“testclient”)
f.Show(True)
app.MainLoop()

···


Godson Gera,
http://godson.in

Thank you very much for replying,

Infact I’ve tried both (WMP10,DIRECTSHOW), after i’ve installed and uninstalled wmp10 DIRECTSHOW backend started working however it is not continuing the stream, its only playing one track and then nothing happens. WMP10 still not working for me. Both seemed to be very unreliable to use them in production environment. Is there any specific procedure to use them? And I am not windows developer so presently not able use even other alternatives like COM (if you can kindly provide me a solution using COM ,ActiveX).

···

On Jan 5, 2008 2:50 AM, Robin Dunn robin@alldunn.com wrote:

Godson Gera wrote:

Hi

I am trying to use wx.MediaCtrl on windows for playing http audio
stream… The Play() method on MediaCtrl is failing :frowning: I’ve tried with
different streams with no luck. Can you please tell me whats going wrong

or show me an example of how to play streaming media?

Try the wx.media.MEDIABACKEND_WMP10 backend. The other backends could
probably be made to support streaming, but this one appears to do so

already with no extra help.


Godson Gera,
http://godson.in

Godson,

···

-----Original Message-----
From: Godson Gera [mailto:godson.g@gmail.com]
Sent: Sunday, January 06, 2008 8:02 AM
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] wx.MediaCtrl how play a
streaming media audio?

On Jan 5, 2008 2:50 AM, Robin Dunn <robin@alldunn.com> wrote:

  Godson Gera wrote:
  > Hi
  >
  > I am trying to use wx.MediaCtrl on windows for
playing http audio
  > stream.. The Play() method on MediaCtrl is failing :frowning:
I've tried with
  > different streams with no luck. Can you please tell
me whats going wrong
  > or show me an example of how to play streaming media?
  
  Try the wx.media.MEDIABACKEND_WMP10 backend. The other
backends could
  probably be made to support streaming, but this one
appears to do so
  already with no extra help.
  
Thank you very much for replying,

Infact I've tried both (WMP10,DIRECTSHOW), after i've
installed and uninstalled wmp10 DIRECTSHOW backend started
working however it is not continuing the stream, its only
playing one track and then nothing happens. WMP10 still not
working for me. Both seemed to be very unreliable to use them
in production environment. Is there any specific procedure to
use them? And I am not windows developer so presently not
able use even other alternatives like COM (if you can kindly
provide me a solution using COM ,ActiveX).

--
Godson Gera,
http://godson.in

I don't think many people on this group uses COM all too often (although I
might be mistaken). The PyWin32 user's group would probably be helpful.
You'll find them here:
http://mail.python.org/mailman/listinfo/python-win32

They might be able to suggest a way to use ctypes as well for that matter.

Mike