简体   繁体   中英

how can I use pyglet write a music player can play a music list

I want to play a music list with pyglet, who can help me, thanks!

music = pyglet.resource.media('music/file.ogg')
music.play()
pyglet.app.run()

Ok so the top 4 most recent pyglet tagged questions on SO right now is all related to this very specific thing..

I pulled one of them out of the hat and voila:

import pyglet

music = pyglet.media.load(r'./music/file.ogg')
music.play()

pyglet.app.run()

Please keep in mind that the only standard/normal format that is easily processed is .wav files, there for if you want to play mp3 or ogg files pyglet requires AVbin !

Quote from pyglet front-page :

use AVbin to play back audio formats such as MP3, OGG/Vorbis and WMA, and video formats such as DivX, MPEG-2, H.264, WMV and Xvid

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM