Skip to main content

Introduction

Documentation Status Discord Build Status Code Style: Ruff

Support for the Apple Media Service which provides media playback info and control.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install adafruit-circuitpython-ble-apple-media

To install system-wide (this may be required in some cases):

sudo pip3 install adafruit-circuitpython-ble-apple-media

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .venv
source .venv/bin/activate
pip3 install adafruit-circuitpython-ble-apple-media

Usage Example

import adafruit_ble
from adafruit_ble.advertising.standard import SolicitServicesAdvertisement
from adafruit_ble_apple_media import AppleMediaService

radio = adafruit_ble.BLERadio()
a = SolicitServicesAdvertisement()
a.solicited_services.append(AppleMediaService)
radio.start_advertising(a)

while not radio.connected:
    pass

print("connected")

known_notifications = set()

i = 0
while radio.connected:
    for connection in radio.connections:
        if not connection.paired:
            connection.pair()
            print("paired")

        ams = connection[AppleMediaService]
        print("App:", ams.player_name)
        print("Title:", ams.title)
        print("Album:", ams.album)
        print("Artist:", ams.artist)
        if ams.playing:
            print("Playing")
        elif ams.paused:
            print("Paused")

        if i > 3:
            ams.toggle_play_pause()
            i = 0
    print()
    time.sleep(3)
    i += 1

print("disconnected")

Documentation

API documentation for this library can be found on Read the Docs.

For information on building library documentation, please check out this guide.

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Metadata

Release files for adafruit-circuitpython-ble-apple-media 0.9.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adafruit-circuitpython-ble-apple-media 0.9.23
File Size Uploaded Provenance
adafruit_circuitpython_ble_apple_media-0.9.23.tar.gz 24.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for adafruit-circuitpython-ble-apple-media 0.9.23
File Interpreter ABI Platform
adafruit_circuitpython_ble_apple_media-0.9.23-py3-none-any.whl Python 3 none any Details

Total release size: 31.6 kB

Release files / adafruit_circuitpython_ble_apple_media-0.9.23.tar.gz

Download URL adafruit_circuitpython_ble_apple_media-0.9.23.tar.gz
Size 24.8 kB
Tags Source
SHA-256 checksum
How to use checksums
05f1abf0e5129211383866e36348455476d601cad90b0fe9e9e293059a0231fe
BLAKE2b-256 checksum
How to use checksums
2a5bd138c31cc83f60f94b5a243570e652a8d968031a51666ce40ebed05f19e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / adafruit_circuitpython_ble_apple_media-0.9.23-py3-none-any.whl

Download URL adafruit_circuitpython_ble_apple_media-0.9.23-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94df5e989743ba25f5d7fb5687c33c9a0aa725444cc607e52d28371511efc813
BLAKE2b-256 checksum
How to use checksums
0cfd98da41f66d389c336189dfc8a5d6a54641b861dce5cbf20a77147691abc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for adafruit-circuitpython-ble-apple-media 0.9.23

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page