WebRTC icon indicating copy to clipboard operation
WebRTC copied to clipboard

Audio playback failed Tapo C200

Open Roei639 opened this issue 1 year ago • 15 comments

Hello, when trying to play an mp3 using go2rtc on the tapo c200 camera, an error is received:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 198, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1808, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1845, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 686, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 961, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 726, in _handle_entity_call
    await result
  File "/config/custom_components/webrtc/media_player.py", line 74, in async_play_media
    assert r.ok
AssertionError

Configuration.yaml: media_player:

  • platform: webrtc name: Tapo Camera stream: tapo audio: pcma/8000

PCMA doesn't work either

Thanks

Roei639 avatar Mar 07 '23 14:03 Roei639

pcma/8000 transcoding template not exist. Should be pcma

AlexxIT avatar Mar 07 '23 15:03 AlexxIT

pcma doesn't work either...

Roei639 avatar Mar 07 '23 15:03 Roei639

Have you check two way audio in the go2rtc Web UI?

AlexxIT avatar Mar 07 '23 17:03 AlexxIT

Yes, not working.

Roei639 avatar Mar 07 '23 18:03 Roei639

Awaiting response...

Roei639 avatar Mar 10 '23 09:03 Roei639

You need to get it to work in the go2rtc WebUI. And then in this component. Enable go2rtc logs. Check errors.

AlexxIT avatar Mar 10 '23 09:03 AlexxIT

Hello, Even using the go2rtc interface through the links screen, there is no two-way audio.

Log:

19:23:17.085 ERR github.com/AlexxIT/go2rtc/cmd/mjpeg/mjpeg.go:159 > error="codecs not match: H264,PCMA"
19:23:19.972 ERR [api.mjpeg] add consumer error="codecs not match: H264,PCMA

Roei639 avatar Mar 15 '23 17:03 Roei639

MJPEG module support only MJPEG codec. This error is correct

AlexxIT avatar Mar 15 '23 17:03 AlexxIT

No link on the links page plays audio on the camera. That's the only thing there is a log

Roei639 avatar Mar 15 '23 20:03 Roei639

set log level stream to debug. try send tts via card player. see log i win this trouble. internal url set is wrong. change to valid and all work.

tayanov avatar Apr 19 '23 12:04 tayanov

set log level stream to debug. try send tts via card player. see log i win this trouble. internal url set is wrong. change to valid and all work.

I enabled a debug mode log. Unable to play from ha to camera

Log:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/webrtc/media_player.py:74
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 17:40:10 (1 occurrences)
Last logged: 17:40:10

[3654340272]
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 199, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1820, in async_call
    task.result()
  File "/usr/src/homeassistant/homeassistant/core.py", line 1857, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 216, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 798, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 977, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 838, in _handle_entity_call
    await result
  File "/config/custom_components/webrtc/media_player.py", line 74, in async_play_media
    assert r.ok
AssertionError

Roei639 avatar Apr 22 '23 11:04 Roei639

Trying to play audio from go2rtc WebUI

Log docker go2rtc:

16:11:02.071 INF go2rtc version 1.3.2 linux/arm
16:11:02.071 INF [api] listen addr=:1984
16:11:02.072 INF [rtsp] listen addr=:8554
16:11:02.073 INF [srtp] listen addr=:8443
16:11:02.073 INF [webrtc] listen addr=:8555/tcp
16:11:41.301 ERR github.com/AlexxIT/go2rtc/cmd/webrtc/init.go:176 > error="SetRemoteDescription called with no ice-ufrag"
16:12:30.222 ERR github.com/AlexxIT/go2rtc/cmd/webrtc/init.go:176 > error="SetRemoteDescription called with no ice-ufrag"

Roei639 avatar Apr 22 '23 13:04 Roei639

Hello!

I also have a Tapo C200 camera and I’ve set it up as follows:

streams:
  salon:
   - rtsp://user:[email protected]:554/stream1
   - tapo://user:[email protected]

The bi-directional audio works perfectly with go2rtc and the WebRTC card:

type: 'custom:webrtc-camera'
streams:
  - url: salon
    mode: webrtc
    media: video,audio,microphone

I can also play sounds on my camera using curl:

curl --request POST \
  --url 'https://frigate.example.com/live/webrtc/api/streams?dst=salon&src=ffmpeg:https://lasonotheque.org/UPLOAD/mp3/2954.mp3%23audio=pcma%23input=file'

However, I’m having trouble getting the virtual media player to work:

media_player:
  - platform: webrtc
    name: Caméra Salon
    stream: salon
    audio: pcma

I’m encountering the same error as @Roei639:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 230, in handle_call_service
    await hass.services.async_call(
  File "/usr/src/homeassistant/homeassistant/core.py", line 2035, in async_call
    response_data = await coro
  File "/usr/src/homeassistant/homeassistant/core.py", line 2072, in _execute_service
    return await target(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
    return await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 876, in entity_service_call
    response_data = await _handle_entity_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
    result = await task
  File "/config/custom_components/webrtc/media_player.py", line 74, in async_play_media
    assert r.ok
AssertionError

Can anyone help me resolve this issue? Thanks in advance!

simon511000 avatar Nov 19 '23 15:11 simon511000

@simon511000 all looks fine in your examples. I don't know why you getting this error. You can increase go2rtc log level to trace and check if you can see some requests from integration.

AlexxIT avatar Nov 19 '23 15:11 AlexxIT

Thanks to the go2rtc debug logs, I was able to realize that the local IP I had configured on Home Assistant was incorrect. After correcting the IP, it works!

Thank you very much for your help!

simon511000 avatar Nov 19 '23 16:11 simon511000