Does lack of MediaPlayer.MPNowPlayingInfo bug has some workaround?

IvanIcinIvanIcin USMember ✭✭✭

I have filed the bug and it is confirmed that MediaPlayer.MPNowPlayingInfo is not implemented in Xamarin.Mac, and it was confirmed.

However, there seems to be no work on this for more than 2 months, so I wanted to check if there is some way to import this API (and possibly some other APIs that don't work - MediaPlayer.MPNowPlayingInfoCenter.DefaultCenter.NowPlaying should return MediaPlayer.MPNowPlayingInfo so it doesn't work either).

This would allow to my app to show the playback commands in the Touch Bar when it is in the background which is a fairly attractive feature that I want to implement (and I even have a working code on iOS to use, just I can't because of this problem).

Best Answer

  • IvanIcinIvanIcin US ✭✭✭
    Accepted Answer

    To close the thread, bug now has a fix: https://bugzilla.xamarin.com/show_bug.cgi?id=55817 . I've got some time after commenting here a post in bugzilla from the developer about the fix (possibly referring to the fix @ChrisHamons was talking about), but it turned out that it wasn't a proper one, so he quickly made more changes and now this is expected to be in XM 3.99 preview 4.

Answers

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    First of all, are you talking about this (that was just fixed in master 2 weeks ago) -
    https://github.com/xamarin/xamarin-macios/commit/e7a5dd2af1d18c5b4175008346a5a3f624edbf20

    Let me sketch out a brief overview of the process bugs fixes take to get fixed and go out for public consumption:

    • Xamarin.Mac has a medium-largish backlog of missing bindings that we're working through along with trying to keep up with new Apple APIs.
    • Over time items are de-queued and worked on. When they are ready, they are landed in master.
    • You can try out these bleeding edge builds here by the way - https://jenkins.mono-project.com/view/Xamarin.MaciOS/job/xamarin-macios-builds-master/
    • Every so often, those are branched, stabilized, tested, and released.

    So if e7a5dd2af1d18c5b4175008346a5a3f624edbf20 has the fix, then it will go out in 15.4, which is near end of year roughly.

    Now let me answer your deeper question - "What can I do when a binding I need isn't there":

    • If you need a very small API surface, such as a single selector or a few C APIs, you can p/invoke or obj_msgSend manually. These are very manual to produce and error prone, but the nice thing is that you can use it as a bandaid without updating Xamarin.Mac. I can work though an example if you'd like, but you need to be comfortable enough with C memory semantics
    • If you need a larger API surface, you could hack on it in xamarin-macios (https://github.com/xamarin/xamarin-macios) yourself. It is open source, and for many small/medium sized APIs is rather straightforward.
    • If blocked and don't want to work on it yourself, you can also ask about it here and I'll let you know when I'd expect it to be scheduled, but it may be non-trivially far in the future.
  • IvanIcinIvanIcin USMember ✭✭✭
    edited July 2017

    Thanks @ChrisHamons. I believe that I have two APIs that don't work that I've mentioned above (and one is actually getting and setting object from class defined by other missing API). Other APIs from that class seem to be available in Xamarin, this was somehow omitted. Making those two work should bring me back on track.

  • IvanIcinIvanIcin USMember ✭✭✭
    Accepted Answer

    To close the thread, bug now has a fix: https://bugzilla.xamarin.com/show_bug.cgi?id=55817 . I've got some time after commenting here a post in bugzilla from the developer about the fix (possibly referring to the fix @ChrisHamons was talking about), but it turned out that it wasn't a proper one, so he quickly made more changes and now this is expected to be in XM 3.99 preview 4.

Sign In or Register to comment.