Skip to content

Commit

Permalink
Merge pull request #16 from wlor0623/master
Browse files Browse the repository at this point in the history
修复ios端navigator.getUserMedia方法调用失败的问题 #15
  • Loading branch information
ferrinweb authored Jul 23, 2020
2 parents 137a673 + be8c9fc commit d1c1973
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/lib/recorder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class IatRecorder {
this.appId = config.appId
this.apiKey = config.apiKey
this.apiSecret = config.apiSecret
this.isAudioAvailable = !!(navigator.getUserMedia && AudioContext && recorderWorker)
this.isAudioAvailable = !!((navigator.getUserMedia||navigator.mediaDevices.getUserMedia) && AudioContext && recorderWorker)
this.pd = config.pd
this.rlang = config.rlang
this.ptt = config.ptt
Expand Down Expand Up @@ -131,6 +131,19 @@ class IatRecorder {
}
this.connectWebsocket()
}
} else if (navigator.mediaDevices.getUserMedia && AudioContext) {
this.state = 'init'
if (!this.recorder) {
setTimeout(() => {
this.initRecorder()
}, 100)
} else {
if (this.state === 'end') {
this.closeTrack()
return
}
this.connectWebsocket()
}
} else {
alert(locales[this.language].not_supported)
}
Expand Down

0 comments on commit d1c1973

Please sign in to comment.