title: Music player controls in iOS 8 today widget
body: <p>I'm trying to implement a sample iOS 8 today widget that includes a music player controls, the app is a basic music app with background-audio enabled.</p>
  
  <p>I looked a lot around to find a way for notifying containing app, but I didn't find any!.</p>
  
  <p>The scenario is basically, app is in suspended state and on a selected song/album (it might be paused on a certain song), then i need to display the names on the widget with play/stop/next buttons, etc.</p>
  
  <p>Based on Apple's documentation, and this document which describes the usage scenarios:
  <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensibilityPG.pdf" rel="nofollow noreferrer">https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensibilityPG.pdf</a></p>
  
  <p>It mentions that extensions shouldn't handle any long execution and stated specifically audio playback as a non-supported case as it needs to run outside the extension. but it didn't mention a way to trigger containing app in such scenario, it just mentioned NSURLSession technique which can handle big files downloads and wakeup app in background to call handleEventsForBackgroundUrlSession, and the App-Group share capabilities where both containing app and extension can access a shared data container. The only feasible solution that's stated is openURL solution which will forcibly bring the whole app to foreground.</p>
  
  <p>I did setup a single App-Group for my demo and tried NSNotificationCenter's calls using a custom notification, by calling addObserver/postNotificationName on containing app and extension respectively, but it didn't work at all. I even tried to change NSUserDefaults of App-Group instead, but this doesn't fire in containing app's background too.</p>
  
  <p>Here is some questions that might be related, but i didn't find an answer in it:
  (<a href="https://stackoverflow.com/questions/25184052/sharing-data-between-app-extension-and-conainer-app">Sharing data between app extension and conainer app</a>) ---
  (<a href="https://stackoverflow.com/questions/17307456/nsuserdefaultsdidchangenotification-not-sent-when-app-resumes-from-the-backgroun">NSUserDefaultsDidChangeNotification not sent when app resumes from the background</a>) ---
  (<a href="https://stackoverflow.com/questions/25701838/set-notifications-from-today-extension-widget">Set notifications from Today Extension Widget</a>)</p>
  
  <p>I thought that it might not be doable, but I just found an app called TapTunes that recently added a widget with similar features including all controls in the extension itself.</p>
  
  <p>Thanks.</p>