NPAPI:AudioControl: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Created page with "= Status = Drafting. = Contributors = * Last modified: August 14, 2011 * Authors: Kyle Huey (Mozilla) * Contributors: = Use case = The ability to mute/unmute tabs or determ...")
 
(Update date)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Status =
= Status =


Drafting.
Approved


= Contributors =
= Contributors =


* Last modified: August 14, 2011
* Last modified: June 24, 2015
* Authors: Kyle Huey (Mozilla)
* Authors: Kyle Huey (Mozilla), Benoit Girard (Mozilla)
* Contributors:  
* Contributors: Josh Aas (Mozilla)


= Use case =
= Use case =
Line 17: Line 17:


<pre>
<pre>
NPBool NPP_IsInstancePlayingAudio(NPP instance);
NPPVpluginIsPlayingAudio = 4000
</pre>
</pre>


This function returns TRUE if the plugin instance 'instance' is currently playing audio and FALSE if the plugin instance 'instance' is not. This function may only be called when at least one instance of a plugin has been created and not destroyed and 'instance' must be a live plugin instance when called.
This NPPVariable, when set via NPN_SetValue, will signal whether or not an instance is currently playing audio. This is done by assigning a BOOL value to NPN_SetValue's pointer value argument (not by pointing to a BOOL, as one might expect).


== Mute/Unmute a plugin instance ==
== Mute/Unmute a plugin instance ==


<pre>
<pre>
NPError NPP_MuteInstance(NPP instance);
NPNVmuteAudioBool = 4000
NPError NPP_UnmuteInstance(NPP instance);
</pre>
</pre>


These functions mute or unmute (respectively) the plugin instance 'instance'.  These functions may only be called when at least one instance of a plugin has been created and not destroyed and 'instance' must be a live plugin instance when called.
This NPNVariable, when set via NPP_SetValue, will indicate to a plugin whether or not it should mute audio for an instance. This is done by assigning a BOOL value to NPP_SetValue's pointer value argument (not by pointing to a BOOL, as one might expect).
 
= Open issues =
* Should we condense NPP_[Mute|Unmute]Instance into a single function taking a boolean mute/unmute argument?
* Will we want to be able to control the volume level on a per instance basis?

Latest revision as of 23:33, 24 June 2015

Status

Approved

Contributors

  • Last modified: June 24, 2015
  • Authors: Kyle Huey (Mozilla), Benoit Girard (Mozilla)
  • Contributors: Josh Aas (Mozilla)

Use case

The ability to mute/unmute tabs or determine which tabs are playing audio is a commonly requested feature in web browsers. This specification allows browsers to mute/unmute instances of cooperating plugins and determine which instances are playing audio. Browsers can use these APIs to implement per-tab audio control.

Proposed Specification

Determine if an instance is playing audio

NPPVpluginIsPlayingAudio = 4000

This NPPVariable, when set via NPN_SetValue, will signal whether or not an instance is currently playing audio. This is done by assigning a BOOL value to NPN_SetValue's pointer value argument (not by pointing to a BOOL, as one might expect).

Mute/Unmute a plugin instance

NPNVmuteAudioBool = 4000

This NPNVariable, when set via NPP_SetValue, will indicate to a plugin whether or not it should mute audio for an instance. This is done by assigning a BOOL value to NPP_SetValue's pointer value argument (not by pointing to a BOOL, as one might expect).