Comments (17)
I'll work on it this week, thanks for pointing it out!
from souvlaki.
To give an update on this. I've been working on a refactor of the library which will bring in a bunch of fixes as well as add missing features such as this one. Volume is already working on my machine.
from souvlaki.
Got something working. Check out the volume
branch. Can you test it out with your program and check if everything works?
from souvlaki.
Also, something I fear with this update is that MediaControlEvent
is no longer Eq
, maybe that will introduce a breaking change somewhere? I don't know, what do you think?
from souvlaki.
Eq
? What?
what do you think?
Idk either, I have no clue about the MPRIS specification.
Also thanks! How can I test it with my program though? What can I change in the Cargo.toml files?
from souvlaki.
Eq? What?
The MediaControlEvent
enum previously implemented the Eq trait. Since now there is an float inside it, it can no longer implement Eq. I just wonder if any programs using this library will be affected by that, but I don't think it's a big deal.
What can I change in the Cargo.toml files?
Change your current line importing souvlaki to this:
souvlaki = { git = "https://github.com/Sinono3/souvlaki", branch = "volume" }
Then of course, implement the handling of the "SetVolume" event and also use the set_volume
method whenever the volume is changed internally, to maintain consistency.
from souvlaki.
I would like to use volume control on MacOS too, does it already support it?
https://stackoverflow.com/questions/11045814/emulate-media-key-press-on-mac
from souvlaki.
It was only implemented on Linux. I can't implement it for MacOS since I don't have access to an Apple device 😢
But this reminds me that the volume
branch was never merged. @apprehensions, did you get around to using it? Did you find the behavior of volume control to be stable?
from souvlaki.
from souvlaki.
Any updates, will it be released to main branch?
from souvlaki.
I can't really test volume
change on Linux because I don't have a Linux device
from souvlaki.
Great! Thanks @Sinono3. Look forward to the new changes
from souvlaki.
@apprehensions in case you want to test volume control with spotify_player
, you can checkout https://github.com/aome510/spotify-player/tree/test-volume
diff --git a/Cargo.lock b/Cargo.lock
index 54b9060..23a78d9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4106,9 +4106,8 @@ dependencies = [
[[package]]
name = "souvlaki"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "951a075f224d8c87bb62a08c9c27a373fd6d453407e89cae00a25e2eac74ef51"
+version = "0.6.0"
+source = "git+https://github.com/Sinono3/souvlaki?branch=volume#0f8e6740b262958408ddc901220c4613b3f517ca"
dependencies = [
"block",
"cocoa",
diff --git a/spotify_player/Cargo.toml b/spotify_player/Cargo.toml
index f5994cc..988d430 100644
--- a/spotify_player/Cargo.toml
+++ b/spotify_player/Cargo.toml
@@ -35,7 +35,7 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
lyric_finder = { version = "0.1.4", path = "../lyric_finder" , optional = true }
backtrace = "0.3.69"
-souvlaki = { version = "0.6.1", optional = true }
+souvlaki = { git = "https://github.com/Sinono3/souvlaki", branch = "volume", optional = true }
winit = { version = "0.29.4", optional = true }
viuer = { version = "0.7.1", optional = true }
image = { version = "0.24.7", optional = true }
diff --git a/spotify_player/src/media_control.rs b/spotify_player/src/media_control.rs
index 133e966..6bc5367 100644
--- a/spotify_player/src/media_control.rs
+++ b/spotify_player/src/media_control.rs
@@ -109,6 +109,11 @@ pub fn start_event_watcher(
.send(ClientRequest::Player(PlayerRequest::PreviousTrack))
.unwrap_or_default();
}
+ MediaControlEvent::SetVolume(volume) => client_pub
+ .send(ClientRequest::Player(PlayerRequest::Volume(
+ (volume * 100.0) as u8,
+ )))
+ .unwrap_or_default(),
_ => {}
}
})?;
from souvlaki.
@Sinono3
Does it support volume on macos now?
from souvlaki.
Just pushed version 0.7 which should have volume control for Linux.
Does it support volume on macos now?
No, sorry. I plan on buying a Mac soon. There won't be support until then or until someone else implements it. I'll create other issues for the other OSes.
from souvlaki.
I am happy to report that testing with the following command:
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify_player /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Set string:'org.mpris.MediaPlayer2.Player' string:'Volume' variant:double:0.4
Reveals that, yes the test_volume branch of spotify_player works as intended with souvlaki. Souvlaki 0.7.0 also works.
from souvlaki.
@LucasFA Thanks for testing! 🙂
from souvlaki.
Related Issues (20)
- PropertiesChanged signal on wrong interface HOT 2
- Using the library without `winit::event_loop` HOT 4
- Support for other platforms HOT 4
- Support HWND directly HOT 2
- Handle Access is denied error on Windows from not running as Administrator HOT 3
- Question about the name HOT 4
- Better error handling HOT 1
- Fetching media playback metadata? HOT 1
- Add some documentation on how `cover_url` is meant to be used HOT 1
- Windows hangs on `MediaControls::set_metadata()` HOT 1
- Linux: Shuffle/Loop
- MediaControls does not implement Debug HOT 1
- Windows: Volume control
- MacOS: Volume control
- [Meta] Git tags and / or a changelog file? HOT 2
- Add MSRV (Minimal Supported Rust Version) HOT 6
- [docs] `SetVolume` says values will be 0.0 to 1.0, but can actually be more HOT 1
- `dbus-crossroads` backend does not immediately apply updates HOT 4
- Metadata not updating (linux) HOT 10
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 souvlaki.