{"id":15903673,"url":"https://github.com/vfdev-5/mimusicservice","last_synced_at":"2025-04-02T20:16:12.837Z","repository":{"id":33193269,"uuid":"36835282","full_name":"vfdev-5/miMusicService","owner":"vfdev-5","description":"'my' Music Service library","archived":false,"fork":false,"pushed_at":"2015-12-15T08:03:03.000Z","size":234,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-08T10:44:15.250Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vfdev-5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-03T22:58:51.000Z","updated_at":"2015-06-03T23:00:53.000Z","dependencies_parsed_at":"2022-08-17T20:00:37.053Z","dependency_job_id":null,"html_url":"https://github.com/vfdev-5/miMusicService","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FmiMusicService","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FmiMusicService/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FmiMusicService/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FmiMusicService/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfdev-5","download_url":"https://codeload.github.com/vfdev-5/miMusicService/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246884772,"owners_count":20849554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T12:03:40.077Z","updated_at":"2025-04-02T20:16:12.802Z","avatar_url":"https://github.com/vfdev-5.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# miMusicService [![Build Status](https://travis-ci.org/vfdev-5/miMusicService.svg?branch=master)](https://travis-ci.org/vfdev-5/miMusicService)\na library with a media player and a service used to listen streaming music from free cloud resources :\n\n- [SoundCloud](https://soundcloud.com)\n- [HearThis.@t](https://hearthis.at)\n- [Jamendo](https://www.jamendo.com)\n\n## Library structure :\n\nThe idea of the library is to provide an \u003ci\u003eeasy\u003c/i\u003e access to free streaming music. It that way there is a player (MusicPlayer) that plays tracks (TrackInfo) from a cloud resource (TrackInfoProvider). Tracks are searched from resources by a specific queries (ProviderQuery). In other words, TrackInfoProvider produces a list of TrackInfo specified by a ProviderQuery and MusicPlayer plays this tracks.\n\nA MusicPlayer is be also integrated into MusicService. There is a helper (MusicServiceHelper) that can easily start MusicService, load/play/change tracks and respond to new queries.\n\nCore part of the library :\n\n- [MusicPlayer](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/MusicPlayer.java) a wrapping class on android MediaPlayer class to play streaming music.\n- [TrackInfo](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/TrackInfo.java) a streaming data model class containing info like track title, duration, streaming url, tags, etc\n- [TrackInfoProvider](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/TrackInfoProvider.java) an abstract class to produce TrackInfo's\n    - [SoundCloudProvider](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/SoundCloudProvider.java) an implementation of TrackInfoProvider to produce tracks from [SoundCloud](https://soundcloud.com)\n    - [HearThisAtProvider](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/HearThisAtProvider.java) an implementation of TrackInfoProvider to produce tracks from [HearThis.@t](https://hearthis.at)\n    - [JamendoProvider](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/JamendoProvider.java) an implementation of TrackInfoProvider to produce tracks from [Jamendo](https://www.jamendo.com)\n- [ProviderQuery](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/ProviderQuery.java) represents a query for TrackInfoProvider to select tracks by text and duration\n\n\nService and helper :\n\n- [MusicService](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/MusicService.java) an android service that embeds MusicPlayer and a list of TrackInfoProviders. It can continuously load and play tracks, change to next/previous track, setup queries etc.\n- [MusicServiceHelper](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/MusicServiceHelper.java) is a helper that starts MusicService and perform all its useful methods. It also allows to manipulate available TrackInfoProviders.\n\n## Simple usage :\n    1) Initialize the singleton MusicServiceHelper with track info providers : SoundCloudProvider, HearThisAtProvider, JamendoProvider, etc in your activity\n    2) Release MusicServiceHelper in onDestroy method \n    3) Use methods of the MusicServiceHelper : \n        - play \n        - pause \n        - playNextTrack \n        - playPrevTrack\n        - getPlayingTrackInfo\n        - clearPlaylist\n        - setupTracks\n        - startMusicService\n        - stopMusicService\n        etc\n    4) Subscribe to various events (using EventBus.getDefault().register(this)):\n        - MusicServiceHelper.ReadyEvent when service is ready (e.g. to update UI)\n        - MusicPlayer.StateEvent when player updates its internal event.state {Playing, Paused, Preparing, Stopped}\n        - MusicPlayer.ErrorEvent when there is an error in the player, event.code {ERROR_DATASOURCE, ERROR_APP, ERROR_NO_AUDIOFOCUS}\n        - MusicService.ErrorEvent when there is an error in the service, event.code {APP_ERR, CONNECTION_ERR, NOTRACKS_ERR, QUERY_ERR}\n        - MusicService.QueryResponseEvent when service receives tracks from a provider (e.g. SoundCloud) and sends a list of tracks, event.tracks\n\n``` java\npublic class MainActivity extends Activity\n{\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        // ...\n        mMSHelper = new MusicServiceHelper.getInstance().init(this, new SoundCloudProvider(), MainActivity.class);\n        //\n        // Or for multiple providers :\n        // mMSHelper = new MusicServiceHelper.getInstance().init(this, \n        //                      new TrackInfoProvider{ new SoundCloudProvider(), new HearThisAtProvider() },\n        //                      MainActivity.class);\n        //\n        // Or create using string names :\n        // int nbOfProviders = 3; // or 1,2,3,4, etc\n        // TrackInfoProvider providers = new TrackInfoProvider[nbOfProvider];\n        // providers[0] = MusicServiceHelper.createProvider(\"SoundCloud\");\n        // providers[1] = MusicServiceHelper.createProvider(\"HearThisAt\");\n        // providers[2] = MusicServiceHelper.createProvider(\"Jamendo\");\n        // ...\n        // mMSHelper = new MusicServiceHelper.getInstance().init(this, providers, MainActivity.class);\n        mMSHelper.startMusicService();\n        \n    }\n    // ...\n    @Override\n    public void onReady() {\n        // Synchonize UI\n    }\n    // ...\n    \n    public void onNextButtonClicked(View view) {\n        mMSHelper.playNextTrack();\n    }\n    \n    // ...\n    \n    @Override\n    protected void onDestroy() {\n        // ...\n        mMSHelper.release();\n        // ...\n    }\n    \n    // ...\n}\n```\n\n    \n## See examples for more details :\n\n- [musicplayerapp](https://github.com/vfdev-5/miMusicService/blob/master/musicapp), a single activity application with an instance of [MusicPlayer](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/core/MusicPlayer.java)\n- [musicserviceapp](https://github.com/vfdev-5/miMusicService/blob/master/musicserviceapp), a single activity application which uses [MusicServiceHelper](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/MusicServiceHelper.java) to start a [MusicService](https://github.com/vfdev-5/miMusicService/blob/master/mimusicservicelib/src/main/java/com/vfdev/mimusicservicelib/MusicService.java) that plays music.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfdev-5%2Fmimusicservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfdev-5%2Fmimusicservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfdev-5%2Fmimusicservice/lists"}