Bug 1476701 - notify observer when audible autoplay occurred. r=cpearce,jaws
In our autoplay shield-study, we want to collect the information which could tell us how many website
contains audible autoplay media, but there is no way to get this information on current API desigin.
Therefore, I would like to send a new notification when autoplay occurred.
The extension code could get the information by following way,
```
Services.obs.addObserver((subject, topic, data) => {
// DO SOMETHING
}, "AudibleAutoplayMediaOccurred");
```
MozReview-Commit-ID: 4bSYcxDZOGK
This commit is contained in:
@@ -4013,7 +4013,7 @@ HTMLMediaElement::AudioChannelAgentDelayingPlayback()
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::ReportAutoplayTelemetry() const
|
||||
HTMLMediaElement::UpdateHadAudibleAutoplayState() const
|
||||
{
|
||||
// If we're audible, and autoplaying...
|
||||
if ((Volume() > 0.0 && !Muted()) &&
|
||||
@@ -4086,7 +4086,7 @@ HTMLMediaElement::Play(ErrorResult& aRv)
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
ReportAutoplayTelemetry();
|
||||
UpdateHadAudibleAutoplayState();
|
||||
|
||||
const bool handlingUserInput = EventStateManager::IsHandlingUserInput();
|
||||
switch (AutoplayPolicy::IsAllowedToPlay(*this)) {
|
||||
@@ -6246,7 +6246,7 @@ HTMLMediaElement::CheckAutoplayDataReady()
|
||||
return;
|
||||
}
|
||||
|
||||
ReportAutoplayTelemetry();
|
||||
UpdateHadAudibleAutoplayState();
|
||||
switch (AutoplayPolicy::IsAllowedToPlay(*this)) {
|
||||
case nsIAutoplay::BLOCKED:
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user