You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that most of the examples are based on addtrack, but I haven't seen any examples of ontrack receiving audio and video. Could you provide an example of an answer method for receiving audio and video?
The text was updated successfully, but these errors were encountered:
If you already know what you want to send or receive, for instance because your media pipeline is fixed, you really should offer. However, if it is necessary, you can answer and get the remotely-offered track with onTrack(). In this case, you need to check what the remote peer offers:
std::shared_ptr<rtc::Track> track;
pc->onTrack([&track](std::shared_ptr<Track> offeredTrack) {
auto desc = offeredTrack->description();
if (desc.direction() == rtc::Description::Direction::SendOnly)
return;
// Filter formats we can receivefor(int pt : desc.payloadTypes()) {
auto rtpMap = desc.rtpMap(pt);
// If you don't want to receive this format, remove it from the description with desc.removeRtpMap(pt)// If you want to receive this format, you can optionally set an RTP depacketizer for pt with track->setMediaHandler()
}
offeredTrack->setDescription(desc);
std::atomic_store(&track, offeredTrack);
});
I see that most of the examples are based on addtrack, but I haven't seen any examples of ontrack receiving audio and video. Could you provide an example of an answer method for receiving audio and video?
The text was updated successfully, but these errors were encountered: