Mercurial > hg > ugly-duckling
changeset 146:333fb7861976
Merge pull request #13 from LucasThompson/fix/recording-open-change-detection
Notify subscribers of new recordings within the Angular Zone.
author | Lucas Thompson <LucasThompson@users.noreply.github.com> |
---|---|
date | Tue, 21 Mar 2017 13:01:53 +0000 |
parents | f9624c7f2265 (current diff) fd3f25a41ecf (diff) |
children | 9cf2bd2db4cd |
files | |
diffstat | 1 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/app/services/audio-recorder/audio-recorder.service.ts Tue Mar 21 11:11:23 2017 +0000 +++ b/src/app/services/audio-recorder/audio-recorder.service.ts Tue Mar 21 13:01:53 2017 +0000 @@ -1,7 +1,7 @@ /** * Created by lucas on 17/03/2017. */ -import {Injectable, Inject} from "@angular/core"; +import {Injectable, Inject, NgZone} from "@angular/core"; import {Subject, Observable} from "rxjs"; @@ -112,7 +112,8 @@ constructor(@Inject('AudioInputProvider') requestProvider: AudioInputProvider, @Inject( 'MediaRecorderFactory' - ) recorderImpl: MediaRecorderConstructor) { + ) recorderImpl: MediaRecorderConstructor, + private ngZone: NgZone) { this.requestProvider = requestProvider; this.recorderImpl = recorderImpl; this.recordingStateChange = new Subject<RecorderServiceStatus>(); @@ -134,9 +135,11 @@ this.recorder.onstop = () => { const blob = new Blob(this.chunks, { 'type': this.recorder.mimeType }); this.chunks.length = 0; - this.newRecording.next( - blob - ); + this.ngZone.run(() => { + this.newRecording.next( + blob + ); + }); }; this.isRecordingAble = true; this.recordingStateChange.next("enabled");