Fork of Media plugin with adding ability to change media play type: Ring, Music, Notification, system
This plugin provides the ability to record and play back audio files on a device.
- Android
- Browser
#Additional static methods available on Android:
- Media.mute_microphone(true); //mic muted
- Media.mute_microphone(false); //mic not muted
- Media.mute_stream(streamType);
- Media.mute_stream("music"); // music stream muted // new same call unmute stream
- notification
- alarm (The audio stream for alarms)
- dtmf (The audio stream for DTMF Tones)
- music (The audio stream for music playback
- notification (The audio stream for notifications)
- ring (The audio stream for the phone ring)
- system (The audio stream for system sounds)
- voice_call
var incomingCallSound = new Media(src, mediaSuccess, [mediaErrorCB], [mediaStatusCB], streamType);
//or use static method before object created
Media.setStreamType ="music";
-
src: A URI containing the audio content. (DOMString)
-
mediaSuccess: (Optional) The callback that executes after a
Media
object has completed the current play, record, or stop action. (Function) -
mediaError: (Optional) The callback that executes if an error occurs. (Function)
-
mediaStatus: (Optional) The callback that executes to indicate status changes. (Function)
-
streamType: (Optional) StreamType setting. (String)
// Avialable stream types:
//alarm (The audio stream for alarms)
//dtmf (The audio stream for DTMF Tones)
//music (The audio stream for music playback
//notification (The audio stream for notifications)
//ring (The audio stream for the phone ring)
//system (The audio stream for system sounds)
//voice_call
//OPTION 1: You should call setStreamType before create an media object
Media.setStreamType("music");
var my_media = new Media('cdvfile://localhost/temporary/recording.mp3', ...);
//OPTION 2: You can set streamType by type paramert of constructor
var incomingCallSound = new Media(src, mediaSuccess, [mediaErrorCB], [mediaStatusCB], streamType);
###install PhoneGap build or Cordova cli: (add to config.xml)