Comments (2)
This is going to be a bit difficult because a media player exposes the interface on the session bus and there can be zero or many session buses running on your system. The library will read DBUS_SESSION_BUS_ADDRESS
env variable to specify which one (which is usually set by a session manager). You might want to look into using a dbus-activatable service which I use for playerctld
on the Playerctl project.
from node-dbus-next.
@acrisci Thank you. I was already researching in this direction and it seems that I have a working setup… or at least a partially working solution.
I guess there might be more people who might be interested in this solution, so I try to be as explicit as possible.
I created a dbus service
# /usr/share/dbus-1/services/org.mpris.MediaPlayer2.vlc.service
[D-BUS Service]
Name=org.mpris.MediaPlayer2.vlc
Exec=/bin/false
SystemdService=vlc.service
with a corresponding systemd service
# /etc/systemd/user/vlc.service
Description=VLC media player
[Service]
Type=dbus
BusName=org.mpris.MediaPlayer2.vlc
Environment="DISPLAY=:0"
ExecStart=/usr/bin/vlc --video-on-top --fullscreen --no-video-title-show --no-osd --no-spu --start-paused
When I send a dbus message from command line it all works as expected and vlc is launched.
Next I created a systemd user service for my application
[Unit]
Description=Demo MediaPlayer
After=dbus.service
[Service]
ExecStart=/usr/bin/node demo.mjs
WorkingDirectory=/home/pi/demo-media-player
StandardOutput=inherit
StandardError=inherit
Restart=always
Environment="DISPLAY=:0"
[Install]
WantedBy=default.target
I made sure that user services get loaded during boot via loginctl enable-linger $USER
. And when I enable it and reboot, the app starts as expected. BUT for some reason, it now hangs indefinitely when getting the proxy object. In my code this line hangs
let dbus = await bus.getProxyObject(
"org.mpris.MediaPlayer2.vlc",
"/org/mpris/MediaPlayer2"
);
When I restart the service via systemctl --user restart demo.service
it works immediately. It just hangs after rebooting the system. I also checked and the VLC service is running as expected.
Any idea what might cause it?
from node-dbus-next.
Related Issues (20)
- support TypeScript decorators HOT 2
- Logging errors from event handlers HOT 2
- ProxyObject or Interface went away event missing
- automatic (de)serialization to Variant dicts
- Unable to serialize a{sa{sv}} HOT 2
- no response frpm method
- New release
- Notification example?
- Multiple D-Bus errors occur (application runs fine, however) HOT 1
- Bug: Nodes not added to ProxyObject with root path ("/")
- Vulnerability in `[email protected]` dependency HOT 2
- DBUS_COOKIE_SHA1 auth does not work at all
- Project seems dead HOT 1
- Add access to message in method handler HOT 1
- Issue when trying to fetch mpris tracks metadata HOT 1
- Initial signals lost when no previous method call have been made
- Can't bundle it because of `usocket` library HOT 2
- Subscribe to `NameOwnerChanged` by default HOT 3
- Consider using ECMAScript modules? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-dbus-next.