mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-20 23:37:33 +09:00
PiP initial commit
This commit is contained in:
parent
5ec3ae4a4c
commit
9a1d4edaa9
14 changed files with 377 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1250,7 +1250,11 @@ MediaDecoder::SetElementVisibility(bool aIsVisible)
|
|||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
mElementVisible = aIsVisible;
|
||||
mIsVisible = !mForcedHidden && mElementVisible;
|
||||
// A floating player remains visible when its source tab is in the
|
||||
// background or the original video is scrolled out of view.
|
||||
HTMLMediaElement* element = mOwner ? mOwner->GetMediaElement() : nullptr;
|
||||
mIsVisible = (element && element->MozPictureInPicture()) ||
|
||||
(!mForcedHidden && mElementVisible);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ partial interface HTMLVideoElement {
|
|||
// True if the video has an audio track available.
|
||||
readonly attribute boolean mozHasAudio;
|
||||
|
||||
// Browser UI only: keep the source decoder active for a floating player.
|
||||
[ChromeOnly]
|
||||
attribute boolean mozPictureInPicture;
|
||||
|
||||
// True if the video should use a screen wake lock.
|
||||
[Pref="dom.wakelock.enabled", Func="Navigator::HasWakeLockSupport"]
|
||||
attribute boolean mozUseScreenWakeLock;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue