When media element is inactive, asking MDSM to seek is actually useless, because all the data we decode won't be showed to user. In addition, we have to store extra pending events for `seeking` and `seeked`, which might result in memory overflow if the inactive page is calling `seek()` all the time.
Therfore, we should delay all seeking tasks while media is inactive, and perform the latest seeking task when media becomes active.
Differential Revision: https://phabricator.services.mozilla.com/D58918
--HG--
extra : moz-landing-system : lando
We should only use valid time to construct a `SeekTarget`, because we can't get the value from the invalid time.
This can help us to prevent having a crash when request data value from an invalid time.
Differential Revision: https://phabricator.services.mozilla.com/D28564
--HG--
extra : moz-landing-system : lando
Note it is fine to always assume MediaDecoderEventVisibility::Observable in SeekJob::Resolve()
because no one will wait for the promise of internal seeks (where EventVisibility::Suppressed is passed).
MozReview-Commit-ID: Dx7AF5VhLmL
--HG--
extra : rebase_source : 517669ed4f10a136b8a2f8eafd76f26f4ad5d8e4
extra : source : 57cdd8d14c59a2f1f0eed0635814de661127ad70
Implemented by short-circuiting calls to RequestVideoData in MDSM so no
frames are decoded. Resuming playback when video moves to foreground by
using the SeekTask/SeekJob/Seek in MDSM with result of GetMediaTime().
Special consideration is made to only seek the video part of Seek() to
remove an audible glitch in the audio playback when the video becomes
visible again.
MozReview-Commit-ID: 7YFDTanslXu