Closed beaufortfrancois closed 1 year ago
I think was set most recently would benefit from a clear definition. Happy to have this dealt with in a follow-up though.
@mounirlamouri How were you thinking about explaining "was set most recently" in the spec? For info, here's what we currently do in Chromium to track this.
void PictureInPictureControllerImpl::AddToAutoPictureInPictureElementsList(
HTMLVideoElement* element) {
RemoveFromAutoPictureInPictureElementsList(element);
auto_picture_in_picture_elements_.push_back(element);
}
void PictureInPictureControllerImpl::RemoveFromAutoPictureInPictureElementsList(
HTMLVideoElement* element) {
DCHECK(element);
auto it = std::find(auto_picture_in_picture_elements_.begin(),
auto_picture_in_picture_elements_.end(), element);
if (it != auto_picture_in_picture_elements_.end())
auto_picture_in_picture_elements_.erase(it);
}
HTMLVideoElement* PictureInPictureControllerImpl::AutoPictureInPictureElement()
const {
return auto_picture_in_picture_elements_.IsEmpty()
? nullptr
: auto_picture_in_picture_elements_.back();
}
We could specify exactly what's above. The document has a list of auto-pip element. When an element is inserted to the document or has auto-pip added to it, it is pushed into that list. When removed from the document or the attribute is removed, it is removed from the list.
Then, the "most recently" becomes the top of the list.
Thanks! Here's the PR: https://github.com/w3c/picture-in-picture/pull/190
@jernoble Do you have plans to implement Auto Picture-in-Picture in Safari?
@beaufortfrancois We don't plan to implement it in Safari.
Closing all v2 labels issues as this is replaced by the dedicated WICG Document Picture-in-Picture API proposal.
In https://github.com/WICG/picture-in-picture/pull/112/files#r249006604, it was agreed to provide a clear definiton of
autoPictureInPictureElement
.