This patch will do :
- play media from different frame, rather than alway playing media from the main frame
The advantage of doing so :
- to make the media session in child frame become the active media session because that can only be the context with the audio focus
Differential Revision: https://phabricator.services.mozilla.com/D72500
This patch will do :
- remove out-of-date test that uses the previous implementation of determining the active media session
The advantage of doing so :
- prevent the failure causing by out-of-date test
Differential Revision: https://phabricator.services.mozilla.com/D72499
This patch will do :
- play media from different frame, rather than alway playing media from the main frame
The advantage of doing so :
- to make the media session in child frame become the active media session because that can only be the context with the audio focus
Differential Revision: https://phabricator.services.mozilla.com/D72500
This patch will do :
- remove out-of-date test that uses the previous implementation of determining the active media session
The advantage of doing so :
- prevent the failure causing by out-of-date test
Differential Revision: https://phabricator.services.mozilla.com/D72499
This patch will do :
- play media from different frame, rather than alway playing media from the main frame
The advantage of doing so :
- to make the media session in child frame become the active media session because that can only be the context with the audio focus
Differential Revision: https://phabricator.services.mozilla.com/D72500
This patch will do :
- remove out-of-date test that uses the previous implementation of determining the active media session
The advantage of doing so :
- prevent the failure causing by out-of-date test
Differential Revision: https://phabricator.services.mozilla.com/D72499
This patch will do :
- rename `MediaSessionController` to `MediaStatusManager`
- move `MediaStatusManager.*` to the folder under `mediacontrol`
- update the comment for `MediaStatusManager`
The advantage of doing so :
- increase the readability
More details :
We've extended the responsibility of `MediaSessionController` and it now handle a broader concept of media related status, not just media session related. Therefore, renaming it to precisely represent o its responsibility.
Differential Revision: https://phabricator.services.mozilla.com/D73493
This patch will do :
- rename variables and remove unnecessary spaces
The advantage of doing so :
- increase the readability
Differential Revision: https://phabricator.services.mozilla.com/D73491
This patch will do :
- create an interface `IMediaController` including only control related methods
The advantage of doing so :
- It's clear to use `IMediaController` as the only surface to control media
- explictly restrict which functions are available which can avoid using control related functions on those situations
Differential Revision: https://phabricator.services.mozilla.com/D73490
This patch will do :
- make all functions which are used to update information from the content process become a part of `IMediaInfoUpdater`
The advantage of doing so :
- It's clear to use `IMediaInfoUpdater` as the only surface to update the media related status
- explictly restrict which functions are available which can avoid using control related functions on those situations
Differential Revision: https://phabricator.services.mozilla.com/D73489
This patch will do :
- move the logic of determining `actual playback state` to `MediaSessionController`
The advantage of doing so :
- increate the cohesion of `MediaSessionController` because it should be the class to determine the final playback status, not `MediaController`
Differential Revision: https://phabricator.services.mozilla.com/D73488
This patch will do :
- move the instance of `MediaPlaybackStatus` to the `MediaSessionController` to allow `MediaSessionController` handle all media related status
The advantage of doing so :
- encapsulate all media related status details to `MediaSessionController` and simplify the code in `MediaController`
Differential Revision: https://phabricator.services.mozilla.com/D73487
This patch will do :
- add tag `mediacontrol` in media control related `ini` files.
The advantage of doing so :
- to run all tests in one simple command, `$./mach mochitest --tag mediacontrol`
Differential Revision: https://phabricator.services.mozilla.com/D72959
One possible place where `SetDeclaredPlaybackState()` would be called without having a info is that, media session changes its declared playback state after CC unlink process that would result in removing correspond `MediaSessionInfo` from the `mMediaSessionInfoMap`.
Therefore, replace the assertion with an early return check.
Differential Revision: https://phabricator.services.mozilla.com/D71854
When we clear the main controller, which means there is no any media we need to control at that time, we would reset its playback state, but we should clear its metadata as well.
Differential Revision: https://phabricator.services.mozilla.com/D71428
A declare of a pointer in the init-statement within if need to be
checked if it's a NULL before it's being used, to avoid a potential
crash.
To prevent any goes wrong in mMediaSessionInfoMap and lead to create a
null BrowsingContext pointer from it, using an assertion is more
straightforward.
Differential Revision: https://phabricator.services.mozilla.com/D66491
--HG--
extra : moz-landing-system : lando
This patch includes the implementation of propagating declared playback state from the media session in the content process to the media session controller in the chrome process.
Differential Revision: https://phabricator.services.mozilla.com/D66341
--HG--
extra : moz-landing-system : lando
As we would need to preserve media session's playback state as well, we create a new struture to store each media session's propagated properties.
Differential Revision: https://phabricator.services.mozilla.com/D66340
--HG--
extra : moz-landing-system : lando
We don't want to show empty information on the virtual control interface when media session's title and artwork are empty or doesn't be set properly. Therefore, in this situation, we should use default title and favicon icon instead.
Differential Revision: https://phabricator.services.mozilla.com/D65656
--HG--
extra : moz-landing-system : lando
We would use the default title in other places in the future, so make it as a separate function to re-use those code.
Differential Revision: https://phabricator.services.mozilla.com/D65655
--HG--
extra : moz-landing-system : lando
Callers should pass in UTF-8, since that's what the JS engine ends up with in the end anyway.
The various URL changes are because NS_NewURI converts incoming nsAString to
UTF-8 anyway. So we might as well do that up-front and then use the UTF-8
string for both the NS_NewURI call and the error-reporting if it fails.
Differential Revision: https://phabricator.services.mozilla.com/D65543
--HG--
extra : moz-landing-system : lando
Whenever pressing the media control keys, it would not only change the media playback state, but also change the playback state of the media controller. Therefore, we want to ensure simulating events always happen after media controller changes its playback state.
In addition, for `play/pause` key, it would check controller's playback state to decide if we should file `play` event or `pause` event, so we definitely have to do that only after the controller changes its playback state.
Changing a file to non-autoplay to prevent missing the `main-media-controller-playback-changed` notification, because we can control when to start media and ensure we have already create a listener for that event.
For non-browser test, we have no way to listen to that notification, which could only be observed in the chrome process, so we do a hack to listen `timeupdate` several times to wait and hope the controller has been created and changed its state in the chrome process.
Differential Revision: https://phabricator.services.mozilla.com/D63926
--HG--
extra : moz-landing-system : lando
Whenever the main controller updates its metadata, we should also notify the event source to update the metadata, because we don't want to show the wrong metadata on the virtual control interface.
In this patch, we add a new media event to notify this situation and create a new method `SetMediaMetadata()` on the `MediaControlKeysEventSource`. But we leave that function empty for now, and will have follow-up bugs to handle setting metadata on each different platforms.
Differential Revision: https://phabricator.services.mozilla.com/D64847
--HG--
extra : moz-landing-system : lando
Whenever media session's metadata changes in the content process, we would like to propogate the updated metadata to the media controller in the parent process in order to show that in the virtual media control interface, which would only be set in the chrome process.
Differential Revision: https://phabricator.services.mozilla.com/D64846
--HG--
extra : moz-landing-system : lando
`emplace` can only be used on an empty `Maybe`, but in our case, we can update the metadata anytime even if we have set the metadata before, so using `Put()` to directly update `Maybe`'s value.
Differential Revision: https://phabricator.services.mozilla.com/D64845
--HG--
extra : moz-landing-system : lando
If new coming metadata is `null` (when setting `MediaSession.metadata=null`) or an empty metadata [1], then we would like to reset the `Maybe` in `MediaSessionController` in order to use the default metadata when someone asks for the current metadata.
[1] https://w3c.github.io/mediasession/#empty-metadata
Differential Revision: https://phabricator.services.mozilla.com/D64844
--HG--
extra : moz-landing-system : lando
Metadata is used to be showed on the virtual controller interface during media is playing, which website can set from MediaSession API.
However, if website doesn't use media session, or the media session website uses doesn't have metadata, then we would like to generate a default one to tell user what website is playing media. If we're in private browsing mode, then we should not expose any website information in the default metadata.
Differential Revision: https://phabricator.services.mozilla.com/D62536
--HG--
extra : moz-landing-system : lando
As we would like to use `mTopLevelBCId` in `MediaSessionController` as well in order to get the corresponding browsing context, so move `mTopLevelBCId` to the `MediaSessionController`.
Differential Revision: https://phabricator.services.mozilla.com/D62535
--HG--
extra : moz-landing-system : lando
This test is for checking if we can select correct media session as an active media session within a tab.
Differential Revision: https://phabricator.services.mozilla.com/D61045
--HG--
extra : moz-landing-system : lando
This test is for checking if we can trigger media session's action handler via media control keys.
Differential Revision: https://phabricator.services.mozilla.com/D60938
--HG--
extra : moz-landing-system : lando