Skip to content

Commit 7dbf35c

Browse files
committed
Added audio
1 parent ea8e8b2 commit 7dbf35c

File tree

10 files changed

+16
-20
lines changed

10 files changed

+16
-20
lines changed

eFormAPI/eFormAPI/Controllers/AudioController.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,24 @@ namespace eFormAPI.Web.Controllers
1111
public class AudioController : ApiController
1212
{
1313
[HttpGet]
14-
[Route("api/audio/eform-audio/{fileName}.{ext}")]
15-
public HttpResponseMessage GetAudio(string fileName, string ext)
14+
[Route("api/audio/eform-audio")]
15+
public HttpResponseMessage GetAudio(string fileName)
1616
{
17-
var filePath = HttpContext.Current.Server.MapPath($"~/output/datafolder/picture/{fileName}.{ext}");
17+
var filePath = HttpContext.Current.Server.MapPath($"~/output/datafolder/picture/{fileName}");
1818
if (!File.Exists(filePath))
1919
{
2020
return new HttpResponseMessage(HttpStatusCode.NotFound);
2121
}
22-
const string mime = "vnd.wave";
23-
var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
24-
var result = new HttpResponseMessage(HttpStatusCode.OK)
25-
{
26-
Content = new StreamContent(fileStream)
27-
};
28-
result.Content.Headers.ContentDisposition =
29-
new ContentDispositionHeaderValue("attachment") {FileName = fileName};
22+
23+
HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
24+
var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
25+
result.Content = new StreamContent(stream);
3026
result.Content.Headers.ContentType =
31-
new MediaTypeHeaderValue($"audio/{mime}");
27+
new MediaTypeHeaderValue("audio/wav");
28+
result.Content.Headers.ContentLength = stream.Length;
29+
result.Content.Headers.ContentRange = new ContentRangeHeaderValue(0, stream.Length);
3230
return result;
31+
3332
}
3433
}
3534
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

eform-client/src/app/components/navigation/navigation.component.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ export class NavigationComponent implements OnInit {
2222
}
2323

2424
ngOnInit() {
25-
debugger;
2625
if (this.authService.isAuth) {
2726
this.adminService.getCurrentUserInfo().subscribe((result) => {
2827
this.userInfo = result;
29-
debugger;
3028
this.userSettingsService.getUserSettings().subscribe(((data) => {
3129
localStorage.setItem('locale', data.model.locale);
32-
debugger;
3330
this.initLocaleAsync().then(() => {
3431
this.initNavigationMenu();
3532
});
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
<audio controls>
2-
<source src="" type="audio/ogg">
1+
<audio controls preload="auto" src="/api/audio/eform-audio?fileName={{fieldValueObj.uploadedDataObj.fileName}}">
2+
This text displays if the audio tag isn't supported.
33
</audio>
4-
<textarea class="form-control"
5-
name="value"></textarea>
4+
<trumbowyg-editor [(content)]="fieldValueObj.value"></trumbowyg-editor>
65

eform-client/src/app/modules/cases/components/case-elements/element-audio/element-audio.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Input, OnInit} from '@angular/core';
1+
import {Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, ViewChild} from '@angular/core';
22
import {CaseFieldValue} from 'app/models';
33

44
@Component({

eform-client/src/assets/svg/icons.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)