ich habe mal wieder ein Problem mit dem integrierten Flash-Player von wxPython. Kommentiere ich main() aus und starte die .swf Files direkt bei Programmstart, dann spielt er sie ab. Soll das Ganze aber zeitgesteuert über main() laufen, dann spielt der Player die Movies nur manchmal ab.
Das Problem tritt auch mit anderen Playern auf, z.B. MySpace Playern. Manche läde er sich, andere nicht. Bei Programmstart spielt er sie aber alle ab, auch die, die er vorher verschmäht hat. Hat einer ne Idee, woran das liegen könnte ?
Grüße, Seven
Code: Alles auswählen
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import wx,urllib2
from threading import Timer
from time import sleep
from random import randint
from wx.lib.flashwin import FlashWindow
wx.SetDefaultPyEncoding("UTF-8")
class FlashFrame(wx.Frame):
def __init__(self, parent = None, id = -1, title = "Flash Player", size = wx.Size(350, 320)):
wx.Frame.__init__(self, parent, id, title, size = size)
panel = wx.Panel(self)
vbox_main = wx.BoxSizer(wx.VERTICAL)
panel.SetSizer(vbox_main)
self.flash = FlashWindow(panel, style = wx.SUNKEN_BORDER)
vbox_main.Add(self.flash, 1, wx.ALL | wx.EXPAND)
self.Show()
class HandlePlay:
def __init__(self):
self.count = 15
self.playid = 0
self.movies = [
'http://www.crazyprofile.com/clocks/swf/Christmas.swf',
'http://www.crazyprofile.com/clocks/swf/Jessica_Alba02.swf',
'http://www.messe-ideen.de/upload/magische-zauberkugel.swf'
]
def counter(self):
# alle 15 Sekunden ein neues .swf File
if self.count == 15:
self.count = 0
self.play()
self.playid = ((self.playid + 1) % 3)
else:
self.count += 1
t = Timer(1, self.counter); t.start()
def play(self):
FF.flash.LoadMovie(0, self.movies[self.playid])
def main():
HP.counter()
if __name__ == '__main__':
app = wx.PySimpleApp()
FF = FlashFrame()
HP = HandlePlay()
#FF.flash.LoadMovie(0, HP.movies[randint(0,2)])
main()
app.MainLoop()