-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AVFoundation] Obsolete AVSpeechSynthesizer.WriteUtteranceAsync. Fixes …
…#20338. (#20339) The callback may be called multiple times, which means the async version won't work correctly. So obsolete and hide the Async binding for now, and remove in XAMCORE_5_0. References: * https://discord.com/channels/732297728826277939/732297808148824115/1219903715939582022 * https://developer.apple.com/documentation/avfaudio/avspeechsynthesizer/3141659-writeutterance?language=objc Fixes #20338.
- Loading branch information
1 parent
b2e8969
commit 2f9fd8f
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.ComponentModel; | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Runtime.Versioning; | ||
using System.Threading.Tasks; | ||
|
||
using ObjCRuntime; | ||
|
||
#nullable enable | ||
|
||
namespace AVFoundation { | ||
|
||
public partial class AVSpeechSynthesizer { | ||
#if !XAMCORE_5_0 | ||
#if NET | ||
[SupportedOSPlatform ("tvos13.0")] | ||
[SupportedOSPlatform ("ios13.0")] | ||
[SupportedOSPlatform ("maccatalyst")] | ||
[SupportedOSPlatform ("macos")] | ||
#endif | ||
[BindingImpl (BindingImplOptions.Optimizable)] | ||
[Obsolete ("Do not use this API, it doesn't work correctly. Use the non-Async version (WriteUtterance) instead.")] | ||
[EditorBrowsable (EditorBrowsableState.Never)] | ||
public unsafe virtual Task<AVAudioBuffer> WriteUtteranceAsync (AVSpeechUtterance utterance) | ||
{ | ||
var tcs = new TaskCompletionSource<AVAudioBuffer> (); | ||
WriteUtterance (utterance, (obj_) => { | ||
tcs.SetResult (obj_!); | ||
}); | ||
return tcs.Task; | ||
} | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
Sorry, something went wrong.