iOS lock screen sound title

You must Login before you can answer or comment on any questions.

iOS devices can show title of currently played media on the lock screen (after double click on the home button). I cannot find any Titanium API allowing to control that. Do I miss something or Titanium simply lacks this functionality?

— asked 8 months ago by Ivan Brykov
4 Comments
  • Are you saying that you want to change the track that is displayed on the lockscreen??

    — commented 8 months ago by Anthony Decena

  • You can say so. But the verb 'change' means there is some title displayed. In my case there is no title at all. All I can see is 3 buttons controlling playback and volume slider.

    — commented 8 months ago by Ivan Brykov

  • That track that is displayed there is the last track you played in the default Music player. Whatever is 'Now Playing' in the Music player is what is controllable via the lockscreen.

    — commented 8 months ago by Anthony Decena

  • Show 1 more comment

1 Answer

Accepted Answer

Ok, so it looks like you need to use the MPNowPlayingInfoCenter to interact with that Now Playing media item, which will then in turn display it on the lockscreen. This is not available via a Titanium api, but it looks like you might be able to easily enough create a native module to do it.

Looks like the basic idea is:

NSArray *keys = [NSArray arrayWithObjects:MPMediaItemPropertyAlbumTitle, MPMediaItemPropertyArtist, ..., nil];
NSArray *values = [NSArray arrayWithObjects:@"Album", @"Artist", ..., nil];
NSDictionary *mediaInfo = [NSDictionary dictionaryWithObjects:values forKeys:keys];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mediaInfo];
See the class ref here: http://developer.apple.com/library/ios/#documentation/mediaplayer/reference/MPNowPlayingInfoCenter_Class/Reference/Reference.html

— answered 8 months ago by Anthony Decena
answer permalink
3 Comments
  • Yes I have seen that API. I didn't know I can create my own modules extending Titanium.. In fact it's my first Titanium (and iOS) app ever. And it makes me create native extensions to the Titanium! Should better switch to XCode then:)

    — commented 8 months ago by Ivan Brykov

  • Nobody is making you create a native extension. You've simply asked for access to an API that not many people have asked for before, so it has not been added to the core platform. You are more than welcome to submit a Jira feature request to have it added, or, as you said, if you're already an Obj-C rockstar, then you can switch to Xcode.

    — commented 8 months ago by Anthony Decena

  • Thanks for your help! Here is the ticket: http://jira.appcelerator.org/browse/TC-1380

    — commented 8 months ago by Ivan Brykov

Your Answer

Think you can help? Login to answer this question!