Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change-codecs: remove audio #1651

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/content/peerconnection/change-codecs/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ const supportsSetCodecPreferences = window.RTCRtpTransceiver &&
let localStream;
let pc1;
let pc2;
const offerOptions = {
offerToReceiveAudio: 1,
offerToReceiveVideo: 1
};

function getName(pc) {
return (pc === pc1) ? 'pc1' : 'pc2';
Expand All @@ -64,7 +60,7 @@ async function start() {
console.log('Requesting local stream');
startButton.disabled = true;
try {
const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: true});
const stream = await navigator.mediaDevices.getUserMedia({video: true});
console.log('Received local stream');
localVideo.srcObject = stream;
localStream = stream;
Expand Down Expand Up @@ -93,13 +89,9 @@ async function call() {
console.log('Starting call');
startTime = window.performance.now();
const videoTracks = localStream.getVideoTracks();
const audioTracks = localStream.getAudioTracks();
if (videoTracks.length > 0) {
console.log(`Using video device: ${videoTracks[0].label}`);
}
if (audioTracks.length > 0) {
console.log(`Using audio device: ${audioTracks[0].label}`);
}
const configuration = {};
console.log('RTCPeerConnection configuration:', configuration);
pc1 = new RTCPeerConnection(configuration);
Expand All @@ -116,7 +108,7 @@ async function call() {

try {
console.log('pc1 createOffer start');
const offer = await pc1.createOffer(offerOptions);
const offer = await pc1.createOffer();
await onCreateOfferSuccess(offer);
} catch (e) {
onCreateSessionDescriptionError(e);
Expand Down Expand Up @@ -146,9 +138,6 @@ async function onCreateOfferSuccess(desc) {
}

console.log('pc2 createAnswer start');
// Since the 'remote' side has no media stream we need
// to pass in the right constraints in order for it to
// accept the incoming offer of audio and video.
try {
const answer = await pc2.createAnswer();
await onCreateAnswerSuccess(answer);
Expand Down
Loading