如何在NAO机器人中进行音频Web流?

时间:2019-01-24 12:11:21

标签: python-2.7 nao-robot

我正在尝试NAO播放音频网络流,但是我的所有方法似乎都不起作用。

我已经提取了广播频道https://wg.cdn.tibus.net/fm104MP3128的流URL,并从错误中使用了playWebStream函数,但它总是说,找不到文件。我的代码如下以及相应的错误:

# -*- encoding: UTF-8 -*-

import sys
import time
from naoqi import ALProxy

IP ="10.48.92.189"
PORT = 9559
if (len(sys.argv) > 2):
    PORT = sys.argv[2]
try:
    aup = ALProxy("ALAudioPlayer", IP, PORT)
except Exception,e:
    print "Could not create proxy to ALAudioPlayer"
    print "Error was: ",e
    sys.exit(1)
print("cheguei")
#plays a file and get the current position 5 seconds later
fileID=aup.playWebStream("https://wg.cdn.tibus.net/fm104MP3128",1,0)
print(fileID)
time.sleep(5)
--------------------------------------------------------------------
Traceback (most recent call last):
 File "C:/Python27/playwebstream.py", line 21, in <module>
    fileID=aup.playWebStream("https://wg.cdn.tibus.net/fm104MP3128",1,0)
  File "C:\Python27\lib\site-packages\naoqi.py", line 239, in __call__
    return self.__wrapped__.method_missing(self.__method__, *args, **kwargs)
  File "C:\Python27\lib\site-packages\naoqi.py", line 309, in method_missing
    raise e
RuntimeError:   ALAudioPlayer::playWebStream
        ALBroker::methodCall: method: playWebStream, params: ["https://wg.cdn.tibus.net/fm104MP3128", 1, 0]
        ALAudioPlayer::playWebStream
        ALAudioPlayerTask::initialize
        ALAudioPlayer::ALAudioPlayerTask constructor
    file 'https://wg.cdn.tibus.net/fm104MP3128' not found

我的主要目标是查看playWebStream函数是否起作用。

欢迎提出任何建议。

0 个答案:

没有答案