second attempt at iphone content-range fix

This commit is contained in:
Brandon Thomas committed 2020-06-09 19:20:01 -04:00
1 parent 898e32db05
commit 0281e206db
2 files changed
+8 -4

No files matched your search

+4 -2
View File
@@ -154,10 +154,11 @@ pub async fn legacy_get_speak(request: HttpRequest,
// Content-Type: audio/wav
// Content-Disposition:
// Content-Length: len()
let content_range_value = format!("bytes 0-{}/{}", wav_data.len(), wav_data.len());
Ok(HttpResponse::build(StatusCode::OK)
.content_type("audio/wav")
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
.set_header(header::CONTENT_RANGE, "bytes */*")
.set_header(header::CONTENT_RANGE, content_range_value)
.body(wav_data))
},
}
@@ -209,10 +210,11 @@ pub async fn legacy_get_speak(request: HttpRequest,
// Content-Type: audio/wav
// Content-Disposition:
// Content-Length: len()
let content_range_value = format!("bytes 0-{}/{}", wav_data.len(), wav_data.len());
Ok(HttpResponse::build(StatusCode::OK)
.content_type("audio/wav")
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
.set_header(header::CONTENT_RANGE, "bytes */*")
.set_header(header::CONTENT_RANGE, content_range_value)
.body(wav_data))
},
ModelPipeline::RawTextTacotronMelgan => unimplemented!(),
+4 -2
View File
@@ -107,10 +107,11 @@ pub async fn post_speak(request: HttpRequest,
Some(wav_data) => {
// To make iOS Safari work, you need a Content-Range and Content-Length header:
// https://stackoverflow.com/a/17835399
let content_range_value = format!("bytes 0-{}/{}", wav_data.len(), wav_data.len());
Ok(HttpResponse::build(StatusCode::OK)
.content_type("audio/wav")
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
.set_header(header::CONTENT_RANGE, "bytes */*")
.set_header(header::CONTENT_RANGE, content_range_value)
.body(wav_data))
},
}
@@ -140,10 +141,11 @@ pub async fn post_speak(request: HttpRequest,
// To make iOS Safari work, you need a Content-Range and Content-Length header:
// https://stackoverflow.com/a/17835399
let content_range_value = format!("bytes 0-{}/{}", wav_data.len(), wav_data.len());
Ok(HttpResponse::build(StatusCode::OK)
.content_type("audio/wav")
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
.set_header(header::CONTENT_RANGE, "bytes */*")
.set_header(header::CONTENT_RANGE, content_range_value)
.body(wav_data))
},
ModelPipeline::RawTextTacotronMelgan => unimplemented!(),