Skip to content

Commit

Permalink
Merge pull request #133 from braden-w:feat/loading-toast-for-getting-…
Browse files Browse the repository at this point in the history
…stream-for-device-id

feat: loading toast for getting stream of audio input device
  • Loading branch information
braden-w committed Jun 30, 2024
2 parents 6664bb0 + ccc7b15 commit 4550b90
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion apps/app/src/lib/services/MediaRecorderServiceWebLive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,23 @@ export const MediaRecorderServiceWebLive = Layer.effect(
enumerateRecordingDevices,
startRecording: (recordingDeviceId: string) =>
Effect.gen(function* () {
stream = yield* getStreamForDeviceId(recordingDeviceId).pipe(
stream = yield* Effect.gen(function* () {
const connectingToRecordingDeviceToastId = nanoid();
yield* toast({
id: connectingToRecordingDeviceToastId,
variant: 'loading',
title: 'Connecting to audio input device...',
description: 'Please allow access to your microphone if prompted.',
});
const stream = yield* getStreamForDeviceId(recordingDeviceId);
yield* toast({
id: connectingToRecordingDeviceToastId,
variant: 'success',
title: 'Connected to audio input device',
description: 'Successfully connected to your microphone stream.',
});
return stream;
}).pipe(
Effect.catchAll(() =>
Effect.gen(function* () {
const defaultingToFirstAvailableDeviceToastId = nanoid();
Expand Down

0 comments on commit 4550b90

Please sign in to comment.