Play/Pause video playing inside Movies & TV

Marcel Lorenz 86 Reputation points
2020-12-19T09:47:19.07+00:00

Is it possible to programmatically (C# preferred but C++ also ok) play/pause a video played by Movies & TV and also get other information about the playback, like Title, ...?

I know only two ways and both have a huge problem.

  1. Play/Pause by sending virtual keys (VK_MEDIA_PLAY_PAUSE 0xB3). But it has the same problem as Method 2.
  2. Set PlaybackState of a GlobalSystemMediaTransportControlsSession using C#.

Both depend on media sessions. Method 1 plays/pauses the current session. Method 2 plays/pauses a specific session. But if I pause and minimize Movies & TV, after about 10 seconds the session is closed and neither Method 1 or 2 works.

So is there a method to check if Movies & TV currently plays something and if so to play/pause the playback?

Session Closes Problem:

49672-ezgif-6-10060e455c20.gif

Developer technologies | Windows Forms
Developer technologies | C#
{count} votes

Accepted answer
  1. Timon Yang-MSFT 9,606 Reputation points
    2020-12-22T07:58:17.763+00:00

    I found the cause of this problem. The system thought that you would not use Movies & TV for the time being, and thus suspended it. You can see its status in Task Manager.

    50305-1.png
    Movies & TV is an UWP application, in order to do so to save system resources, such as energy and CPU usage, UWP applications have been coded to allow the system to suspend this application.

    Although we know the reason, I am afraid that we cannot use programming methods to prevent it from falling into a suspended state. After all, we cannot modify the code of Movies & TV.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.