Author Topic: Don't stop the user music on devices under demmand  (Read 4842 times)

Offline Dark Schneider

  • Mr. Polyvector
  • ***
  • Posts: 128
    • View Profile
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.

Offline Nobiag

  • Mr. Drawsprite
  • **
  • Posts: 58
    • View Profile
I'm very interested in this too.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Yes. Me too. How to do that? (Trucidare!?)

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 924
  • KodeSource
    • View Profile
    • KodeSource
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]

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
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?

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 924
  • KodeSource
    • View Profile
    • KodeSource
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!?
« Last Edit: 2010-Jun-22 by Slydog »
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10651
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com

Offline Dark Schneider

  • Mr. Polyvector
  • ***
  • Posts: 128
    • View Profile
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.

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 924
  • KodeSource
    • View Profile
    • KodeSource
Wow, that's convenient!  Thanks.
Scratch that off my 'To Do' list!

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]

Offline Wampus

  • Prof. Inline
  • *****
  • Posts: 1004
    • View Profile
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.

Offline quangdx

  • Mr. Polyvector
  • ***
  • Posts: 233
  • work hard / play hard
    • View Profile
    • Asobi tech
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.

Offline Dark Schneider

  • Mr. Polyvector
  • ***
  • Posts: 128
    • View Profile
Hi, could be this change included in the new version, currently in beta?.

Offline Falstaff

  • Mr. Polyvector
  • ***
  • Posts: 148
    • View Profile
*bump*

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