Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediaPlayer.framework: How to "translate" MPMusicRepeatModeDefault into an actual mode?

As is stated in Apple documents:

enum {
   MPMusicRepeatModeDefault,
   MPMusicRepeatModeNone,
   MPMusicRepeatModeOne,
   MPMusicRepeatModeAll
};
typedef NSInteger MPMusicRepeatMode;

Yet, MPMusicRepeatModeDefault is described as The user’s preferred repeat mode. Since I am writing a music player I require to know every time what is the current repeat mode, and when this is returned, what of the "actual" modes:

  • MPMusicRepeatModeNone
  • MPMusicRepeatModeOne
  • MPMusicRepeatModeAll

shall be chosen? Or is there no way to get such information?

like image 409
Matoe Avatar asked Sep 08 '12 19:09

Matoe


1 Answers

My understanding is that MPMusicRepeatModeDefault is only used for instantiating your own player as described here.

MPMusicPlayerController* appMusicPlayer = [MPMusicPlayerController applicationMusicPlayer];

// Use whatever the user has set in their iPod settings
// Omitting this line has no real effect because deferring to the
// user mode is the default setting for new players
[appMusicPlayer setRepeatMode: MPMusicRepeatModeDefault];

If you want to know what that default setting actually is, you should be able to get it from the iPodMusicPlayer instance:

MPMusicPlayerController* iPodMusicPlayer =
    [MPMusicPlayerController iPodMusicPlayer];

MPMusicRepeatMode theDefaultMode = [iPodMusicPlayer repeatMode];
like image 152
lfalin Avatar answered Nov 14 '22 13:11

lfalin