mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Introduce CMediaSessionPlaybackState and CMediaSessionActionType
This commit is contained in:
parent
d5200ba453
commit
b01e3fdc7e
10 changed files with 71 additions and 41 deletions
|
@ -7,7 +7,6 @@
|
|||
#include "BrowserPage.h"
|
||||
#include "BrowserPage.g.cpp"
|
||||
#include "DefaultUrl.h"
|
||||
#include "MediaSession.h"
|
||||
|
||||
using namespace std::placeholders;
|
||||
using namespace winrt::Windows::Foundation;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
namespace winrt::servo {
|
||||
enum PlaybackState {
|
||||
NONE = 1,
|
||||
PLAYING,
|
||||
PAUSED
|
||||
};
|
||||
|
||||
enum MediaSessionAction {
|
||||
PLAY = 1,
|
||||
PAUSE,
|
||||
SEEK_BACKWARD,
|
||||
SEEK_FORWARD,
|
||||
PREVIOUS_TRACK,
|
||||
NEXT_TRACK,
|
||||
SKIP_AD,
|
||||
STOP,
|
||||
SEEK_TO
|
||||
};
|
||||
}
|
|
@ -122,7 +122,6 @@
|
|||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="logs.h" />
|
||||
<ClInclude Include="MediaSession.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
<ClInclude Include="App.h">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
|
|
|
@ -40,9 +40,6 @@
|
|||
</ClInclude>
|
||||
<ClInclude Include="DefaultUrl.h" />
|
||||
<ClInclude Include="XRPkgChecker.h" />
|
||||
<ClInclude Include="MediaSession.h">
|
||||
<Filter>ServoControl</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Assets\Wide310x150Logo.scale-200.png">
|
||||
|
|
|
@ -62,7 +62,8 @@ void on_media_session_metadata(const char *title, const char *album,
|
|||
char2hstring(title), char2hstring(album), char2hstring(artist));
|
||||
}
|
||||
|
||||
void on_media_session_playback_state_change(const int state) {
|
||||
void on_media_session_playback_state_change(
|
||||
const capi::CMediaSessionPlaybackState state) {
|
||||
return sServo->Delegate().OnServoMediaSessionPlaybackStateChange(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
ServoDelegate &Delegate() { return mDelegate; }
|
||||
|
||||
typedef capi::CMouseButton MouseButton;
|
||||
typedef capi::CMediaSessionActionType MediaSessionActionType;
|
||||
typedef capi::CMediaSessionPlaybackState MediaSessionPlaybackState;
|
||||
|
||||
void PerformUpdates() { capi::perform_updates(); }
|
||||
void DeInit() { capi::deinit(); }
|
||||
|
@ -88,7 +90,7 @@ public:
|
|||
capi::resize(mWindowWidth, mWindowHeight);
|
||||
}
|
||||
}
|
||||
void SendMediaSessionAction(int32_t action) {
|
||||
void SendMediaSessionAction(capi::CMediaSessionActionType action) {
|
||||
capi::media_session_action(action);
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,10 @@ hstring ServoControl::LoadURIOrSearch(hstring input) {
|
|||
}
|
||||
|
||||
void ServoControl::SendMediaSessionAction(int32_t action) {
|
||||
RunOnGLThread([=] { mServo->SendMediaSessionAction(action); });
|
||||
RunOnGLThread([=] {
|
||||
mServo->SendMediaSessionAction(
|
||||
static_cast<Servo::MediaSessionActionType>(action));
|
||||
});
|
||||
}
|
||||
|
||||
void ServoControl::TryLoadUri(hstring input) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "OpenGLES.h"
|
||||
#include "Servo.h"
|
||||
#include "DefaultUrl.h"
|
||||
#include "MediaSession.h"
|
||||
|
||||
namespace winrt::ServoApp::implementation {
|
||||
struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue