PyObjC: AVRouting Framework

12.1 · active · verified Tue Apr 14

PyObjC is a bridge between Python and Objective-C, enabling Python developers to write full-featured macOS applications and access Cocoa frameworks. The `pyobjc-framework-avrouting` package provides Python wrappers for Apple's `AVRouting` framework, which allows applications to integrate third-party devices and protocols into the system's media route picker. It is actively maintained with releases frequently aligned with new macOS SDK versions, and the current version is 12.1.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `AVRouting` framework and instantiate a basic class like `AVCustomRoutingController`. Full functionality of the `AVRouting` framework typically requires integration with other macOS services, UI elements like `AVRoutePickerView`, and the implementation of delegate protocols as detailed in Apple's `AVRouting` documentation.

import AVRouting
import objc

def main():
    # Instantiate a core AVRouting class. AVCustomRoutingController manages custom device routes.
    # Actual functionality requires deeper integration with macOS services and delegates, 
    # typically within a full Cocoa application context, as per Apple's AVRouting documentation.
    controller = AVRouting.AVCustomRoutingController.alloc().init()
    
    # Example of accessing a property (if available, consult Apple's docs for specifics)
    # This particular property needs a delegate or further setup to be meaningful.
    # For demonstration, we just show instantiation.
    print(f"AVRouting.AVCustomRoutingController instance created: {controller}")

    # To make sure PyObjC is properly initialized in a non-GUI context
    # This is often handled implicitly in Cocoa applications, but good for standalone scripts.
    objc.autoreleasepool(lambda: main_logic())

def main_logic():
    # Your main PyObjC logic goes here
    pass # The example already does the print in the outer main

if __name__ == '__main__':
    main()

view raw JSON →