Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9541cdc

Browse files
committedApr 19, 2017
Fix for downloading MP4 files. Issue #1945.
1 parent 23a891e commit 9541cdc

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/RecordingsEndpoint.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,22 @@ protected Response getRecordingFile (String accountSid, String sid) {
293293
if (!path.endsWith("/")) {
294294
path += "/";
295295
}
296-
path += sid.toString() + ".wav";
296+
String fileExtension = ".wav";
297+
if (recording.getFileUri() != null) {
298+
fileExtension = recording.getFileUri().toString().endsWith("wav") ? ".wav" : ".mp4";
299+
}
300+
path += sid.toString() + fileExtension;
297301

298302
File recordingFile = new File(URI.create(path));
299303
if (recordingFile.exists()) {
300304
//Fetch recording and serve it from here
301-
return ok(recordingFile, "audio/x-wav").build();
305+
String contentType;
306+
if (fileExtension.equals(".wav")) {
307+
contentType = "audio/x-wav";
308+
} else {
309+
contentType = "video/mp4";
310+
}
311+
return ok(recordingFile, contentType).build();
302312
} else {
303313
return status(NOT_FOUND).build();
304314
}

0 commit comments

Comments
 (0)
Please sign in to comment.