GM Android Music for Gamemaker: Studio game devlopers
tired of having to find non copywrited music for your Android games? GM Android Music lets you play music from the users music library, problem solved!
GM Android Music is an extension for Android devices that allows you to play music from the users music library. Selling price is $1.99.
Update 12/28/16
Version 4.2 released
-This version complies with the Android os 6.0 and up and asks for permissions at runttime
-Asset package updated including a power button, first run alert message appears to alert user to restart app to use the granted permissions (ie: use the music player)
-bug fixes with not opening the player and crash if no song is playing on startup
You must have Gamemaker: Studio with the android module to use this extension. In your project you must have WRITE_EXTERNAL_STORAGE enabled by going to Global game settings in the resource tree, select Android>Permissions and check the WRITE_EXTERNAL_STORAGE box. Included in the extension is a basic project showing you the features of GM Android Music such as finding and reporting the number of songs on the device, scroll buttons to view the song names, auto playing the songs, random plaaying the songs, creating a playlist (the example allows creating 100 songs on the playlist but you can adjust or make your own code to play more or less), play the playlist in order, play the playlist randomly, go to a specific song, and the usual functions including play, pause, stop, next (also works in playlist mode), and previous (also works in playlist mode).
MAJOR UPDATE! I have added 4 new functions for the extension and updated the included assets project to reflect the new functions, they are as follows:
GetSongLength(track_Number) - gets the length in milliseconds of a requested song
GetCurrentSongLength() - gets the song length in milliseconds of the song currently playing
GetElapsedTime() - gets the time the song has been playing in milliseconds
GoToSeek(Time_In_Ms) - go to any position in the song by inputting the milliseconds
List of all of the functions in the extension (including the new ones):
PauseMusic() - pauses the music if playing
MusicStopped() - use to check if music is stopped
NumberOfTracks() - use to find number of tracks
ResumeMusic() - plays music if paused
PlayMusic(Track_Number) - play a particular song
GetCurrentSongName() - gets the currently playing song name
GetCurrentArtistName() - gets the currently playing artist name
MusicPlaying() - use to check if music is playing
NextTrack() - play the next song
PreviousTrack() - play the previous song
Init() - reset the player
GetSongName(Track_Number) - get the name of a particular song
GetArtistName(Track_Number) - get the name of a particular artist
MusicPaused() - use to check if the music is paused
StopMusic() - stop the music
GoToTrack(Track_Number) - go to a particular track, simillar to PlayMusic()
Final() - end all music and music player processes
GetSongLength(Track_Number) - gets the length in milliseconds of a requested song
GetCurrentSongLength(Track_Number) - gets the song length in milliseconds of the song currently playing
GoToSeek(Time_In_Milliseconds) - go to any position in the song by inputting the milliseconds
GetElapsedTime() - gets the time the song has been playing in milliseconds
In the assets I added a seekbar and fixed some minor bugs in the playlist script.
Time stamps below seek bar are total track time / track time currently played / track time in miliseconds / seek to time in milliseconds (active when dragging slider)
Also uploaded a new apk showing the features:
Enjoy and happy programming!!
Apk instructions - press Y button to bring up the music player or close it (closing it does not shut it off)
Press the Make playlist button to create a playlist, use the bottom left controller arrow buttons to move the pointer to the 'ADD' menu item, press the A button and a text box appears, type in the song NUMBER you wish to add, you can scroll through the songs list with the 2 top right arrow buttons. repeat for up to 100 songs then press the B button to exit the create playlist menu.
And here is a link to the listing on the gamemaker marketplace:
GM Android Music Marketplace listing
Credits:
This extension is modified and reworked with permission from GMMusic for Android by Neil from Red Line Games