Skip to content

atlanteh/cordova-plugin-media_with_setAudioStreamType

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-plugin-media-with-setAudioStreamType

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.

Supported Platforms

  • 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

Stream Types avialable

  • 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

Example

var incomingCallSound = new Media(src, mediaSuccess, [mediaErrorCB], [mediaStatusCB], streamType);  
//or use static method before object created
Media.setStreamType ="music";

Parameters

  • 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)

all others features one by one forked from cordova-plugin-media 2.2.1

About

Cordova plugin media with ability to change setAudioStreamType

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 36.8%
  • Java 20.8%
  • C# 20.6%
  • Objective-C 16.8%
  • C++ 5.0%