Browse Source

Some tweaks

master
Eduard Kuzmenko 3 years ago
parent
commit
9f4fbab03f
  1. 13
      src/lib/calls/groupCallConnectionInstance.ts
  2. 2
      src/lib/calls/helpers/getScreenStream.ts
  3. 20
      src/lib/calls/streamManager.ts

13
src/lib/calls/groupCallConnectionInstance.ts

@ -308,6 +308,19 @@ export default class GroupCallConnectionInstance extends CallConnectionInstanceB @@ -308,6 +308,19 @@ export default class GroupCallConnectionInstance extends CallConnectionInstanceB
});
}
if(this.options.type === 'presentation') {
promise.then(() => {
this.connection.getTransceivers().find(transceiver => {
if(transceiver.sender?.track?.kind === 'video') {
transceiver.sender.setParameters({
...transceiver.sender.getParameters(),
degradationPreference: 'maintain-resolution'
});
}
});
});
}
return promise;
}

2
src/lib/calls/helpers/getScreenStream.ts

@ -1,4 +1,6 @@ @@ -1,4 +1,6 @@
export default async function getScreenStream(constraints: DisplayMediaStreamConstraints) {
const screenStream = await navigator.mediaDevices.getDisplayMedia(constraints);
const track = screenStream.getVideoTracks()[0];
track.contentHint = 'text';
return screenStream;
}

20
src/lib/calls/streamManager.ts

@ -266,9 +266,18 @@ export default class StreamManager { @@ -266,9 +266,18 @@ export default class StreamManager {
// const direction: RTCRtpTransceiverInit['direction'] = 'sendrecv';
// const direction: RTCRtpTransceiverInit['direction'] = 'sendonly';
const transceiverInit: RTCRtpTransceiverInit = {direction, streams: [inputStream]};
const transceiverAudioInit: RTCRtpTransceiverInit = {...transceiverInit};
const transceiverVideoInit: RTCRtpTransceiverInit = {...transceiverInit};
// if(this.isScreenSharingManager) {
// transceiverVideoInit.sendEncodings = [{}];
// } else {
// transceiverVideoInit.sendEncodings = [{maxBitrate: 2500000}];
// }
const types: ['audio' | 'video', RTCRtpTransceiverInit][] = [
['audio' as const, transceiverInit],
['video' as const, transceiverInit/* {sendEncodings: [{maxBitrate: 2500000}], ...transceiverInit} */]
['audio' as const, transceiverAudioInit],
['video' as const, transceiverVideoInit]
];
const tracks = inputStream.getTracks();
@ -290,6 +299,13 @@ export default class StreamManager { @@ -290,6 +299,13 @@ export default class StreamManager {
let {transceiver} = entry;
if(!transceiver) {
transceiver = entry.createTransceiver(conference.connection, transceiverInit);
/* if(this.isScreenSharingManager) {
transceiver.sender.setParameters({
...transceiver.sender.getParameters(),
degradationPreference: 'maintain-resolution'
});
} */
}
if(entry.direction !== transceiver.direction) {

Loading…
Cancel
Save