Solution for Python WX.MediaCtrl Black Transition Between Videos
is Given Below:
I am writing a wx.Python code that plays a video on a button press (works). If another button is pressed then another video is played (works).
However, there is a 2(ish) seconds of black screen while the second video is loaded. Is there a way to have it immediately load and play instead of having the black screen transition?
def onTestClick(self, media):
#array = 2
#if already playing, button press, next vid becomes 0, preload next vid, delay 1.6sec, play.
self.vidqueue = ["", ""]
self.vidqueue [0] = "Null"
self.vidqueue [1] = media
if self.vidqueue[0] == "Null":
self.vidqueue [0] = self.vidqueue [1]
print (self.vidqueue[0])
self.testMedia = wx.media.MediaCtrl(self, size = (500, 300), style=wx.SIMPLE_BORDER, szBackend = wx.media.MEDIABACKEND_WMP10)
self.testMedia.Load(self.vidqueue [0])
self.testMedia.Bind(wx.media.EVT_MEDIA_LOADED, self.play)
self.testMedia.Bind(wx.media.EVT_MEDIA_FINISHED, self.quit)
self.Bind(wx.EVT_BUTTON, self.addVid1, addBtn1)
self.Bind(wx.EVT_BUTTON, self.addVid2, addBtn2)
def buttonPressed1(self, event):
file1 = filePathList[0]
self.refTop.onTestClick(file1)
def buttonPressed2(self, event):
file2 = filePathList[1]
self.refTop.onTestClick(file2)
def play(self, event):
self.testMedia.Play()
self.vidqueue [0] = "Null"
def quit(self, event):
self.testMedia.Destroy()