I caved in and bought an iPhone 6 a few months ago. Ever since then, I’ve been grappling with an annoying bug when listening to music: tracks ending prematurely. A picture is worth a thousand words, so here is the bug in action (the video shows an iPad Air 2, but the behavior is exactly the same):

Basically, when the player reaches 5:28 in the current track (let’s call this track A, which happens to be 5 minutes 44 seconds long in the example video), it starts playing the audio from the next track in the album (let’s call this track B). The user interface shows that its still playing track A. When the user interface reaches 5:44 (the end of track A), it shows that it’s playing track B, but not from the start, but from the middle of track. Empirically, it appears that it is playing track B from 5:44 - 5:28 = 0:16. Weird, right?

Needless to say, tracks A and B (and the entire album) play perfectly fine on iTunes on my Macbook Air, so there isn’t anything horribly wrong with them. The tracks were ripped from CDs that I own. I’m not entirely sure, but it’s very likely that the ripping was performed by some version of iTunes back in the day. So, the problem isn’t with the audio tracks themselves.

I’ve seen the problem occur on different iOS devices at home: an iPhone 6, an iPad Air 2, and an ancient iPod touch (second generation). So, the problem isn’t a defective iOS device, unless I’m extremely unlucky. This kind of leaves one cause to the problem: a software bug. But where is it?

At first, I thought it was the actual music player app on the iPhone. However, after installing groove and playing the tracks through that, I still saw the same problem occur. Therefore, the problem is unlikely to be with the actual player app.

This kind of leaves one culprit: iTunes. I suspect that when iTunes copies the tracks to the iPhone, it does something to them and causes the problem as a side effect. Unfortunately, it’s hard to verify this, since once a track is on the iPhone, you can’t copy it back to your computer and examine it, as you could with an Android device. But that’s the only plausible explanation I can come up with right now.

There is another peculiar side to this bug. I’ve recently upgraded from Maverick to Yosemite. Since Yosemite has an updated version of iTunes, I was hoping that the problem would go away, but it didn’t. At least, not quite in the way that I expected. Prior to the update, the songs weren’t skipping from 5:28, they were skipping from 3:28 — exactly two minutes earlier. After the update, the songs started skipping from 5:28, as shown in the video above. Performing the update itself wasn’t enough to affect this change; nor was recopying all the music to the iOS device after the update. I noticed the change after creating a new iTunes library, importing the tracks into it and then copying them to the iOS device. This reinforces my suspicion that iTunes on my Macbook Air is the culprit here.

Now, for some technical details. The current version of iTunes on my Macbook Air is 12.0.1.26. The affected tracks were encoded by iTunes 9.0.3.15 with QuickTime 7.6.5 — I can’t verify this for all of them, but I haven’t seen any other version combinations during my inspections. For songs longer than 5 minutes 28 seconds, the problem almost always occurs at 5:28 (I’ve seen it happen closer to the 6 minute mark, but rarely). For songs shorter than 5 minutes 28 seconds, there is no problem at all (obviously).

I’m going to throw this at Apple Support. If they can come up with anything useful, I’ll post an update.