【发布时间】:2014-11-05 20:55:27
【问题描述】:
我已经在 fedora 20 上为 python 2.7 安装了 kivy 版本 1.8.1
由于我是 kivy 的新手我想知道我是否可以在 android 和 IOS 中使用 kivy 进行音频流传输
我尝试了一个示例,但它甚至无法在我的桌面上播放
from kivy.app import App
from kivy.core.audio import SoundLoader
class TestApp(App):
def build(self):
sound = SoundLoader.load('http://194.106.198.57:8090/club_low.mp3')
if sound:
print("Sound found at %s" % sound.source)
print("Sound is %.3f seconds" % sound.length)
sound.play()
TestApp().run()
以上代码的输出:
[INFO ] Kivy v1.8.0
[INFO ] [Logger ] Record log in /home/mohammad/.kivy/logs/kivy_14-09-11_13.txt
[INFO ] [Factory ] 157 symbols loaded
[DEBUG ] [Cache ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG ] [Cache ] register <kv.image> with limit=None, timeout=60s
[DEBUG ] [Cache ] register <kv.atlas> with limit=None, timeout=Nones
[INFO ] [Image ] Providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored)
[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG ] [Cache ] register <kv.shader> with limit=1000, timeout=3600s
[DEBUG ] [Audio ] register SoundPygame
[INFO ] [Audio ] Providers: audio_pygame (audio_pygst, audio_sdl ignored)
[DEBUG ] [App ] Loading kv </home/work/python/pama_radio/andriod_app/test.kv>
[DEBUG ] [App ] kv </home/work/python/pama_radio/andriod_app/test.kv> not found
[WARNING ] [Audio ] Unable to find a loader for <http://194.106.198.57:8090/club_low.mp3>
Traceback (most recent call last):
File "/home/work/python/pama_radio/andriod_app/main.py", line 11, in <module>
TestApp().run()
File "/usr/lib/python2.7/site-packages/kivy/app.py", line 766, in run
root = self.build()
File "/home/work/python/pama_radio/andriod_app/main.py", line 9, in build
print("Sound is %.3f seconds" % sound.length)
AttributeError: 'NoneType' object has no attribute 'length'
Process finished with exit code 1
我尝试了视频和视频播放器模块,它仅适用于桌面流式传输,不适用于 android(我没有尝试 IOS) 请告诉我是否可以使用其他格式(如 aac 和 ogg)
【问题讨论】:
标签: android python ios audio-streaming kivy