From 298c998973d6708d983105816f80188edd9dd94c Mon Sep 17 00:00:00 2001
From: Jianjun Zhu
+ A user agent MUST invoke {{MediaSessionActionHandler}} for + {{MediaSessionAction/voiceactivity}} only when the voice activity is + detected from a source with one or more live {{MediaStreamTrack}}s. A user + agent MAY ignore a {{MediaSessionAction/voiceactivity}} action if all + {{MediaStreamTrack}}s associated with the source are not + {{MediaStreamTrack/muted}}. It is RECOMMENDED for user agents to set a + minimal interval for invoking {{MediaSessionActionHandler}} for + {{MediaSessionAction/voiceactivity}} based on privacy and power efficiency + policies. +
+ // Create a MediaStream with audio enabled. + const stream = await navigator.mediaDevices.getUserMedia({audio:true}); + const track = stream.getAudioTracks()[0]; + navigator.mediaSession.setActionHandler("voiceactivity", function() { + if (track.muted) { + // Show unmute notification. + } + }); ++
- A user agent MUST invoke {{MediaSessionActionHandler}} for - {{MediaSessionAction/voiceactivity}} only when the voice activity is - detected from a microphone with one or more live {{MediaStreamTrack}}s. A - user agent MAY ignore a {{MediaSessionAction/voiceactivity}} action if all + A user agent MUST invoke the {{MediaSessionActionHandler}} for + {{MediaSessionAction/voiceactivity}} only when voice activity is detected + from a microphone with one or more live {{MediaStreamTrack}}s. A user + agent MAY ignore a {{MediaSessionAction/voiceactivity}} action if all {{MediaStreamTrack}}s associated with the source are not {{MediaStreamTrack/muted}}. It is RECOMMENDED for user agents to set a minimal interval for invoking {{MediaSessionActionHandler}} for @@ -558,6 +558,19 @@ platform UI or media keys, thereby improving the user experience. policies.
++ {{MediaSessionAction/voiceactivity}} only indicates the start of a voice + activity. Application may display a notification if the user is speaking + while the {{MediaStreamTrack}} is muted, or start an {{AudioWorklet}} for + audio processing. No action is defined for the end of a voice activity. + Unlike other actions which are explicitely triggered by the user, + {{MediaSessionAction/voiceactivity}} also depends on the voice activity + detection algorithm of the user agent or the system. For privacy and power + efficiency concern, web page may not be notified if the second voice + activity started soon after last {{MediaSessionAction/voiceactivity}} + action. +
+
A page should only register a {{MediaSessionActionHandler}} for a media
session action when it can handle the action given that the user agent
From 6b22a34e75a3dfe2fa37a48ae288ccb92e51aad1 Mon Sep 17 00:00:00 2001
From: Jianjun Zhu
- {{MediaSessionAction/voiceactivity}} only indicates the start of a voice - activity. Application may display a notification if the user is speaking + {{MediaSessionAction/voiceactivity}} only indicates the start of voice + activity. Applications may display a notification if the user is speaking while the {{MediaStreamTrack}} is muted, or start an {{AudioWorklet}} for - audio processing. No action is defined for the end of a voice activity. - Unlike other actions which are explicitely triggered by the user, + audio processing. No action is defined for the end of voice activity. + Unlike other actions which are explicitly triggered by the user, {{MediaSessionAction/voiceactivity}} also depends on the voice activity detection algorithm of the user agent or the system. For privacy and power - efficiency concern, web page may not be notified if the second voice - activity started soon after last {{MediaSessionAction/voiceactivity}} + efficiency concerns, the web page may not be notified if voice activity + ends and restarts soon after the last {{MediaSessionAction/voiceactivity}} action.
From f7ebd3daa613777accc22a2da03d509254fbd313 Mon Sep 17 00:00:00 2001 From: Jianjun Zhu
From be55bde86158db0fd1daf243aeeb4b2813be87a1 Mon Sep 17 00:00:00 2001
From: Jianjun Zhu
- A user agent MUST invoke the {{MediaSessionActionHandler}} for - {{MediaSessionAction/voiceactivity}} only when voice activity is detected - from a microphone with one or more live {{MediaStreamTrack}}s. A user - agent MAY ignore a {{MediaSessionAction/voiceactivity}} action if - microphone is not muted and all {{MediaStreamTrack}}s associated with the - source are {{MediaStreamTrack/enabled}}. It is RECOMMENDED for user agents - to set a minimal interval between invocations of the + The {{MediaSessionAction/voiceactivity}} action source MUST always have a + target whose document MUST always have {{MediaStreamTrackState/live}} + microphone {{MediaStreamTrack}}s. A user agent MUST invoke the {{MediaSessionActionHandler}} for {{MediaSessionAction/voiceactivity}} - based on privacy and power efficiency policies. + only when voice activity is detected from a microphone with one or more + {{MediaStreamTrackState/live}} {{MediaStreamTrack}}s. A user agent MAY + ignore voice activity if the microphone is not muted and all + {{MediaStreamTrack}}s associated with the microphone are + {{MediaStreamTrack/enabled}}. It is RECOMMENDED for user agents to set a + minimal interval between invocations of the {{MediaSessionActionHandler}} + for {{MediaSessionAction/voiceactivity}} based on privacy and power + efficiency policies.