How to play a Voiceover notification when signal lost (i.e., no user interaction)?

By Mane, 27 February, 2018

Forum
App Development and Programming

I've built a simple audio streaming app. When I lose the audio stream connection, my app overlays a grayed screen on top of the UI.

I want to make the app accessible to folks who are blind or have low vision, so I want Voiceover to speak "Signal lost" and "Reconnecting" when the signal is lost and that overlay screen appears. This all has to happen without any user interaction (akin to what happens when the screen times out, and VO says, 'screen dimmed'). It would be nice for VO to speak, "Signal regained" upon reconnection, too, but not absolutely necessary.

To make it even more tricky, when the 'signal lost' screen is up, the user should *not* be able to manipulate any of the other fields in the main UI below.

How do I accomplish this?

Thanks in advance for all your help!

Options

Comments

By Mane on Friday, March 23, 2018 - 05:43

In reply to by Weather Gods (Scott)

Thanks, Scott! the notification works great.

Re: hiding the accessibility elements, I set accessibilityElementsHidden=true in my TableView when the overlay is displayed, but I'm still able to swipe among those elements in the main UI underneath the overlay. I suspect the overlay subview is not the focused view. How do I programmatically shift focus to the overlay?

By Weather Gods (Scott) on Friday, March 23, 2018 - 05:43

Yes, you will get this problem with an overlay. Try setting the view beneath to hidden from accessibility. That way it should hide all the child accessibility elements as well. I tend to have a single function that will hide or show everything in the view - just pass a boolean 'isHidden' and call accessibilityElementsHidden=isHidden

I get the same problem with my app from time to time, even after I've hidden everything, they sometimes still show through.

By Mane on Friday, March 23, 2018 - 05:43

In reply to by Weather Gods (Scott)

I was able to achieve the desired behavior by BOTH:
- setting accessibilityElementsHidden to TRUE within the main UIView, and
- notifying the app that the screen has changed by calling UIAccessibilityPostNotification with the UIAccessibilityScreenChangedNotification notification.
Now when my overlay appears, I hear a 'bloop' telling me the focus has changed, and none of the accessible elements from the main UIView show through