Hey
im currently working with the WebRTC 2.4.0-exp.1 packageg … and managed to send Camera Video from one Unity Client to another Unity Client.
Also looked at the Datachannel example and managed to send an AudioStream to the other Unity Client … but i dont know how to play the received Audiostream!
Currently i have something like that.
receiveStream = new MediaStream();
receiveStream.OnAddTrack = e =>
{
Debug.Log("On Add Track");
if (e.Track is VideoStreamTrack track)
{
receiveImage.texture = track.InitializeReceiver(1280, 720);
}
if (e.Track is AudioStreamTrack atrack)
{
Debug.Log("RECEIVED AUDIOSTREAM");
}
};
but in the Type AudioStreamTrack there is nothing like Initialize receiver like with VideoStreamTrack?
@mrSaig can you confirm for me if you get SDP offer/answers each time you add a new track? I’m getting the session connected between two Unity PC’s and the add track works, I also see the UDP packets but the raw texture does not update. Then to answer your question on audio, do the following:
@WayneVenter Thanks will try your audio solution!
If you get the track and you texture simply does not update,
you probably forgott on one or both sides the webrtc update call
@mrSaig Yes, was for Recording, currently what I am doing to solve this problem is use another package from FROZEN MIST https://assetstore.unity.com/packages/templates/packs/fmetp-stream-143080, it works really well but the Video bandwidth usage is insane, so I need WebRTC VP8 encoding to deduce my bandwidth needs. I see from the release notes we will only get audio out in July/August, so my suggestion would be to try the audio encoder from Frozen Mist and stream the data over the dataChannel in WebRTC or just direct via the WebSocket and keep the video on WebRTC.
Many applications on the Internet allow you to get audio from video. Plus you don’t have to pay any money for it. But if you decide to do it yourself, you can find a code in the public domain that will enable you to do it. Modern technology amazes me because video sound is very high-quality today. I use https://productz.com/en/yamaha-yas-209/p/8VE1l while watching a movie. Sometimes I feel like someone is talking next to me, as this soundbar produces sound in three-dimensional quality.