Skip to content

Instantly share code, notes, and snippets.

@abelmatser
abelmatser / a2dp-agent.py
Created May 19, 2021 15:12
a2dp-agent ported to python 3
#!/usr/bin/python3
import sys
import dbus
import dbus.service
import dbus.mainloop.glib
from gi.repository import GLib
AGENT_INTERFACE = "org.bluez.Agent1"
AGENT_PATH = "/test/agent"
@mill1000
mill1000 / README.md
Last active April 22, 2024 07:24
Headless A2DP Audio Streaming on Raspbian Stretch

About

This gist will show how to setup Raspbian Stretch as a headless Bluetooth A2DP audio sink. This will allow your phone, laptop or other Bluetooth device to play audio wirelessly through a Rasperry Pi.

Motivation

A quick search will turn up a plethora of tutorials on setting up A2DP on the Raspberry Pi. However, I felt this gist was necessary because this solution is:

  • Automatic & Headless - Once setup, the system is entirely automatic. No user iteration is required to pair, connect or start playback. Therefore the Raspberry Pi can be run headless.
  • Simple - This solution has few dependencies, readily available packages and minimal configuration.
  • Up to date - As of December 2017. Written for Raspbian Stretch & Bluez 5.43

Prerequisites