mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-27 12:55:11 +01:00
Composer: Fix voice recording in Safari (#1440)
This commit is contained in:
parent
7b0825877d
commit
f4257d779a
@ -2,7 +2,7 @@ import {
|
||||
useCallback, useEffect, useRef, useState,
|
||||
} from '../../../../lib/teact/teact';
|
||||
|
||||
import { IS_IOS, IS_VOICE_RECORDING_SUPPORTED } from '../../../../util/environment';
|
||||
import { IS_SAFARI, IS_VOICE_RECORDING_SUPPORTED } from '../../../../util/environment';
|
||||
import * as voiceRecording from '../../../../util/voiceRecording';
|
||||
import captureEscKeyListener from '../../../../util/captureEscKeyListener';
|
||||
|
||||
@ -17,7 +17,7 @@ export default () => {
|
||||
|
||||
useEffect(() => {
|
||||
// Preloading worker fixes silent first record on iOS
|
||||
if (IS_IOS && IS_VOICE_RECORDING_SUPPORTED) {
|
||||
if (IS_SAFARI && IS_VOICE_RECORDING_SUPPORTED) {
|
||||
void voiceRecording.init();
|
||||
}
|
||||
}, []);
|
||||
|
@ -50,9 +50,11 @@ export const IS_SINGLE_COLUMN_LAYOUT = window.innerWidth <= MOBILE_SCREEN_MAX_WI
|
||||
export const IS_TABLET_COLUMN_LAYOUT = !IS_SINGLE_COLUMN_LAYOUT && (
|
||||
window.innerWidth <= MIN_SCREEN_WIDTH_FOR_STATIC_LEFT_COLUMN
|
||||
);
|
||||
export const IS_VOICE_RECORDING_SUPPORTED = (navigator.mediaDevices && 'getUserMedia' in navigator.mediaDevices && (
|
||||
window.AudioContext || (window as any).webkitAudioContext
|
||||
));
|
||||
export const IS_VOICE_RECORDING_SUPPORTED = Boolean(
|
||||
navigator.mediaDevices && 'getUserMedia' in navigator.mediaDevices && (
|
||||
window.AudioContext || (window as any).webkitAudioContext
|
||||
),
|
||||
);
|
||||
export const IS_SMOOTH_SCROLL_SUPPORTED = 'scrollBehavior' in document.documentElement.style;
|
||||
export const IS_EMOJI_SUPPORTED = PLATFORM_ENV && (IS_MAC_OS || IS_IOS);
|
||||
export const IS_SERVICE_WORKER_SUPPORTED = 'serviceWorker' in navigator;
|
||||
|
Loading…
Reference in New Issue
Block a user