PyObjC AudioVideoBridging Framework
PyObjC-framework-AudioVideoBridging provides Python wrappers for Apple's AudioVideoBridging framework on macOS, enabling Python applications to interact with AVB-capable hardware and software. It is part of the larger PyObjC bridge, which allows full-featured Cocoa applications to be written in pure Python. The library actively maintains compatibility with the latest macOS SDKs and Python versions, typically releasing updates in sync with new macOS releases.
Warnings
- breaking PyObjC 12.0 dropped support for Python 3.9, and PyObjC 11.0 dropped support for Python 3.8. Users on these Python versions must use older PyObjC releases.
- breaking PyObjC 11.1 introduced a significant change in how initializer methods (methods in the 'init' family) are modeled, aligning with `clang`'s Automatic Reference Counting documentation. These methods now correctly 'steal' a reference to `self` and return a new one. This can lead to unexpected reference counting behavior if existing code relied on the previous modeling.
- breaking PyObjC 10.3 temporarily broke support for `__init__` methods in Python subclasses when a user also provided a custom `__new__` method. While fixed in 10.3.1, this was a breaking change for affected patterns.
- deprecated The `IMServicePlugIn` framework bindings were removed in PyObjC 10.0, as the framework itself was deprecated in macOS 10.13 and removed in macOS 14.
- gotcha Using weak references from Objective-C to plain Python objects can cause hard crashes rather than Python exceptions, as the Objective-C proxy object might be deallocated while the Python object is still alive.
- gotcha As of PyObjC 12.1, Key-Value Observing (KVO) usage is automatically disabled for subclasses of `NSProxy` defined in Python to prevent `SystemError` issues.
Install
-
pip install pyobjc-framework-audiovideobridging
Imports
- AudioVideoBridging
import AudioVideoBridging
Quickstart
import AudioVideoBridging
import Foundation # Often needed for basic Cocoa types
try:
# Access the shared manager instance for the AudioVideoBridging framework
# This is a common pattern in Cocoa frameworks.
manager = AudioVideoBridging.AVBManager.sharedManager()
print(f"Successfully accessed AVBManager: {manager}")
# For actual functionality, refer to Apple's AudioVideoBridging documentation.
# Example (conceptual, requires deeper understanding of AVB framework):
# interfaces = manager.availableInterfaces()
# if interfaces:
# print("Available AVB Interfaces:")
# for interface in interfaces:
# print(f" - Name: {interface.name()}, Entity ID: {interface.entityID()}")
# else:
# print("No AVB interfaces found.")
except Exception as e:
print(f"Error accessing AudioVideoBridging framework: {e}")