 Control your phone/emulator's media playback from your notification panel through MPRIS.
Control your phone/emulator's media playback from your notification panel through MPRIS.
This script works independently from scrcpy and does not require it to be installed or running for use.
Take note that this "simple" script only works on GNU/Linux with MPRIS and only controls media playback.
It does not forward audio. Use scrcpy or sndcpy to do that.
Credits: Default album art icon (icon.png) from scrcpy repository.
Tested on Ubnutu Mantic 23.10 running Hyprland with swaync.
Clone this repo, install Python3.12 and create a virtual environment
git clone https://github.com/AzlanCoding/scrcpyMediaController
sudo apt install python3.12 python3.12-venv python3.12-dev libgirepository1.0-dev libcairo2-dev
cd scrcpyMediaController
python3.12 -m venv virtualEnv
source ./virtualEnv/bin/activate
pip install mpris_server
exitOnce done can remove build packages:
sudo apt remove python3.12-dev libgirepository1.0-dev libcairo2-dev
sudo apt autoremoveConnect your device to your laptop via adb and run the command below.
./start_scrcpyMediaController.shAlternatively, you can manually activate the environment and run main.py using the following commands:
cd scrcpyMediaPlayer
source ./virtualEnv/bin/activate
python main.pynohup ./start_scrcpyMediaController.sh 0 &DO NOT RUN ./start_scrcpyMediaController.sh & disown. Process will hang when print() or any standard output is called in the program.
use Btop++ or something to send signal 15 (SIGTERM) and terminate the process with the program named python. Don't use SIGKILL!!!
In main.py you can change the 3 variables in lines 10-12
artUrl = "file://"+os.path.join(os.path.dirname(__file__), 'icon.png')
playerName = "scrcpy"
updateFreq = 1artUrl holds the location of the album art icon (player icon).
playerName defines the name of the player.
updateFreq specifies how frequent the player checks for updates in seconds.
- Convert the variables above to flags you can pass
- Windows support using winrt.windows.media.control.GlobalSystemMediaTransportControlsSessionManageras suggested by Bing Chat
- First Release