audio stuff
This commit is contained in:
parent
c70a598014
commit
0a438fdcf2
2 changed files with 9 additions and 6 deletions
|
|
@ -6,7 +6,6 @@ import 'package:fluffychat/pangea/config/environment.dart';
|
|||
import 'package:fluffychat/pangea/constants/model_keys.dart';
|
||||
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
|
||||
import 'package:fluffychat/pangea/network/urls.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../network/requests.dart';
|
||||
|
|
@ -37,15 +36,17 @@ class TextToSpeechRequest {
|
|||
|
||||
class TextToSpeechResponse {
|
||||
String audioContent;
|
||||
String mediaType;
|
||||
String mimeType;
|
||||
int durationMillis;
|
||||
List<int> waveform;
|
||||
String fileExtension;
|
||||
|
||||
TextToSpeechResponse({
|
||||
required this.audioContent,
|
||||
required this.mediaType,
|
||||
required this.mimeType,
|
||||
required this.durationMillis,
|
||||
required this.waveform,
|
||||
required this.fileExtension,
|
||||
});
|
||||
|
||||
factory TextToSpeechResponse.fromJson(
|
||||
|
|
@ -53,9 +54,10 @@ class TextToSpeechResponse {
|
|||
) =>
|
||||
TextToSpeechResponse(
|
||||
audioContent: json["audio_content"],
|
||||
mediaType: json["media_type"],
|
||||
mimeType: json["mime_type"],
|
||||
durationMillis: json["duration_millis"],
|
||||
waveform: List<int>.from(json["wave_form"]),
|
||||
fileExtension: json["file_extension"],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,12 +114,13 @@ class PangeaMessageEvent {
|
|||
// final fileName =
|
||||
// text.trim().replaceAll(RegExp('[^A-Za-z0-9]'), '').substring(0, 20);
|
||||
final eventIdParam = _event.eventId;
|
||||
final fileName = "audio_for_${eventIdParam}_$langCode.mp3";
|
||||
final fileName =
|
||||
"audio_for_${eventIdParam}_$langCode.${response.fileExtension}";
|
||||
|
||||
final file = MatrixAudioFile(
|
||||
bytes: audioBytes,
|
||||
name: fileName,
|
||||
mimeType: "audio/mpeg",
|
||||
mimeType: response.mimeType,
|
||||
);
|
||||
|
||||
// try {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue