This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@discord-clone/shared",
|
||||
"private": true,
|
||||
"version": "1.0.24",
|
||||
"version": "1.0.25",
|
||||
"type": "module",
|
||||
"main": "src/App.jsx",
|
||||
"dependencies": {
|
||||
|
||||
@@ -240,6 +240,17 @@ export const VoiceProvider = ({ children }) => {
|
||||
setConnectionState('connecting');
|
||||
|
||||
try {
|
||||
// Request microphone permission (triggers Android runtime prompt)
|
||||
try {
|
||||
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
||||
stream.getTracks().forEach(t => t.stop());
|
||||
} catch (e) {
|
||||
console.error('Microphone permission denied:', e);
|
||||
setConnectionState('error');
|
||||
setActiveChannelId(null);
|
||||
return;
|
||||
}
|
||||
|
||||
const { token: lkToken } = await convex.action(api.voice.getToken, {
|
||||
channelId,
|
||||
userId,
|
||||
@@ -255,10 +266,18 @@ export const VoiceProvider = ({ children }) => {
|
||||
|
||||
const noiseSuppression = localStorage.getItem('voiceNoiseSuppression') !== 'false'; // default true
|
||||
|
||||
const isMobile = /Android|iPhone|iPad/i.test(navigator.userAgent);
|
||||
|
||||
const newRoom = new Room({
|
||||
adaptiveStream: true,
|
||||
dynacast: true,
|
||||
autoSubscribe: true,
|
||||
rtcConfig: {
|
||||
iceServers: [
|
||||
{ urls: 'stun:stun.l.google.com:19302' },
|
||||
{ urls: 'stun:stun1.l.google.com:19302' },
|
||||
],
|
||||
},
|
||||
audioCaptureDefaults: {
|
||||
autoGainControl: true,
|
||||
echoCancellation: true,
|
||||
@@ -275,7 +294,7 @@ export const VoiceProvider = ({ children }) => {
|
||||
dtx: false,
|
||||
red: true,
|
||||
videoEncoding: VideoPresets.h720.encoding,
|
||||
videoCodec: 'vp9',
|
||||
videoCodec: isMobile ? 'vp8' : 'vp9',
|
||||
screenShareEncoding: {
|
||||
maxBitrate: 10_000_000,
|
||||
maxFramerate: 60,
|
||||
|
||||
@@ -422,7 +422,6 @@ body {
|
||||
|
||||
.chat-input-form {
|
||||
padding: 0 8px 8px;
|
||||
margin-top: 24px;
|
||||
background-color: var(--bg-primary);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user