0
votes

I have a problem with mediaElement. Assume I play a video with mediaElement, and my phone locks the screen after 1 minute. So, after 1 minute, the mediaElement stops playing the video and the phone is on the lock screen. But I want to play the video normally.

How can I do that?

1

1 Answers

0
votes

The behaviour of MediaElement is so by design. There's no playback supported behind the lock screen.
Question isn't clear, but I think you want to prevent the phone from locking itself while video is being played. To do so, you must create a DisplayRequest object at global scope and set it to active when you start the playback.

if (dispRequest == null) 
{        
    dispRequest = new DisplayRequest();
    dispRequest.RequestActive();

    rootPage.NotifyUser("Display request activated", NotifyType.StatusMessage);        
}

Also, make sure to call the RequestRelease() once playback is finished. You can find more details at MSDN here.