Search code examples
iosvoiceovermpmediapickercontroller

MPMediaPickerController fails to announce controls with VoiceOver


I'm debugging an app that requires full accessibility using VoiceOver and one feature ask the user to select songs to play. The app uses MPMediaPicker. The problem is that MPMediaPicker does not really meet VoiceOver accessibility requirements, for example it does not announce whether an element of the list is selected or not, it does not clearly announce when the user select an element, when searching it does not announce the number of selected elements in the list as the list get pruned down and, worse of all cases, it does not announce anything at all when the button Add All Song is selected (it just stay silent).

It seems to me that these are pretty big oversights for a standard component so widely used and i'm wondering what can i do to fix these for my client as it explicitly says in the Apple documentation that i can't subclass MPMediaPickerController nor manipulate its private view hierarchy. Of concern is also the fact that the my app also uses the standard component to select contacts which also seems to have similar issues.

Thank you.

Edit: The app present the MPMediaPickerViewController using this code, which i believe it is fairly standard (perhaps a bit outdated since it still uses retain/releases)

MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];                  

[picker setDelegate: self];                                         
[picker setAllowsPickingMultipleItems: YES];                      
picker.prompt = NSLocalizedString (@"...", "...");

[[myAppDelegate instance] presentModalViewController: picker animated: YES];
[picker release];

where presentModalViewController is this:

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated {
    UIViewController *c = self.window.rootViewController;
    while ([c presentedViewController]) {
        c = [c presentedViewController];
    }
    [c presentModalViewController:modalViewController animated:animated];
}

The missing announcements in the voice over belong to components shown as part of the selection process and in the hierarchy of MPMediaPickerController, so i don't know how to access them. The above code is called inside the IBAction of a simple (+) right bar button of a ViewController that belongs to a NavigationController.

Further note: Minimal proof of concept: create a default single page iOS application in Xcode. Add @import MediaPlayer; and then add this code to the ViewController.

- (void)viewDidAppear:(BOOL)animated {
    MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];

    [picker setDelegate: self];
    [picker setAllowsPickingMultipleItems: YES];
    picker.prompt = NSLocalizedString (@"...", "...");

    [self presentViewController:picker animated:true completion:^{

    }];
}

Launch the app with VoiceOver activated, then select or navigate to the cell "Add All Song": the item is not announced by VoiceOver in any way.


Solution

  • I think this summarize things pretty well. From Apple Documentation in reference to the MPMediaPickerController:

    This is a preliminary document for an API or technology in development. Apple is supplying this information to help you plan for the adoption of the technologies and programming interfaces described herein for use on Apple-branded products. This information is subject to change, and software implemented according to this document should be tested with final operating system software and final documentation. Newer versions of this document may be provided with future betas of the API or technology.

    This control is not complete, and probably never will be complete, given that this has been considered a "beta" API since iOS 3.0.

    Also, to summarize my findings, it is not possible to make this control accessible. I was able to play around with its views a bit, and every time I was able to add additional labelling it was soon overridden and reset. Finding the correct callbacks to reset the labels every time they were overridden by the controls default behaviors would be difficult (impossible) and obviously we cannot override the UIAccessibilityProtocol methods of the individual elements, because they are not controls we instantiated. We have instantiated the global control, and it is drawing everything for us. Finally, this would be considered by a reviewer to be accessing private APIs and so would not be allowed on the App Store regardless.

    Conclusion: In order to provide the accessibility support you wish, you will have to implement a similar control manually.