Load MPMusicPlayerController in custom keyboard

Asked 5 months ago, Updated 5 months ago, 12 views

Create a custom keyboard in Swift3 and press the
button. MPMusicPlayerController.systemMusicPlayer().nowPlayingItemI would like to insert the title (.title) and lyrics (.lyrics).

like a regular app Import MediaPlayer, declare an instance of MPMusicPlayerController in keyboardViewController, and call the method specified in the selector when notified by nowPlayingItemDidChange to retrieve the song information.

Is MediaPlayer not corresponding to the App Extension of the custom keyboard?
Or do I need to do something special?

Alternatively, it would be nice if it could be implemented using the single view app and UIButton and UITextView instead of the custom keyboard to retrieve and pass the information on the host app...

swift ios swift3 ios-app-extension

2022-09-30 13:53

1 Answers

I've never tried the extension of a custom keyboard, so I'm not sure, but if it doesn't have to be a custom keyboard (only available in my app), I'm doing something similar with the tweets feature of my app SongsInfo.

This app allows you to insert meta-information of songs instead of keyboards by setting UITableView to inputView in UITextView.

SongsInfo Tweeting Features

Also, remember to include Privacy-Media Library Usage Description in Info.plist.

2022-09-30 13:53

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.