Comments (3)
You could check what Distributed Notifications Music.app emits, e.g. I know it sends notifications of track changes, and if there’s one for volume changes then register a listener with DistributedNotificationCenter
for that.
Chances are it doesn’t (DNs are cool but massively undersupported and underused), in which case all you can do is actively poll. Run a repeating Timer
in your app that periodically (e.g. every 200ms) sends Music.app a get volume
Apple event and updates your GUI with the result of that.
from swift-applescriptobjc.
Roger that. I will have to look to see, but similar to your thoughts it is probably a longshot. I will certainly do the timer thing to poll the volume if a DN doesn't exist. Thank you for putting this out there!
from swift-applescriptobjc.
My intention with this was to implement a background music option for when the main app is not playing music, so I dug around and tried implementing a couple items like get current playlist and set playlist, but I couldn't get this to work. I was getting a lot of errors, so I decided AppleScript is for AppleScripters and Swift is for Swifters and I just implemented a background player in my app that I can set a playlist and play/pause as I needed when my app is not playing the main music. It also helps to not to have to rely on sandboxing, hardened runtime, and other permissions, or opening Music in the background. It's all contained in my app.
Again, thanks for sharing this and opening my mind to other possibilities and options.
from swift-applescriptobjc.
Related Issues (2)
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 swift-applescriptobjc.