Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/richpixel/SongPickerANE
A song picker/player AIR native extension for iOS and Android.
https://github.com/richpixel/SongPickerANE
Last synced: about 2 months ago
JSON representation
A song picker/player AIR native extension for iOS and Android.
- Host: GitHub
- URL: https://github.com/richpixel/SongPickerANE
- Owner: richpixel
- Created: 2013-02-02T04:42:57.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-09-11T14:50:02.000Z (over 9 years ago)
- Last Synced: 2024-08-04T05:03:14.843Z (5 months ago)
- Language: ActionScript
- Size: 43 MB
- Stars: 27
- Watchers: 8
- Forks: 6
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-actionscript-sorted - SongPicker ANE - A song picker/player ANE for iOS and Android. (Native Extension / Multimedia ANE)
README
SongPickerANE
=============A song picker/player AIR native extension for iOS and Android.
Author: Rich Lovejoy (https://github.com/richpixel)
The SongPicker Air Native Extension lets you choose a song from your music library on your iOS or Android device
using the native media picker, and play it back using the native media player.#Notes:#
- You must include the following lines in the Android manifest section of your app config xml file to use the picker:...
- You must specify the iOS SDK to build against when packaging an app for iOS. (ActionScript Build Packaging > Apple iOS > Native Extensions)
#Usage#
Include the SongPicker.ane in your project.
import com.newpixel.air.nativeextensions.SongPicker;
import com.newpixel.air.nativeextensions.SongPickerEvent;...
SongPicker.instance.addEventListener(SongPickerEvent.SONG_CHOSEN, songChooseHandler);
SongPicker.instance.addEventListener(SongPickerEvent.CANCELLED_SONG_PICKER, cancelPickHandler);
SongPicker.instance.pickSong();#API#
SongPicker class methods
- isNativeMediaPickerAvailable():Boolean
Returns true if there is a native media picker on this device. This may return false on some Android devices, like the Kindle.
- pickSong(downloadedSongsOnly:Boolean=true):void
Bring up the native media picker to allow a user to choose a song from his library.
Triggers the SongPickerEvent.SONG_CHOSEN or SongPickerEvent.CANCELLED_SONG_PICKER when the picker is dismissed.
Args:
- downloadedSongsOnly: If true, the device will only show songs that are downloaded on the device, and ignore those in the cloud.
- playSong(songId:String="", position:Number=-1):void
Begin playing a song with the specified ID, or resume playing the current song if songId is "".
Args:
- songId: The persistent ID of the song to play, which is obtained after picking a song with the picker.
- position: A playhead position in seconds, to begin playing the song. The default value -1 tells the player
to begin playing at the start of the song or to resume where it left off.
- pauseSong():void
Pause the current song playback.- stopSong():void
Stop current song playback.- setVolume():void
Pass a Number between 0 and 1 to set the volume of the currently playing song.
- getVolume():Number
Returns a Number between 0 and 1 - the volume of the currently playing song.- setPlayheadTime():void
Pass a Number in seconds to set the playhead of the currently playing song.
- getPlayheadTime():Number
Returns a Number in seconds - the playhead of the currently playing song.
- fadeOutSong(fadeTime:Number):void
Fade down the song's volume to 0 in fadeTime seconds.- fadeInSong(fadeTime:Number):void
Fade up the song's volume from 0 in fadeTime seconds.
SongPickerEvent- SONG_CHOSEN: Triggered when the user has selected a song from the media picker. The following properties will be available in the event object:
- ID (String): persistent ID of the song. This is a 64-bit number on iOS and a URI on Android.
- title (String): title of track.
- artist (String): artist of track.
- duration (int): length of the track in seconds- CANCELLED_SONG_PICKER: User has cancelled picking a song.
- SONG_FINISHED: Playback of current song has finished.#Examples#
See the SongPickerExample project which can be built with FlashBuilder.