Skip to content

Commit

Permalink
Merge pull request #387 from boostcampwm-2024/fix/#385/stream
Browse files Browse the repository at this point in the history
[Fix] MediaStream 기본 화질 변경
  • Loading branch information
seoko97 authored Dec 6, 2024
2 parents 452887b + 45c63cb commit b9980ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 34 deletions.
9 changes: 0 additions & 9 deletions apps/media/src/mediasoup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,6 @@ export class MediasoupConfig {
useinbandfec: 1,
},
},
{
kind: 'video',
mimeType: 'video/H264',
clockRate: 90000,
parameters: {
'packetization-mode': 1,
'profile-level-id': '42e01f',
},
},
{
kind: 'video',
mimeType: 'video/VP8',
Expand Down
28 changes: 3 additions & 25 deletions apps/web/src/utils/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,21 @@ const DEFAULT_AUDIO_CONSTRAINTS: MediaTrackConstraints = {
autoGainControl: true,
};

const DEFAULT_VIDEO_CONSTRAINTS: MediaTrackConstraints = {
width: { ideal: 1280, min: 640, max: 1920 },
height: { ideal: 720, min: 360, max: 1080 },
frameRate: { max: 30, ideal: 15, min: 15 },
aspectRatio: { ideal: 16 / 9 },
};

const DEFAULT_SCREEN_CONSTRAINTS: MediaTrackConstraints = {
width: { max: 1920, ideal: 1280 },
height: { max: 1080, ideal: 720 },
frameRate: { max: 30, ideal: 15 },
};

const getCameraStream = async (options: MediaTrackConstraints = {}) => {
return navigator.mediaDevices.getUserMedia({
video: {
...DEFAULT_VIDEO_CONSTRAINTS,
...options,
},
video: { ...options },
});
};

const getMicStream = async (options: MediaTrackConstraints = {}) => {
return navigator.mediaDevices.getUserMedia({
audio: {
...DEFAULT_AUDIO_CONSTRAINTS,
...options,
},
audio: { ...DEFAULT_AUDIO_CONSTRAINTS, ...options },
});
};

const getScreenStream = async (options: MediaTrackConstraints = {}) => {
return navigator.mediaDevices.getDisplayMedia({
video: {
...DEFAULT_SCREEN_CONSTRAINTS,
...options,
},
video: { ...options },
});
};

Expand Down

0 comments on commit b9980ff

Please sign in to comment.