Ok thanks now I understand :)
On Sunday, February 26, 2017 at 10:25:52 PM UTC, [email protected] wrote: > > When calling play() on a sound sample pyglet will return a player for > controlling that specific sounds playback, all sounds need to be played > through a player. You can create your own players and load/unload the > sounds for playing yourself as well. The way to write it may be something > like this: > > def someFunc(): > print(songlist) > song = raw_input("enter name of song: ") > mp3 = pyglet.media.load(dir+song) > self.playing = mp3.play() > > elif (char == "j"): > print("pause") > self.playing.pause() > > Creating your own players would be something like this: > > sound = pyglet.media.load('sound.wav') > self.player = pyglet.media.Player() > self.player.queue(sound) > self.player.play() > self.player.stop() > > > On Sunday, February 26, 2017 at 4:42:27 PM UTC-5, Jack wrote: >> >> Here is an example of what my code looks like: >> >> def someFunc(): >> printList(songlist) >> song = raw_input("enter name of song: ") >> mp3 = pyglet.media.load(dir+song) >> mp3.play() >> >> this works and plays the mp3 file I want >> >> then further down I have some code that waits for key input >> >> elif (char == "j"): >> print("pause") >> pyglet.media.pause() >> >> but nothing happens, the audio keeps on playing and everytime I press 'J' >> it prints 'pause' I have no idea what's wrong as I have been following the >> documentation >> > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
