PiP initial commit

This commit is contained in:
wuggy 2026-09-13 10:51:36 -07:00
commit 9a1d4edaa9
14 changed files with 377 additions and 1 deletions

View file

@ -5183,6 +5183,15 @@ bool HTMLMediaElement::IsActive() const
return ownerDoc && ownerDoc->IsActive() && ownerDoc->IsVisible();
}
void HTMLMediaElement::SetMozPictureInPicture(bool aEnabled)
{
MOZ_ASSERT(NS_IsMainThread());
mPictureInPicture = aEnabled;
if (mDecoder && !mDecoder->IsShutdown()) {
mDecoder->NotifyOwnerActivityChanged(!IsHidden());
}
}
bool HTMLMediaElement::IsHidden() const
{
nsIDocument* ownerDoc;

View file

@ -211,6 +211,9 @@ public:
virtual bool IsHidden() const final override;
bool MozPictureInPicture() const { return mPictureInPicture; }
void SetMozPictureInPicture(bool aEnabled);
// Called by the media decoder and the video frame to get the
// ImageContainer containing the video data.
virtual VideoFrameContainer* GetVideoFrameContainer() final override;
@ -1622,6 +1625,9 @@ protected:
// Info about the played media.
MediaInfo mMediaInfo;
// Set only by privileged Picture-in-Picture UI; cleared when it closes.
bool mPictureInPicture = false;
// True if the media has encryption information.
bool mIsEncrypted;