Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions osdep/win32/smtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ static void handle_mp_event(smtc_ctx *ctx, mpv_event *event)
auto &prop = *static_cast<mpv_event_property *>(event->data);
if (!strcmp(prop.name, "time-pos") || !strcmp(prop.name, "duration"))
return;
if (!strcmp(prop.name, "media-controls")) {
mp_assert(prop.format == MPV_FORMAT_FLAG);
ctx->smtc.IsEnabled(*static_cast<int *>(prop.data));
return;
}
}
update_metadata(ctx->smtc, *ctx);
} catch (const winrt::hresult_error& e) {
Expand Down Expand Up @@ -394,8 +399,6 @@ static MP_THREAD_VOID win_event_loop_fn(void *arg)
winrt::throw_hresult(hr);
SetWindowLongPtrW(ctx.hwnd, GWLP_USERDATA, LONG_PTR(&ctx));

smtc.IsEnabled(true);

smtc.ButtonPressed([&](const SystemMediaTransportControls &,
const SystemMediaTransportControlsButtonPressedEventArgs &args) {
switch (args.Button()) {
Expand Down Expand Up @@ -506,6 +509,7 @@ static MP_THREAD_VOID mpv_event_loop_fn(void *arg)
mpv_observe_property(mpv, 0, "current-tracks", MPV_FORMAT_NODE_MAP);
mpv_observe_property(mpv, 0, "duration", MPV_FORMAT_INT64);
mpv_observe_property(mpv, 0, "idle-active", MPV_FORMAT_FLAG);
mpv_observe_property(mpv, 0, "media-controls", MPV_FORMAT_FLAG);
mpv_observe_property(mpv, 0, "media-title", MPV_FORMAT_STRING);
mpv_observe_property(mpv, 0, "metadata", MPV_FORMAT_NODE_MAP);
mpv_observe_property(mpv, 0, "pause", MPV_FORMAT_FLAG);
Expand Down
3 changes: 1 addition & 2 deletions player/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,7 @@ int mp_initialize(struct MPContext *mpctx, char **options)
#endif

#if HAVE_WIN32_SMTC
if (opts->media_controls)
mp_smtc_init(mp_new_client(mpctx->clients, "SystemMediaTransportControls"));
mp_smtc_init(mp_new_client(mpctx->clients, "SystemMediaTransportControls"));
#endif

mp_dnd_init(mp_new_client(mpctx->clients, "dnd"));
Expand Down
Loading