# HG changeset patch # User Lucas Thompson # Date 1490101259 0 # Node ID fd3f25a41ecfa7710a609e393cb8c224cb655a4e # Parent f9624c7f2265bd23ed39aaf9b49a2fee58084da0 Notify subscribers of new recordings within the Angular Zone. diff -r f9624c7f2265 -r fd3f25a41ecf src/app/services/audio-recorder/audio-recorder.service.ts --- 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:00:59 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(); @@ -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");