Skip to content

Commit 6d72409

Browse files
Element with audio interface
1 parent c299c9b commit 6d72409

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

source/src/app/menu/menu.page.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { VerbsStateService } from '../../core/state/verbs.state';
1616
import { EditObjectComponent } from './components/edit-object/edit-object.component';
1717
import { EditVerbComponent } from './components/edit-verb/edit-verb.component';
1818
import { version } from '../../../package.json';
19+
import { ElementWithAudio } from 'src/core/models/element-with-audio.interface';
1920
@Component({
2021
selector: 'gueo-menu',
2122
templateUrl: './menu.page.html',
@@ -61,7 +62,7 @@ export class MenuPage implements OnInit, OnDestroy {
6162
this.itemsStateService.remove(item);
6263
}
6364

64-
reproduceSound(item: ItemWithFilesModel | VerbWithFilesModel): void {
65+
reproduceSound(item: ElementWithAudio): void {
6566
this.audioService.reproduceSound(item);
6667
}
6768

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { FileData } from './file-data.model';
2+
3+
export interface ElementWithAudio {
4+
text: string;
5+
audio: FileData<any>;
6+
}

source/src/core/services/audio.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { RecordingData, VoiceRecorder } from 'capacitor-voice-recorder';
33
import { BehaviorSubject, Observable } from 'rxjs';
4+
import { ElementWithAudio } from '../models/element-with-audio.interface';
45
import { FileData } from '../models/file-data.model';
56
import { ItemWithFilesModel } from '../models/item-with-files.model';
67
import { VerbWithFilesModel } from '../models/verb-with-files.model';
@@ -70,7 +71,7 @@ export class AudioService {
7071
return this.playAudio(audioRef);
7172
}
7273

73-
reproduceSound(item: ItemWithFilesModel | VerbWithFilesModel) {
74+
reproduceSound(item: ElementWithAudio) {
7475
this.stopAudio();
7576
if (item.audio) {
7677
this.playAudioFile(item.audio);

0 commit comments

Comments
 (0)