| 10 | } |
| 11 | |
| 12 | export default function getAudioContextBaseLatency(): number { |
| 13 | // The signal emits warning in Chrome and Firefox, therefore it is enabled on Safari where it doesn't produce warning |
| 14 | // and on Android where it's less visible |
| 15 | const isAllowedPlatform = isAndroid() || isWebKit() |
| 16 | if (!isAllowedPlatform) { |
| 17 | return SpecialFingerprint.Disabled |
| 18 | } |
| 19 | |
| 20 | if (!window.AudioContext) { |
| 21 | return SpecialFingerprint.NotSupported |
| 22 | } |
| 23 | |
| 24 | const latency = new AudioContext().baseLatency |
| 25 | |
| 26 | if (latency === null || latency === undefined) { |
| 27 | return SpecialFingerprint.NotSupported |
| 28 | } |
| 29 | |
| 30 | if (!isFinite(latency)) { |
| 31 | return SpecialFingerprint.NotFinite |
| 32 | } |
| 33 | |
| 34 | return latency |
| 35 | } |