View Full Version : Wait for an audio file to end playing until new action possible?
Hi all
I'm playing a sound file in my VR. While it's playing I want all onkeydown events to be disabled. Is this possible somehow?
Thanks a lot
Josh
IGoudt
03-07-2010, 10:13 PM
I would make use of a variable 'audioPlaying = True/False' that's being checked everytime a key-event occurs.
snippets: (I use self here since I think in classes/objects)
def playAudio(self, file):
self.audioPlaying = True
..code to start audio
def onkeydown(self, key):
if not self.audioPlaying:
... handle keys
else:
print "audio playing, so keys are disabled"
in the place where you register onkeydown, register the following:
viz.callback(viz.MEDIA_END, self.audioEnded)
def audioEnded(self, e):
self.audioPlaying = False
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.