PyObjC Framework MediaAccessibility

12.1 · active · verified Tue Apr 14

pyobjc-framework-mediaaccessibility provides Python bindings for Apple's MediaAccessibility framework on macOS. It allows Python developers to interact with system-wide media accessibility settings, such as closed captions and audio descriptions. The library is part of the larger PyObjC project, which regularly releases updates, typically aligning with new macOS SDKs and Python versions. The current version is 12.1.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the MediaAccessibility framework and retrieve the currently selected caption language for the user domain using a standard C function binding.

import MediaAccessibility

# Get the currently selected caption language for the user domain
selected_language = MediaAccessibility.MACaptionAppearanceCopySelectedLanguage(
    MediaAccessibility.kMACaptionAppearanceDomainUser
)

if selected_language:
    print(f"Selected caption language (user domain): {selected_language}")
else:
    print("No selected caption language found for the user domain.")

# Note: MACaptionAppearanceCopySelectedLanguage returns a CFStringRef, which PyObjC
# automatically bridges to a Python string. Memory management (release) is typically
# handled by PyObjC for bridged objects.

view raw JSON →