WKAudioFileQueuePlayer replaceCurrentItem not working

If I seed a WKAudioFileQueuePlayer with a list of WKAudioFilePlayerItem.

Whenever I call replaceCurrentItem(item:) passing the first item in the list, it advances to the next item in the list.

e.g. Item 0 is playing

call replaceCurrentItem(item0)

Item 1 starts playing

call replaceCurrentItem(item0)

Item 2 starts playing


Am I doing something wrong?

Thanks,

casey

Replies

If you read the documentation it says that method does nothing. Don't use it

That's the documentation for WKAudioFilePlayer.

"The default implementation of this method does nothing. Subclasses can override it to implement support for swapping out the current player item for a new one."


Look at the documentation for its subclass WKAudioFileQueuePlayer.

"This method also implements the inherited

replaceCurrentItem(with:)
method and uses it to end playback of one item and start playback of another."

Gotcha. It didn't work for me so I just call advance next (or something like that) and also remove the previously player item from the queue. Basically what it's supposed to do. Do you know if there is something special that has to be done for the player to respond to play/pause actions from the Bluetooth device? That o can't figure out.

Yep, having to use AdvanceToNext for now.

Too bad there is no way to go backwards.

The Now Playing screen (from the dock) behaves the same, skip next works, but skip back does nothing.


My app needs to react to BT pause or disconnect too, but my currrent understanding is that it can't be done until WatchKit gets access to Core Bluetooth.

Related, I don't think there's a way for my app to determine that an AirPlay device isn't connected, and prompt the user to pair or connect.

Same boat here. If you use the music app and start playing content from the watch and then go back to your app it will respond to play/pause. So some private API perhaps