Skip to content

Commit

Permalink
fix(SpeechToTextV1): Update recognizeMicrophone() to work with any au…
Browse files Browse the repository at this point in the history
…thentication method

This method previously only worked when SpeechToText was instantiated with basic authentication
  • Loading branch information
Anthony Oliveri committed Nov 13, 2018
1 parent 282a908 commit 5701ba6
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions Source/SpeechToTextV1/SpeechToText+Recognize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,9 @@ extension SpeechToText {
var settings = settings
settings.contentType = compress ? "audio/ogg;codecs=opus" : "audio/l16;rate=16000;channels=1"

// extract authMethod
guard let basicAuth = authMethod as? BasicAuthentication else {
let failureReason = "Invalid authenticaion method format."
let userInfo = [NSLocalizedDescriptionKey: failureReason]
let error = NSError(domain: domain, code: 0, userInfo: userInfo)
failure?(error)
return
}

// create session
// create SpeechToTextSession
let session = SpeechToTextSession(
username: basicAuth.username,
password: basicAuth.password,
authMethod: authMethod,
model: model,
customizationID: customizationID,
acousticCustomizationID: acousticCustomizationID,
Expand Down

0 comments on commit 5701ba6

Please sign in to comment.