|
13 | 13 | #include "src/converters/null.h"
|
14 | 14 | #include "src/dictionaries/webrtc/rtp_parameters.h"
|
15 | 15 | #include "src/interfaces/media_stream_track.h"
|
| 16 | +#include "src/interfaces/media_stream.h" |
16 | 17 | #include "src/interfaces/rtc_dtls_transport.h"
|
17 | 18 | #include "src/interfaces/rtc_peer_connection/peer_connection_factory.h"
|
18 | 19 | #include "src/node/error_factory.h"
|
@@ -116,6 +117,16 @@ Napi::Value RTCRtpSender::ReplaceTrack(const Napi::CallbackInfo& info) {
|
116 | 117 | return deferred.Promise();
|
117 | 118 | }
|
118 | 119 |
|
| 120 | +Napi::Value RTCRtpSender::SetStreams(const Napi::CallbackInfo& info) { |
| 121 | + CONVERT_ARGS_OR_THROW_AND_RETURN_NAPI(info, maybeStream, Maybe<MediaStream*>) |
| 122 | + auto streams = std::vector<std::string>(); |
| 123 | + if (maybeStream.IsJust()) { |
| 124 | + streams.emplace_back(maybeStream.UnsafeFromJust()->stream()->id()); |
| 125 | + } |
| 126 | + _sender->SetStreams(streams); |
| 127 | + return info.Env().Undefined(); |
| 128 | +} |
| 129 | + |
119 | 130 | Wrap <
|
120 | 131 | RTCRtpSender*,
|
121 | 132 | rtc::scoped_refptr<webrtc::RtpSenderInterface>,
|
@@ -152,6 +163,7 @@ void RTCRtpSender::Init(Napi::Env env, Napi::Object exports) {
|
152 | 163 | InstanceMethod("setParameters", &RTCRtpSender::SetParameters),
|
153 | 164 | InstanceMethod("getStats", &RTCRtpSender::GetStats),
|
154 | 165 | InstanceMethod("replaceTrack", &RTCRtpSender::ReplaceTrack),
|
| 166 | + InstanceMethod("setStreams", &RTCRtpSender::SetStreams), |
155 | 167 | StaticMethod("getCapabilities", &RTCRtpSender::GetCapabilities)
|
156 | 168 | });
|
157 | 169 |
|
|
0 commit comments