| 1 | import vlc |
|---|
| 2 | import wx |
|---|
| 3 | |
|---|
| 4 | class VideoWindow(wx.Window): |
|---|
| 5 | def __init__( self, parent ): |
|---|
| 6 | wx.Window.__init__( self, parent, -1 ) |
|---|
| 7 | |
|---|
| 8 | def play( self ): |
|---|
| 9 | self.video = vlc.MediaControl(["--verbose","2"]) |
|---|
| 10 | self.video.set_visual( self.GetHandle() ) |
|---|
| 11 | self.video.playlist_add_item("movie.mpg") |
|---|
| 12 | pos = vlc.Position() |
|---|
| 13 | pos.origin,pos.key,pos.value = vlc.AbsolutePosition,vlc.MediaTime,0 |
|---|
| 14 | self.video.start(pos) |
|---|
| 15 | |
|---|
| 16 | class VideoFrame(wx.Frame): |
|---|
| 17 | def __init__( self ): |
|---|
| 18 | wx.Frame.__init__( self, None, -1, "VLC playback test", size=(800,600) ) |
|---|
| 19 | |
|---|
| 20 | sizer = wx.BoxSizer( wx.VERTICAL ) |
|---|
| 21 | video = VideoWindow( self ) |
|---|
| 22 | sizer.Add( video, 1, wx.EXPAND ) |
|---|
| 23 | sizer.Add( wx.StaticText( self, -1, "foo" ), 0 ) |
|---|
| 24 | self.SetSizer( sizer ) |
|---|
| 25 | video.play() |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | class VideoApp(wx.App): |
|---|
| 29 | def OnInit(self): |
|---|
| 30 | VideoFrame().Show() |
|---|
| 31 | return True |
|---|
| 32 | |
|---|
| 33 | VideoApp().MainLoop() |
|---|