Bug 1480484 - add telemetry scalar to measure the count for blocked media element without audio track. r=cpearce,francois
This is used to count the potiential number of the blocked autoplay media element without audio track even if user was enable autoplay. It might happen on three cases, 1. play -> loadedmetadata 2. loadedmetadata -> play 3. loadedmetadata -> has 'autoplay' keyword In first case we need to check whether the play invocation has been called, and check other other cases before the media starts playing. In addition, the scalar name isn't consist with other names is because of the 40 maximum limitation of the ping name. MozReview-Commit-ID: 6Qm6TD4ME8I
This commit is contained in:
@@ -4033,6 +4033,9 @@ HTMLMediaElement::UpdateHadAudibleAutoplayState() const
|
||||
if (AutoplayPolicy::WouldBeAllowedToPlayIfAutoplayDisabled(*this)) {
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_AUTOPLAY_WOULD_BE_ALLOWED_COUNT, 1);
|
||||
} else {
|
||||
if (mReadyState >= HAVE_METADATA && !HasAudio()) {
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_BLOCKED_AUTOPLAY_NO_AUDIO_TRACK_COUNT, 1);
|
||||
}
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_AUTOPLAY_WOULD_NOT_BE_ALLOWED_COUNT, 1);
|
||||
}
|
||||
}
|
||||
@@ -5503,6 +5506,13 @@ HTMLMediaElement::MetadataLoaded(const MediaInfo* aInfo,
|
||||
mMediaInfo.mVideo.mDisplay.height > 0),
|
||||
"Video resolution must be known on 'loadedmetadata'");
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("loadedmetadata"));
|
||||
// The play invocation which was call by script had happened before media
|
||||
// element loaded metadata.
|
||||
if ((!mPaused && OwnerDoc() && !OwnerDoc()->HasBeenUserGestureActivated()) &&
|
||||
!HasAudio() &&
|
||||
(Volume() != 0 && !Muted())) {
|
||||
ScalarAdd(Telemetry::ScalarID::MEDIA_BLOCKED_AUTOPLAY_NO_AUDIO_TRACK_COUNT, 1);
|
||||
}
|
||||
if (mDecoder && mDecoder->IsTransportSeekable() &&
|
||||
mDecoder->IsMediaSeekable()) {
|
||||
ProcessMediaFragmentURI();
|
||||
|
||||
Reference in New Issue
Block a user