AgoraIO-Community / AgoraAdvancedDemo

Advanced guides for Agora Unity SDK for voice and video. http://agora.io
MIT License
7 stars 5 forks source link

No Gameplay sound on streaming to Agora #3

Open eighteight opened 3 years ago

eighteight commented 3 years ago

In all streaming examples the audio from my microphone is being streamed OK, but if to the canvas in the scene I add a videoplayer and a videotexture rendering a video with audio (mp4 format), the streams to Agora do not have audio. I can only hear the audio from the video file locally when I play the said scene but not remotely, listening to the agora stream.

This is on Windows. Is there a way to add an audio from the video being played into the Agora Stream?

Thanks.

zhangtao1104 commented 3 years ago

You push your video frame to agorasdk by pushVideoFrame api, you can push your audio frame to agora sdk by pushAudioFrame api.

eighteight commented 3 years ago

I found this example (https://gist.github.com/icywind/8d1d6ad9831402bea8e5852933eb4eb9) on pushing the audio frames to agora sdk. I am getting an audio from the AudioStream on the agora client, however, it comes as a distorted audio. How can I debug/fix this? Thanks.

icywind commented 3 years ago

You need to match up the audio frame information, such as number of channels, sample rate, and your input audio type (PCM16 or ???).

gusev-genotek commented 3 years ago

@icywind It is all matched. The problem is, I think, that it takes too long time to convert data from one format into another –– around 40 ms.