AVPlayer Visual Accessibility Issues

AVPlayer has 3 visual accessibility issues with videos out of the box:

  1. The contrast fails for the current time in the video
  2. The contrast fails for the remaining time in the video
  3. The hit area is too small for the time slider. The WCAG AA requirement is a minimum hit size of 24 x 24. The height of the hit area of the offending region is 8.

Is there a known fix for any of these?

This can be reproduced with this code in an app playground:

import SwiftUI
import AVKit
import UIKit
struct ContentView: View {
private let video = URL(string: "https://server15700.contentdm.oclc.org/dmwebservices/index.php?q=dmGetStreamingFile/p15700coll2/15.mp4/byte/json")!
@State private var player: AVPlayer?
var body: some View {
VStack {
VideoPlayerView(player: player)
.frame(maxWidth: .infinity, maxHeight: 200)
}
.task {
player = try? await loadPlayer(video: video)
}
}
}
private struct VideoPlayerView: UIViewControllerRepresentable {
let player: AVPlayer?
func makeUIViewController(context: Context) -> AVPlayerViewController {
let controller = AVPlayerViewController()
controller.player = player
controller.modalPresentationStyle = .overFullScreen
return controller
}
func updateUIViewController(_ uiViewController: AVPlayerViewController, context: Context) {
uiViewController.player = player
}
}
private func loadPlayer(video: URL) async throws -> AVPlayer {
let videoAsset = AVURLAsset(url: video)
let videoPlusSubtitles = AVMutableComposition()
try await videoPlusSubtitles.add(videoAsset, withMediaType: .video)
try await videoPlusSubtitles.add(videoAsset, withMediaType: .audio)
return await AVPlayer(playerItem: AVPlayerItem(asset: videoPlusSubtitles))
}
private extension AVMutableComposition {
func add(_ asset: AVAsset, withMediaType mediaType: AVMediaType) async throws {
let duration = try await asset.load(.duration)
try await asset.loadTracks(withMediaType: mediaType).first.map { track in
let newTrack = self.addMutableTrack(withMediaType: mediaType, preferredTrackID: kCMPersistentTrackID_Invalid)
let range = CMTimeRangeMake(start: .zero, duration: duration)
try newTrack?.insertTimeRange(range, of: track, at: .zero)
}
}
}
Answered by Engineer in 836278022

Hello, thank you for highlighting these issues! It would help us greatly if you could file a Feedback Assistant report and attach this sample code. This will allow us to track this issue and report back once it's fixed! Thanks again.

Accepted Answer

Hello, thank you for highlighting these issues! It would help us greatly if you could file a Feedback Assistant report and attach this sample code. This will allow us to track this issue and report back once it's fixed! Thanks again.

@Engineer Done. FB17348173 (iOS AVPlayer fails accessibility inspector audit out-of-the-box)

AVPlayer Visual Accessibility Issues
 
 
Q