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.