Don't stop the user music on devices under demmand

Previous topic - Next topic

Dark Schneider

There should be a way to say GLBasic not to stop the user music when launch the application.

Some games are preferable to have no music, and allow users to use their own in their music library, but currently GLBasic always stops the playing music when start the application.

Then, I think it could be good add something, probably the best location is in project properties, and mark and option for "Allow user custom music".

The main target I can think for this is of course the iPhone, but it can be used too on others devices, and in the future on iPad too.

Nobiag


Kitty Hello

Yes. Me too. How to do that? (Trucidare!?)

Slydog

Here's a good resource for music playback:
http://developer.apple.com/iphone/library/documentation/mediaplayer/reference/MPMusicPlayerController_ClassReference/Reference/Reference.html


Quote
You use an MPMusicPlayerController object, or music player, to play media items from the iPod library. There are two types of music player:

  • The application music player plays music locally within your application. It is not aware of the iPod app's now-playing item, nor does it affect the iPod state.
  • The iPod music player employs the built-in iPod application on your behalf. On instantiation, it takes on the current iPod application state, such as the identification of the now-playing item. If a user quits your application while music is playing, that music continues to play. The iPod application then has your music player's most recently-set repeat mode, shuffle mode, playback state, and now-playing item.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello

ok, I think I will make it, that if the iPod is on, the PLAYMUSIC commands will be ignored and iPod is played. Is that OK?

Slydog

So, if a song is being played when the game starts, it will keep playing.
And no way to start playing your own custom game music in that case.
(but sound effects would still work?)

That's not a bad option, if the user wants to listen to his/her own music, just start playing it before your game starts.
Otherwise you can play your own music.

When their song ends, the music is over?
It'd be cool to auto set their repeat mode (repeatMode) (default to MPMusicRepeatModeAll?) so the music never ends.
(but is this global?  you may have to set it back when exiting)

How hard is it to allow them to choose songs from their own library while in your game!?  That would be neat.  Does Apple even expose that? 

(Same as photos too I guess.  Having custom photos in your game would add a personal touch.  (A family portrait in a hallway, billboards, etc).  (With the user's permission of course!))

[Edit]
To initialize the playback queue to contain every song in the library, use this:  (Objective C I assume?)
// assign a playback queue containing all media items on the device
[myPlayer setQueueWithQuery: [MPMediaQuery songsQuery]];

from the page:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/22636-mpmediaquery-hanging.html

We could then give them next / previous buttons in our app and call 'skipToNextItem' and 'skipToPreviousItem'.
But with inline code, how do you insert Objective C? or translate it!?
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Kitty Hello


Dark Schneider

Quote from: Kitty Hello on 2010-Jun-22
ok, I think I will make it, that if the iPod is on, the PLAYMUSIC commands will be ignored and iPod is played. Is that OK?

I think that is perfect, no need for more complex things because if users are playing a music from their library it is clear that is because they want that music and not the game one.

Note that the iPod music is stopped when there is no PLAYMUSIC in the code, so the current GLBasic music engine initialization stops the device music.

Slydog

Wow, that's convenient!  Thanks.
Scratch that off my 'To Do' list!

Quote from: Kitty Hello on 2010-Jun-23
If you want that many options, try:
http://www.glbasic.com/forum/index.php?topic=4169.0
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Wampus

Quote from: Kitty Hello on 2010-Jun-22
ok, I think I will make it, that if the iPod is on, the PLAYMUSIC commands will be ignored and iPod is played. Is that OK?
Yes! This would be great.

quangdx

wondering if this ever got implemented?

if the iPod music is playing when the app starts,
it just leaves it playing and playmusic commands are ignored.
Asobi tech - the science of play.
Spare time indiegame developer.

Dark Schneider

Hi, could be this change included in the new version, currently in beta?.

Falstaff

*bump*

I've been noticing this behvaiour as well. Any way we can get it resolved?