React Native WebRTC と Janus Gateway を使用してアプリを作成します。思い通りに動作します。私たちのアプリはプッシュツートークに基づいています。そのため、リッスン モードのユーザーが他のアプリのマイクを切断する必要がある場合。そして、誰かがボタンを押して話すと元に戻ります。
ブレーキングマイク:
if (!globalTrack) {
globalTracks = config.myStream.getTracks();
}
config.myStream.getTracks().forEach(t => {
config.myStream.removeTrack(t);
});
トラックを取り戻す:
globalTracks.forEach(t => {
config.myStream.addTrack(t);
});
pluginHandle.createOffer({
media: { addVideo: true },
success: function(jsep) {
Janus.debug(jsep);
pluginHandle.send({message: {audio: true, video: false}, "jsep": jsep });
},
error: function(error) {
console.log("WebRTC error... " + JSON.stringify(error));
}
});
// also I have try this:
devices = await mediaDevices.getUserMedia({audio: true, video: false})
// devices output https://pastebin.ubuntu.com/p/KQqBq2QRy3/
devices._tracks.forEach(t => {
config.myStream.addTrack(t);
});
pluginHandle.createOffer({
media: {audio: {deviceId: devices._tracks[0]['id']}, replaceAudio: true},
success: function(jsep) {
pluginHandle.send({message: {audio: true, video: false}, "jsep": jsep});
},
error: function(error) {
console.log(("WebRTC error... " + JSON.stringify(error));
}
});
問題:
問題: 例: 電話がかかってきて応答したとき。アプリを再起動してもユーザーの声が通りません。
Janus Gateway では、すべてが正常です。問題は再交渉だと思います。
- 問題は Android フォンでのみ発生しました。アプリを強制停止した後に動作します。
私が部屋で話すときのヤヌスゲートウェイログ:
There's a message for JANUS AudioBridge plugin
Setting muted property: true (room 20, user 2301490876606211)
Notifying participant 329012611897879 (kardan)
Sending event to transport...
>> 0 (Success)