Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
ww_spelling
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
ww_spelling
Commits
421d5468
Commit
421d5468
authored
Aug 26, 2020
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add audio record
parent
4ca5d838
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
audio-recorder.component.ts
src/app/common/audio-recorder/audio-recorder.component.ts
+24
-0
No files found.
src/app/common/audio-recorder/audio-recorder.component.ts
View file @
421d5468
...
...
@@ -184,6 +184,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
case
HttpEventType
.
UploadProgress
:
this
.
zone
.
run
(()
=>
{
this
.
progress
=
Math
.
floor
(
100
*
event
.
loaded
/
event
.
total
);
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
});
break
;
case
HttpEventType
.
Response
:
...
...
@@ -191,6 +194,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
console
.
log
(
event
);
this
.
audioUploaded
.
emit
(
event
.
body
);
this
.
isUploading
=
false
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
});
break
;
}
...
...
@@ -228,11 +234,17 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
onBtnClearAudio
()
{
this
.
audioUrl
=
null
;
this
.
audioRemoved
.
emit
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
onBtnDeleteAudio
()
{
this
.
audioUrl
=
null
;
this
.
audioRemoved
.
emit
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
handleChange
(
info
:
{
type
:
string
,
file
:
UploadFile
,
event
:
any
}):
void
{
...
...
@@ -250,6 +262,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this
.
progress
=
parseInt
(
info
.
event
.
percent
,
10
);
break
;
}
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
checkSelectFile
(
file
:
any
)
{
if
(
!
file
)
{
...
...
@@ -281,6 +296,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this
.
nzMessageService
.
info
(
'
Upload Success
'
);
this
.
isUploading
=
false
;
this
.
audioUrl
=
url
;
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
uploadFailure
=
(
err
,
file
)
=>
{
this
.
isUploading
=
false
;
...
...
@@ -290,6 +308,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
console
.
log
(
err
);
this
.
nzMessageService
.
error
(
'
Upload Error
'
+
err
.
message
);
this
.
audioUploadFailure
.
emit
(
file
);
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
doProgress
=
(
p
)
=>
{
if
(
p
>
1
)
{
...
...
@@ -300,6 +321,9 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
}
// console.log(Math.floor(p * 100));
this
.
progress
=
Math
.
floor
(
p
*
100
);
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment