diff --git a/tools/windows/packaging/uwp/package.appxmanifest.in b/tools/windows/packaging/uwp/package.appxmanifest.in
index c4bf60359b38d..1b4a6191518e6 100644
--- a/tools/windows/packaging/uwp/package.appxmanifest.in
+++ b/tools/windows/packaging/uwp/package.appxmanifest.in
@@ -3,7 +3,8 @@
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
- IgnorableNamespaces="uap mp">
+ xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
+ IgnorableNamespaces="mp uap uap3">
@@ -234,5 +235,6 @@
+
\ No newline at end of file
diff --git a/xbmc/windowing/win10/WinEventsWin10.cpp b/xbmc/windowing/win10/WinEventsWin10.cpp
index 7fd1918b2940e..a90345f0810b5 100644
--- a/xbmc/windowing/win10/WinEventsWin10.cpp
+++ b/xbmc/windowing/win10/WinEventsWin10.cpp
@@ -31,6 +31,7 @@
#include "utils/log.h"
#include "utils/SystemInfo.h"
#include "windowing/windows/WinKeyMap.h"
+#include "xbmc/GUIUserMessages.h"
#include "WinEventsWin10.h"
using namespace PERIPHERALS;
@@ -38,6 +39,7 @@ using namespace KODI::MESSAGING;
using namespace Windows::Devices::Input;
using namespace Windows::Foundation;
using namespace Windows::Graphics::Display;
+using namespace Windows::Media;
using namespace Windows::System;
using namespace Windows::UI::Core;
using namespace Windows::UI::Input;
@@ -134,6 +136,17 @@ void CWinEventsWin10::InitEventHandlers(CoreWindow^ window)
// system
SystemNavigationManager^ sysNavManager = SystemNavigationManager::GetForCurrentView();
sysNavManager->BackRequested += ref new EventHandler(CWinEventsWin10::OnBackRequested);
+ // requirement for backgroup playback
+ m_smtc = SystemMediaTransportControls::GetForCurrentView();
+ if (m_smtc)
+ {
+ m_smtc->IsPlayEnabled = true;
+ m_smtc->IsPauseEnabled = true;
+ m_smtc->IsStopEnabled = true;
+ m_smtc->ButtonPressed += ref new TypedEventHandler
+ (CWinEventsWin10::OnSystemMediaButtonPressed);
+ m_smtc->IsEnabled = true;
+ }
}
void CWinEventsWin10::UpdateWindowSize()
@@ -466,3 +479,45 @@ void CWinEventsWin10::OnBackRequested(Platform::Object^ sender, Windows::UI::Cor
}
args->Handled = true;
}
+
+void CWinEventsWin10::OnSystemMediaButtonPressed(SystemMediaTransportControls^ sender, SystemMediaTransportControlsButtonPressedEventArgs^ args)
+{
+ int action = ACTION_NONE;
+ switch (args->Button)
+ {
+ case SystemMediaTransportControlsButton::ChannelDown:
+ action = ACTION_CHANNEL_DOWN;
+ break;
+ case SystemMediaTransportControlsButton::ChannelUp:
+ action = ACTION_CHANNEL_UP;
+ break;
+ case SystemMediaTransportControlsButton::FastForward:
+ action = ACTION_PLAYER_FORWARD;
+ break;
+ case SystemMediaTransportControlsButton::Rewind:
+ action = ACTION_PLAYER_REWIND;
+ break;
+ case SystemMediaTransportControlsButton::Next:
+ action = ACTION_NEXT_ITEM;
+ break;
+ case SystemMediaTransportControlsButton::Previous:
+ action = ACTION_PREV_ITEM;
+ break;
+ case SystemMediaTransportControlsButton::Pause:
+ case SystemMediaTransportControlsButton::Play:
+ action = ACTION_PLAYER_PLAYPAUSE;
+ break;
+ case SystemMediaTransportControlsButton::Stop:
+ action = ACTION_STOP;
+ break;
+ case SystemMediaTransportControlsButton::Record:
+ action = ACTION_RECORD;
+ break;
+ default:
+ break;
+ }
+ if (action != ACTION_NONE)
+ {
+ CApplicationMessenger::GetInstance().PostMsg(TMSG_GUI_ACTION, WINDOW_INVALID, -1, static_cast(new CAction(action)));
+ }
+}
diff --git a/xbmc/windowing/win10/WinEventsWin10.h b/xbmc/windowing/win10/WinEventsWin10.h
index ec08d97cbb455..5c7d38c3cca01 100644
--- a/xbmc/windowing/win10/WinEventsWin10.h
+++ b/xbmc/windowing/win10/WinEventsWin10.h
@@ -57,11 +57,14 @@ class CWinEventsWin10 : public IWinEvents
static void OnDisplayContentsInvalidated(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args);
// system
static void OnBackRequested(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args);
+ // system media handlers
+ static void OnSystemMediaButtonPressed(Windows::Media::SystemMediaTransportControls^, Windows::Media::SystemMediaTransportControlsButtonPressedEventArgs^);
private:
void UpdateWindowSize();
void Kodi_KeyEvent(unsigned int vkey, unsigned scancode, unsigned keycode, bool isDown);
Concurrency::concurrent_queue m_events;
+ Windows::Media::SystemMediaTransportControls^ m_smtc{ nullptr };
};
#endif // WINDOW_EVENTS_WIN10_H