Note that there are some explanatory texts on larger screens.

plurals
  1. POObjective C (iPhone) Strange Behaviour with musicPlayer API
    text
    copied!<p>I'm developing a music app for iPhone that uses the built in iPod library. I noticed a strange behaviour that I was able to replicate in Apple's sample code entitled "AddMusic" simply by NSLogging out what was going on. </p> <p><strong>My question is:</strong> </p> <p>Has anyone else encountered this, or better yet found a solution?</p> <p><strong>The behaviour is:</strong> </p> <p>With the musicPlayer API, one is able to get notifications on state changes of the iPhone's built in iPod. For example, when a song is played or paused, it can shoot off a notification. </p> <p>You can also queue up songs to be played by invoking a mediaPicker which accesses the music library.</p> <p>The problem occurs while the API is switching the song from the currently playing one to the new song, which was cued up. </p> <p>What I noticed is that, in both Apple's sample code and my code, the player state change notification is fired 5 or 6 times, seemingly at random. A sample NSLog is as follows: </p> <pre><code>2013-08-27 17:24:14.676 AddMusic[418:60b] Paused 2013-08-27 17:24:14.937 AddMusic[418:60b] Playing 2013-08-27 17:24:14.943 AddMusic[418:60b] Paused 2013-08-27 17:24:14.950 AddMusic[418:60b] Playing 2013-08-27 17:24:15.842 AddMusic[418:60b] Paused 2013-08-27 17:24:15.853 AddMusic[418:60b] Playing </code></pre> <p>I am using X-Code DP6 and iOS 7 B6, but I don't think this is an NDA issue since these commands are old. Just thought I'd provide this information in case this is a new problem. </p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload