feat(mobile): track mobile app scaffold
This commit is contained in:
25
mobile/app/src/platform/voice/voiceInput.ts
Normal file
25
mobile/app/src/platform/voice/voiceInput.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useAudioRecorder, RecordingPresets } from 'expo-audio';
|
||||
|
||||
export function useVoiceRecorder() {
|
||||
const recorder = useAudioRecorder(RecordingPresets.HIGH_QUALITY);
|
||||
|
||||
return {
|
||||
recorder,
|
||||
async start() {
|
||||
await recorder.prepareToRecordAsync();
|
||||
recorder.record();
|
||||
},
|
||||
async stop() {
|
||||
await recorder.stop();
|
||||
return recorder.uri;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export async function transcribeVoice(uri: string) {
|
||||
// 后续接入 /api/v1/mobile/voice/transcribe;初始化阶段先返回可见占位结果。
|
||||
return {
|
||||
text: `已收到语音文件:${uri.split('/').pop() || 'voice-recording'}`,
|
||||
confidence: 0,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user