When i run mytoolkit after background audio player start is return "The SystemMediaTransportControls were initialized in a different mode. Please use the API associated with that mode to complete this operation" Exception.
var url = await MyToolkit.Multimedia.YouTube.GetVideoUriAsync(ID, MyToolkit.Multimedia.YouTubeQuality.Quality480P);
it works fine when background audio player not started. please help me i cant find where is the error, is there any solution for that...
In your code for background audio player use
var systemMediaControls = SystemMediaTransportControls.GetForCurrentView();
systemMediaControls.ButtonPressed += systemMediaControls_ButtonPressed;
systemMediaControls.IsPlayEnabled = true;
systemMediaControls.IsPauseEnabled = true;
systemMediaControls.IsNextEnabled = true;
systemMediaControls.IsPreviousEnabled = true;
async void systemMediaControls_ButtonPressed(SystemMediaTransportControls sender, SystemMediaTransportControlsButtonPressedEventArgs args)
{
switch (args.Button)
{
case SystemMediaTransportControlsButton.Play:
break;
}
}
instead of
MediaControl.PlayPressed += MediaControl_PlayPressed;
MediaControl.PausePressed += MediaControl_PausePressed;
Control. I think it will help for you..