kadiks/react-native-itunes

Example, Playing the the tracks in the playlist

Closed this issue · 5 comments

Hi,

There is no stop function. Is there any plans to implement a stop method.

Thanks,

Moses

Hi,

I don't see the relation between the title and the comment.

Playing tracks in playlist:
No, there is no way of doing it properly. I tried a hack before posting and it requires too much code for a buggy solution.
It's a good feature. The library wasn't intended to do Player capability, but it seems all the PR are going this way.
Concerning timeline, I can't tell you for sure. I'll leave this open as a "playing tracks in playlist" issue only.

Stop function:
There's a pause() method, that's not enough? If not, can you explain in which case you would need it.
If you need it, please open a separate issue.

Sorry about the confusion between title thread and my message. I updated the message without updated the title during the weekend. I believe I figured out an approach to play sequentially tracks within a selected album.

Also, I tweaked your code locally to insert a stop feature, within the itunes.js file, I inserted:

stop: function() {
RNiTunes.stop();
},

within RNiTunes.m, I inserted

RCT_EXPORT_METHOD(stop) {
NSLog(@"%@ %@", NSStringFromClass([self class]), NSStringFromSelector(_cmd));

[[MPMusicPlayerController applicationMusicPlayer] stop];

}

It appears to work.

I'm developing a fitness app. During the workout songs from a user's iTunes playlist play, but as soon as the user exits the fitness view. The songs stop. That is the reason I need to insert the stop function view.

Moses

Good, can you make a PR out of it?

Also, I've looked into a possibility to play a playlist and it doesn't seem to be too long. I'll give it a try this week, if it's as easy as it seems, I'll hit you up.
Otherwise, I'll put it on the todo later list.

There you have it, stop() and playTracks() methods with no hacks, plus methods to skip to next and previous item in your playlist.

I'll be pushing the 0.5.0 on NPM in the next few days, so use the master branch for now

Thanks.