File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,10 +21,10 @@ function getContentType(file) {
2121}
2222
2323function FilePlayer ( file , contentType ) {
24- var output = new Audio ( ) ;
25- if ( output . canPlayType ( contentType ) ) {
26- output . src = URL . createObjectURL ( new Blob ( [ file ] , { type : contentType } ) ) ;
27- output . play ( ) ;
24+ var audio = this . audio = new Audio ( ) ;
25+ if ( audio . canPlayType ( contentType ) ) {
26+ audio . src = URL . createObjectURL ( new Blob ( [ file ] , { type : contentType } ) ) ;
27+ audio . play ( ) ;
2828 } else {
2929 // if we emit an error, it prevents the promise from returning the actual result
3030 // however, most browsers do not support flac, so this is a reasonably scenario
@@ -34,8 +34,8 @@ function FilePlayer(file, contentType) {
3434 throw err ;
3535 }
3636 this . stop = function stop ( ) {
37- output . pause ( ) ;
38- output . currentTime = 0 ;
37+ audio . pause ( ) ;
38+ audio . currentTime = 0 ;
3939 }
4040}
4141
You can’t perform that action at this time.
0 commit comments