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

1

11

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?

Prole answered 8/9, 2012 at 19:26 Comment(2)
No. Since I was in fact developing a "tweak" for jailbroken iPhones, I managed to obtain that information by looking over some data into the iPod.app preference plist (located at ~/Library/Preferences/com.apple.mobileipod.plist), but I never found anything out really for what could be an actual app.Prole
Have you tried to get this info via repeatMode property of the player?Alteration
G
4

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];
Greybeard answered 17/12, 2012 at 11:38 Comment(1)
There are times when -repeatMode returns that mode.Prole

© 2022 - 2024 — McMap. All rights reserved.