|
|
@ -115,6 +115,7 @@ class _RecorderBottomSheetState extends State<RecorderBottomSheet> { |
|
|
request.fields['locale'] = 'zh-CN'; |
|
|
request.fields['locale'] = 'zh-CN'; |
|
|
|
|
|
|
|
|
request.files.add(await http.MultipartFile.fromPath('audiodata', _path)); |
|
|
request.files.add(await http.MultipartFile.fromPath('audiodata', _path)); |
|
|
|
|
|
|
|
|
final streamed = await request.send(); |
|
|
final streamed = await request.send(); |
|
|
final response = await http.Response.fromStream(streamed); |
|
|
final response = await http.Response.fromStream(streamed); |
|
|
if (streamed.statusCode < 200 || streamed.statusCode >= 300) { |
|
|
if (streamed.statusCode < 200 || streamed.statusCode >= 300) { |
|
|
@ -132,6 +133,9 @@ class _RecorderBottomSheetState extends State<RecorderBottomSheet> { |
|
|
request.fields['consentId'] = _jessicaConsentId; |
|
|
request.fields['consentId'] = _jessicaConsentId; |
|
|
|
|
|
|
|
|
request.files.add(await http.MultipartFile.fromPath('audiodata', _path)); |
|
|
request.files.add(await http.MultipartFile.fromPath('audiodata', _path)); |
|
|
|
|
|
request.files.add(await http.MultipartFile.fromPath('audiodata', |
|
|
|
|
|
'/data/user/0/com.saitong.voitrans/app_flutter/VoiceReplication/recording_1764763812656.wav')); |
|
|
|
|
|
|
|
|
final streamed = await request.send(); |
|
|
final streamed = await request.send(); |
|
|
final response = await http.Response.fromStream(streamed); |
|
|
final response = await http.Response.fromStream(streamed); |
|
|
if (streamed.statusCode >= 200 && streamed.statusCode < 300) { |
|
|
if (streamed.statusCode >= 200 && streamed.statusCode < 300) { |
|
|
@ -144,6 +148,11 @@ class _RecorderBottomSheetState extends State<RecorderBottomSheet> { |
|
|
_storage.write('speakerProfileId', decoded['speakerProfileId']); |
|
|
_storage.write('speakerProfileId', decoded['speakerProfileId']); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
final bodyText = utf8.decode(response.bodyBytes, allowMalformed: true); |
|
|
|
|
|
if (bodyText.isNotEmpty) { |
|
|
|
|
|
final decoded = jsonDecode(bodyText); |
|
|
|
|
|
print('------2-------$decoded'); |
|
|
|
|
|
} |
|
|
throw Exception( |
|
|
throw Exception( |
|
|
'Failed to create personal voice: ${response.statusCode}'); |
|
|
'Failed to create personal voice: ${response.statusCode}'); |
|
|
} |
|
|
} |
|
|
|