【问题标题】:Unable to open file for playback: Invalid argument [status=120022]无法打开文件进行播放:参数无效 [status=120022]
【发布时间】:2014-01-06 07:27:29
【问题描述】:

我正在使用 pjsua python 包装器进行 sip 调用并播放 wav 文件。下面是尝试播放文件的代码:

# Notification when call's media state has changed.
    def on_media_state(self):
        global lib
        if self.call.info().media_state == pj.MediaState.ACTIVE:
            # Connect the call to sound device
            call_slot = self.call.info().conf_slot
            lib.conf_connect(call_slot, 0)
            lib.conf_connect(0, call_slot)
            print "Media is now active"

            # stream wav file
        # calculate wav time
        wfile = wave.open("test.wav")
        time = (1.0 * wfile.getnframes ()) / wfile.getframerate ()
        print str(time) + "ms"
        wfile.close()

        # stream wav file
        player_id = pj.Lib.instance().create_player("test.wav", loop=False)
        print "Wav player id is: ", player_id
        lib.conf_connect(lib.player_get_slot(player_id), call.info().conf_slot)

        sleep(time)
        lib.conf_disconnect(lib.player_get_slot(player_id), call.info().conf_slot)
        lib.player_destroy(player_id)

        else:
            print "Media is inactive"

我在日志中看到的内容如下:

Media is now active
23.3436281179ms
08:08:55.455    pjsua_aud.c  .....Creating file player: voice_tag_for_wolfgang.wav..
08:08:55.456    pjsua_aud.c  ......Unable to open file for playback: Invalid argument [status=120022]

有人知道为什么无法打开文件吗?

【问题讨论】:

    标签: python-sip


    【解决方案1】:

    显然这是由于错误的 MediaConfig 参数。

    【讨论】:

      猜你喜欢
      • 2019-06-17
      • 2022-09-22
      • 2015-09-21
      • 1970-01-01
      • 2015-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多