Skip to content

HafizAhmedMoon/cordova-plugin-music

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-music

This plugin provides the ability to retrieve songs list, playlist, songs from playlist, play and stop song.

Installation

cordova plugin add https://github.com/hafizahmedattari/cordova-plugin-music.git

Supported Platforms

  • Android
  • iOS

Methods

window.cordova.plugins.Music.getSongs

Returns the list of songs.

window.cordova.plugins.Music.getSongs(
    // success callback
    function (list) {
        console.log("songs length" + list.length);
    },
    // error callback
    function (e) {
        console.log("Error getting message=" + e);
    }
);

window.cordova.plugins.Music.getPlaylists

Returns the list of playlists.

window.cordova.plugins.Music.getPlaylists(
    // success callback
    function (list) {
        console.log("playlists length" + list.length);
    },
    // error callback
    function (e) {
        console.log("Error getting message=" + e);
    }
);

window.cordova.plugins.Music.getSongsFromPlaylist

Returns the list of playlist.

window.cordova.plugins.Music.getSongsFromPlaylist(
    //id of playlist
    playlistId,
    // success callback
    function (list) {
        console.log("songs length" + list.length);
    },
    // error callback
    function (e) {
        console.log("Error getting message=" + e);
    }
);

window.cordova.plugins.Music.playSong

Play song by songId and Call onComplete callback.

window.cordova.plugins.Music.getSongsFromPlaylist(
    //id of song
    songId,
    // onComplete callback
    function (msg) {
        console.log("audio completed");
    },
    // error callback
    function (e) {
        console.log("Error getting message=" + e);
    }
);

window.cordova.plugins.Music.stopSong

Stop song.

window.cordova.plugins.Music.getSongsFromPlaylist(
    // success callback
    function (msg) {
        console.log("audio stopped");
    },
    // error callback
    function (e) {
        console.log("Error getting message=" + e);
    }
);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published