The `ToMediaControlKeyStr` can be replaced by `GetEnumString` since
`GetEnumString` is able to access the enum mapping strings of the
`MediaControlKey` generated by the dom binding in
`EnumStrings<MediaControlKey>::Values`
Differential Revision: https://phabricator.services.mozilla.com/D205006
The `ToMediaControlKeyStr` can be replaced by `GetEnumString` since
`GetEnumString` is able to access the enum mapping strings of the
`MediaControlKey` generated by the dom binding in
`EnumStrings<MediaControlKey>::Values`
Differential Revision: https://phabricator.services.mozilla.com/D205006
The Album Artist field when talking about musical metadata is the
artist under which a particular release is classified under. Artist is
the people that are on a specific track, including thing like featurings, etc.
Here we only want to set Artist (the most generic item). Album Artist
overrides artist, and has nothing to do with the album name.
Windows doesn't have an API or a location in the UI to display the album
name.
Differential Revision: https://phabricator.services.mozilla.com/D145339
In order to only call `EnableControl()` twice, once in in `Open()` and another one in `Close()`, so reduce other necessary call of `EnableControl()`.
Differential Revision: https://phabricator.services.mozilla.com/D92118
When close the event source, it should be responsible to clear up and reset the virtual control interface, rather than doing so by `Media Control Server` via setting some empty results.
Differential Revision: https://phabricator.services.mozilla.com/D92116
In order to only call `EnableControl()` twice, once in in `Open()` and another one in `Close()`, so reduce other necessary call of `EnableControl()`.
Differential Revision: https://phabricator.services.mozilla.com/D92118
When close the event source, it should be responsible to clear up and reset the virtual control interface, rather than doing so by `Media Control Server` via setting some empty results.
Differential Revision: https://phabricator.services.mozilla.com/D92116
The SMTC-thumbnail-update task is dispatched to main-thread from the
on-complete callback of the async image storing operation. However, the
callback is actually on the main-thread itself so the
thumbnail-update-task can be executed in that callback directly instead
of being dispatched. The task should be finished slightly faster if the
task dispatch is replaced by executing the task.
Differential Revision: https://phabricator.services.mozilla.com/D90331
The duplicated util helpers between WindowsSMTCProvider and
MPRISServiceHandler could be merged and moved to MediaControlUtils
Differential Revision: https://phabricator.services.mozilla.com/D82806
Suppose the current artwork is <img A, img B, img C> and Firefox is
currently fetching img B, whose index is 1 in the artwork. If the
artwork is updated to <img D, img B> before img B is fetched, then
Firefox will skip fetching a new image since img B is also an acceptable
choice in the new artwork. However, if Firefox fails to fetch img B, in
the current implementation, a new image at (previous index + 1) would be
fetched, as a fallback plan. In the above case, the index is 2, which is
out of the bound of the new artwork.
Instead of caching the previous index of an image in the artwork and
using the the previous index plus 1 as the index of the next available
image, the index of the next available image should be reset every time
when artwork is updated
Differential Revision: https://phabricator.services.mozilla.com/D81960
`mThumbnailUrl` is always reset after `ClearThubnamil` or `SetThumbnail`
is called. Setting `mThumbnailUrl` in these functions makes sure it
always has the correct value.
Differential Revision: https://phabricator.services.mozilla.com/D81572
`RefreshDisplay` always comes after `SetMusicMetadata`, `SetThumbnail`,
or `ClearThumbnail`. Merging the `RefreshDisplay` into these functions
makes sure the the code in `RefreshDisplay` and those functions will be
executed together.
Differential Revision: https://phabricator.services.mozilla.com/D81571
The current image cache mechanism fails in the following example:
Suppose the artwork for track 1, 2 are <img A, img B> and <img C, img A>
respectively. If the initial metadata in a media session is for track 1
and the current active image is img A, when switching the metadata of
the media session from track 1 to 2, the image will be reset to img C in
the current implementation. However, there is no need to update the
active image since img A is also an acceptable choice for track 2.
This patch reduce the image reset for above case. The image will only be
updated if the request one is different from the one in use.
Differential Revision: https://phabricator.services.mozilla.com/D80524
This patch does the following things:
1. Use `FetchImageHelper` to fetch the MediaImage defined in
media-session
2. Upon the above image is fetched, set it to the SMTC's thumbnail
Differential Revision: https://phabricator.services.mozilla.com/D77893
- Group related functions together
- Sync the function order in .cpp and .h (except destructor)
- Rename `Update` to `RefreshDisplay`
Differential Revision: https://phabricator.services.mozilla.com/D77888
By assert mConrols instread of mInitialized in SetControlAttributes, we
no longer need to call SetControlAttributes after setting mInitialized
to true. Also, this patch change the timing to set mInitialized to true
so we can call SetControlAttributes before RegisterEvent. By doing so,
we no longer need to call UnregisterEvents when SetControlAttributes
fails.
Differential Revision: https://phabricator.services.mozilla.com/D77885
- Add error messages so it's easier to debug when the error occurs
- It's better to unregister the event listener if failed to open SMTP.
(In release, the key-event listener may be alive when the SMTP isn't
initialized successfully)
Differential Revision: https://phabricator.services.mozilla.com/D77884
`HStringRefernece` must be constructed with a non-null `wchar_t*`. The
raw pointer returned from `nsString::get()` is a non-null address so
it's ok to add an assertion in `SetMusicMetadata`.
Differential Revision: https://phabricator.services.mozilla.com/D77881
This patch will
- remove `MediaControlKeysEvent` and use `MediaControlKey` to replace it
- rename names for all `MediaControlKey` related methods, functions, classes and descriptions
The advantage of doing so are
- remove the duplicated type so that we only need to maintain `MediaControlKey`
Differential Revision: https://phabricator.services.mozilla.com/D78140
`PlaybackState` and `MediaSessionPlaybackState` are actually quite similar, and we don't want to have to many states to confuse reader and do unnecessary tranform between two states. Therefore, replaceing `PlaybackState` with `MediaSessionPlaybackState`.
Differential Revision: https://phabricator.services.mozilla.com/D66342