mapbox / mapbox-speech-swift

Natural-sounding text-to-speech in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
ISC License
39 stars 17 forks source link

Read API base URL from Info.plist #14

Open 1ec5 opened 5 years ago

1ec5 commented 5 years ago

If no host is passed into SpeechSynthesizer(accessToken:host:), the fallback hostname should be either api.mapbox.com or api.mapbox.cn depending on the value of MGLMapboxAPIBaseURL in Info.plist:

https://github.com/mapbox/mapbox-speech-swift/blob/b0163852eb6e3efd36effc9893e1eab10932036a/MapboxSpeech/MapboxSpeech.swift#L96

This would be consistent with how we read the access token out of Info.plist:

https://github.com/mapbox/mapbox-speech-swift/blob/b0163852eb6e3efd36effc9893e1eab10932036a/MapboxSpeech/MapboxSpeech.swift#L89

This will make it easier for developers to keep their map, directions, and spoken instructions in sync, since SpeechSynthesizer.shared would automatically pick up the API endpoint specified in Info.plist. Developers who need a different value for the speech synthesizer can still override the API base URL when creating a separate SpeechSynthesizer instance.

/ref mapbox/MapboxGeocoder.swift#107 /cc @m-stephen @bsudekum

m-stephen commented 5 years ago

We do not have api voice now in China.

So the solution is now we choose a Chinese TTS service inside China and only make a subclass of RouteVoiceController to custom the voice controller. This swift file can be given to our customers to help them make a custom TTS voice controller quickly.

For further steps, we should setup api voice .cn and integrate Chinese TTS service inside China. So I think, this issue should be fixed after the api-voice China ready. @1ec5

/cc: @suntony @chriswu42