Commit 4ca5d838 authored by liujiaxin's avatar liujiaxin

feat: add audio record

parent ed92b4d3
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output, NgZone, OnChanges} from '@angular/core'; import {ApplicationRef, ChangeDetectorRef, Component, EventEmitter, Input, OnDestroy, OnInit, Output, NgZone, OnChanges} from '@angular/core';
import {NzMessageService, NzNotificationService, UploadFile} from 'ng-zorro-antd'; import {NzMessageService, NzNotificationService, UploadFile} from 'ng-zorro-antd';
import {HttpClient, HttpEvent, HttpEventType, HttpRequest} from '@angular/common/http'; import {HttpClient, HttpEvent, HttpEventType, HttpRequest} from '@angular/common/http';
import {environment} from '../../../environments/environment'; import {environment} from '../../../environments/environment';
...@@ -57,6 +57,8 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { ...@@ -57,6 +57,8 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
constructor( private nzMessageService: NzMessageService, constructor( private nzMessageService: NzMessageService,
private zone: NgZone, private zone: NgZone,
private nzNotificationService: NzNotificationService, private nzNotificationService: NzNotificationService,
private appRef: ApplicationRef,
private changeDetectorRef: ChangeDetectorRef,
private httpClient: HttpClient) { private httpClient: HttpClient) {
this.uploadUrl = (<any> window).courseware.uploadUrl(); this.uploadUrl = (<any> window).courseware.uploadUrl();
this.uploadData = (<any> window).courseware.uploadData(); this.uploadData = (<any> window).courseware.uploadData();
...@@ -214,6 +216,14 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy { ...@@ -214,6 +216,14 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
} else { } else {
this.type = Type.RECORD; this.type = Type.RECORD;
} }
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}
refresh() {
setTimeout(() => {
this.appRef.tick();
}, 1);
} }
onBtnClearAudio() { onBtnClearAudio() {
this.audioUrl = null; this.audioUrl = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment