Skip to content

[WIP] MPRemoteCommandCenter integration - #8280

Closed
MarshallOfSound wants to merge 3 commits into
masterfrom
remote-command-center
Closed

MarshallOfSound wants to merge 3 commits into
masterfrom
remote-command-center

Conversation

@MarshallOfSound

@MarshallOfSound MarshallOfSound commented Dec 24, 2016 •

Copy link
Copy Markdown
Member

This allows apps to hook into the new MPRemoteCommandCenter API's on macOS 10.12.2. Pretty sure this breaks on older macOS versions so I need to add a few ifs. It add's two new app API's.

app.initializeAsMediaPlayer()
app.setNowPlaying({
  currentTime,
  duration,
  title,
  artist,
  album,
  id,
  state,
});

When I hooked this up to GPMDP it generates the correct system wide touch bar 😄

touch bar shot 2016-12-25 at 10 30 24 am

NOTE: I totally did this on the plane on my way home still it still needs a bit of cleanup 👍

TODO

  • Add docs
  • Ensure it builds on non-macOS platforms
  • Ensure it builds / runs on older macOS versions

@MarshallOfSound

Copy link
Copy Markdown
Member Author

/cc @kevinsawicki Looks like this PR needs XCode version bumps (or at least macOS SDK version bumps) on the build agents as well.

@levrik

levrik commented Dec 28, 2016 •

Copy link
Copy Markdown
Contributor

@MarshallOfSound

MarshallOfSound commented Dec 28, 2016 •

Copy link
Copy Markdown
Member Author

@levrik For now I have no intention of personally adding support for the Windows API for this (although I would love it). The current API style however does leave itself open for expansion into this windows API and it was in the back of my mind while I was implementing this.

This is mostly due to me not having a windows machine with fast enough internet to download libchromiumcontent for a few months. 😢

@levrik

levrik commented Dec 28, 2016

Copy link
Copy Markdown
Contributor

@MarshallOfSound Okay, nice. Maybe I find time to give the Windows API a try.

@Kytech

Kytech commented Dec 30, 2016

Copy link
Copy Markdown

@levrik, I am also looking into implementing the Windows side of this feature. If you would like to help with this, I would be glad to have your help. @MarshallOfSound referred me to this pull request as a place to start.

@levrik

levrik commented Dec 30, 2016

Copy link
Copy Markdown
Contributor

@KytechN24 I looked a bit into it but gave up. I have not really much C++ knowledge and to access the Windows API for that you have to use some type of bridge between the Windows Apps API and the "normal" Windows API. I tried to get it working in an isolated environment but I failed.

@kevinsawicki

Copy link
Copy Markdown
Contributor

Looks like this PR needs XCode version bumps (or at least macOS SDK version bumps) on the build agents as well.

This is probably going to be blocked on https://bugs.chromium.org/p/chromium/issues/detail?id=680927

@MarshallOfSound

Copy link
Copy Markdown
Member Author

@kevinsawicki That affects the NSTouchBar PR as well doesn't it? 😢

@kevinsawicki

Copy link
Copy Markdown
Contributor

That affects the NSTouchBar PR as well doesn't it?

Yes it will

@kevinsawicki

Copy link
Copy Markdown
Contributor

After looking into this a bit, I don't think this is something we can resolve using the forward declarations approach like the touchbar PR did since the MediaPlayer framework needs to be linked for it to be available which isn't possible when building against the 10.10 SDK since it isn't in that SDK.

The current implementation here does look like something that could be added via a native node module that weak links against the media player framework and could use NSClassFromString to check if its available at runtime so it could support older macOS versions.

We can incorporate this change though once Chrome/Electron can build against the 10.12.1+ SDK which will eventually happen.

@MarshallOfSound you okay closing this for now or do you still want to experiment with getting this working against a 10.10 SDK?

@MarshallOfSound

Copy link
Copy Markdown
Member Author

@kevinsawicki Looking back at the implementation it does look like it could live in a native module. Will close out and experiment with ways of getting this done 👍

@kevinsawicki
kevinsawicki deleted the remote-command-center branch March 17, 2017 18:03
@MarshallOfSound

Copy link
Copy Markdown
Member Author

Anyone stumbling upon this, the feature in this PR is now part of this module 👍

https://github.com/MarshallOfSound/electron-media-service

@fcastilloec

Copy link
Copy Markdown

has this been added to electron? the module seems to not work on current versions and probably is not maintained anymore. Is there any alternative to using the macOS APIs for media players with electron?

@Christilut

Copy link
Copy Markdown

Interested in this as well, seems like the module is outdated and incomplete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants