Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Using MediaElement in iOS causes crash #2420

Open
2 tasks done
homerokzam opened this issue Dec 29, 2024 · 0 comments
Open
2 tasks done

[BUG] Using MediaElement in iOS causes crash #2420

homerokzam opened this issue Dec 29, 2024 · 0 comments
Labels
bug Something isn't working unverified

Comments

@homerokzam
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When invoking _speechToText.StartListenAsync(CultureInfo.CurrentCulture, CancellationToken.None);, the application throws an Objective-C exception with the following details:

Objective-C exception thrown. Name: com.apple.coreaudio.avfaudio
Reason: required condition is false: IsFormatSampleRateAndChannelCountValid(format)

Error:
Objective-C exception thrown. Name: com.apple.coreaudio.avfaudio Reason: required condition is false: IsFormatSampleRateAndChannelCountValid(format)
Native stack trace:
0 CoreFoundation 0x00000001804b910c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x0000000180092da8 objc_exception_throw + 72
2 CoreFoundation 0x00000001804b901c -[NSException initWithCoder:] + 0
3 AVFAudio 0x00000001cd0b0f6c _ZN17AUGraphNodeBaseV318CreateRecordingTapEmjP13AVAudioFormatU13block_pointerFvP16AVAudioPCMBufferP11AVAudioTimeE + 748
4 AVFAudio 0x00000001cd14ba64 _ZN17AVAudioEngineImpl16InstallTapOnNodeEP11AVAudioNodemjP13AVAudioFormatU13block_pointerFvP16AVAudioPCMBufferP11AVAudioTimeE + 1120
5 AVFAudio 0x00000001cd12b220 -[AVAudioNode installTapOnBus:bufferSize:format:block:] + 560
6 libxamarin-dotnet-debug.dylib 0x00000001055bac3c xamarin_dyn_objc_msgSend + 160
7 KSpeackEnglish 0x00000001040b589c interp_to_native_trampoline + 172
8 libmonosgen-2.0.dylib 0x00000001059405a4 ves_pinvoke_method + 584
9 libmonosgen-2.0.dylib 0x0000000105934614 mono_interp_exec_method + 3072
10 libmonosgen-2.0.dylib 0x0000000105931f80 interp_runtime_invoke + 244
11 libmonosgen-2.0.dylib 0x00000001058451fc mono_jit_runtime_invoke + 1064
12 libmonosgen-2.0.dylib 0x0000000105a15700 mono_runtime_try_invoke + 156
13 libmonosgen-2.0.dylib 0x0000000105a18774 mono_runtime_invoke + 488
14 KSpeackEnglish 0x00000001040d77c4 _ZL30native_to_managed_trampoline_9P11objc_objectP13objc_selectorPP11_MonoMethodj + 316
15 KSpeackEnglish 0x00000001040d80e4 -[__MonoMac_NSAsyncSynchronizationContextDispatcher xamarinApplySelector] + 44
16 Foundation 0x0000000180f465ec __NSThreadPerformPerform + 124
17 CoreFoundation 0x000000018041d294 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24
18 CoreFoundation 0x000000018041d1dc __CFRunLoopDoSource0 + 172
19 CoreFoundation 0x000000018041c940 __CFRunLoopDoSources0 + 232
20 CoreFoundation 0x0000000180416e84 __CFRunLoopRun + 788
21 CoreFoundation 0x00000001804166f4 CFRunLoopRunSpecific + 552
22 GraphicsServices 0x00000001905e5b10 GSEventRunModal + 160
23 UIKitCore 0x0000000185b319dc -[UIApplication _run] + 796
24 UIKitCore 0x0000000185b35bd4 UIApplicationMain + 124
25 libxamarin-dotnet-debug.dylib 0x0000000105579288 xamarin_UIApplicationMain + 60
26 libmonosgen-2.0.dylib 0x0000000105941a0c do_icall + 316
27 libmonosgen-2.0.dylib 0x0000000105940208 do_icall_wrapper + 356
28 libmonosgen-2.0.dylib 0x000000010593445c mono_interp_exec_method + 2632
29 libmonosgen-2.0.dylib 0x0000000105931f80 interp_runtime_invoke + 244
30 libmonosgen-2.0.dylib 0x00000001058451fc mono_jit_runtime_invoke + 1064
31 libmonosgen-2.0.dylib 0x0000000105a146ec mono_runtime_invoke_checked + 148
32 libmonosgen-2.0.dylib 0x0000000105a1be88 mono_runtime_exec_main_checked + 116
33 libmonosgen-2.0.dylib 0x000000010589abf0 mono_jit_exec + 364
34 libxamarin-dotnet-debug.dylib 0x00000001055b9bac xamarin_main + 2312
35 KSpeackEnglish 0x0000000104182d50 main + 64
36 dyld 0x00000001050b1410 start_sim + 20
37 ??? 0x0000000104df2274 0x0 + 4376699508

Expected Behavior

The expected behavior is for _speechToText.StartListenAsync to initiate the speech recognition process without encountering exceptions, allowing the application to transcribe spoken words into text seamlessly.

Steps To Reproduce

  1. Implement the HandleOnClickedStartListening method as follows:
    private async void HandleOnClickedStartListening()
    {
    try
    {
    var isGranted = await _speechToText.RequestPermissions(CancellationToken.None);
    if (!isGranted)
    {
    await Toast.Make("Permission not granted").Show(CancellationToken.None);
    return;
    }

     _speechToText.RecognitionResultUpdated += OnRecognitionTextUpdated;
     _speechToText.RecognitionResultCompleted += OnRecognitionTextCompleted;
     await _speechToText.StartListenAsync(CultureInfo.CurrentCulture, CancellationToken.None);
    

    }
    catch (Exception ex)
    {
    Console.WriteLine(ex.Message);
    await Toast.Make(ex.Message).Show(CancellationToken.None);
    }
    }

  2. Execute the application on an iOS device or simulator.

  3. Trigger the HandleOnClickedStartListening method to start speech recognition.

  4. Observe the application throwing the aforementioned Objective-C exception.

Link to public reproduction project repository

https://github.com/homerokzam/SpeechToText

Environment

- .NET MAUI CommunityToolkit: 10.0.0
- OS: macOS Sequoia 15.2
- .NET MAUI: 9.0.21

Anything else?

No response

@homerokzam homerokzam added bug Something isn't working unverified labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working unverified
Projects
None yet
Development

No branches or pull requests

1 participant