mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-28 20:38:20 +00:00
android, desktop: call logs
This commit is contained in:
@@ -112,6 +112,7 @@ const processCommand = (function () {
|
||||
}
|
||||
async function initializeCall(config, mediaType, aesKey) {
|
||||
var _a;
|
||||
console.log("Initializing call");
|
||||
let pc;
|
||||
try {
|
||||
pc = new RTCPeerConnection(config.peerConnectionConfig);
|
||||
@@ -154,6 +155,7 @@ const processCommand = (function () {
|
||||
connectionHandler();
|
||||
}
|
||||
async function connectionHandler() {
|
||||
console.log(`Connection state change: ${pc.connectionState}, ${pc.iceConnectionState}, ${pc.iceGatheringState}, ${pc.signalingState}`);
|
||||
sendMessageToNative({
|
||||
resp: {
|
||||
type: "connection",
|
||||
@@ -209,6 +211,7 @@ const processCommand = (function () {
|
||||
}
|
||||
async function processCommand(body) {
|
||||
const { corrId, command } = body;
|
||||
console.log(`process command: ${command.type}`);
|
||||
const pc = activeCall === null || activeCall === void 0 ? void 0 : activeCall.connection;
|
||||
let resp;
|
||||
try {
|
||||
@@ -220,6 +223,7 @@ const processCommand = (function () {
|
||||
// This request for local media stream is made to prompt for camera/mic permissions on call start
|
||||
if (command.media)
|
||||
await getLocalMediaStream(command.media, VideoCamera.User);
|
||||
console.log("Asked video camera permission");
|
||||
const encryption = supportsInsertableStreams(useWorker);
|
||||
resp = { type: "capabilities", capabilities: { encryption } };
|
||||
break;
|
||||
@@ -370,11 +374,13 @@ const processCommand = (function () {
|
||||
}
|
||||
function addIceCandidates(conn, iceCandidates) {
|
||||
for (const c of iceCandidates) {
|
||||
console.log("Adding ice candidate");
|
||||
conn.addIceCandidate(new RTCIceCandidate(c));
|
||||
// console.log("addIceCandidates", JSON.stringify(c))
|
||||
}
|
||||
}
|
||||
async function setupMediaStreams(call) {
|
||||
console.log("Setup media streams start");
|
||||
const videos = getVideoElements();
|
||||
if (!videos)
|
||||
throw Error("no video elements");
|
||||
@@ -389,6 +395,7 @@ const processCommand = (function () {
|
||||
// Without doing it manually Firefox shows black screen but video can be played in Picture-in-Picture
|
||||
videos.local.play();
|
||||
videos.remote.play();
|
||||
console.log("Setup media streams end");
|
||||
}
|
||||
async function setupEncryptionWorker(call) {
|
||||
if (call.aesKey) {
|
||||
@@ -409,6 +416,7 @@ const processCommand = (function () {
|
||||
const pc = call.connection;
|
||||
let { localStream } = call;
|
||||
for (const track of localStream.getTracks()) {
|
||||
console.log(`Adding local track: ${track.kind}`);
|
||||
pc.addTrack(track, localStream);
|
||||
}
|
||||
if (call.aesKey && call.key) {
|
||||
@@ -429,6 +437,7 @@ const processCommand = (function () {
|
||||
}
|
||||
for (const stream of event.streams) {
|
||||
for (const track of stream.getTracks()) {
|
||||
console.log(`Adding remote track: ${track.kind}`);
|
||||
call.remoteStream.addTrack(track);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user