Personally I only needed to play an MP3, so I followed the instructions here:
to “empty” the SharpDX.mediaFoundation dll/xml (extremely ugly hack, to be honest) , and then I implemented playing the MP3 using the native API (declare a MediaElement in the GamePage.xaml, and use it to play an MP3).
Of course if you need other features from that DLL you’ll have to implement them ‘natively’
Thanks for sharing that… I went ahead and did that, unfortunately I had to cut out one of the things in my game because it’s dependent on that .DLL, but honestly this is better than nothing. I’m going to go ahead and resubmit. Fingers crossed that it works!
Ok so apparently this issue was fixed on the SharpDX side. Brian Peek from Microsoft had this message to share:
Just checking in over here: I did identify the issue and there’s actually a fix in SharpDX, but SharpDX hasn’t released new binaries since the patch was in place, and therefore, MonoGame isn’t using a build of SharpDX with the patch in place. I’ve reached out to the right folks to see if there’s something that can be done for future folks that will run into this.
Rather the next SharpDX release. We should be able to upgrade fairly easy now because we’re already at 4.0.1 (latest stable) version of SharpDX. Then people that want to release to the MS Store can use a develop build of MG.
You can already use the prerelease SharpDX assemblies from NuGet and release on the MS store with those if you’re in a hurry.
Yes it’s the same but using the latest merged fixes (although it’s not signed, so you need to bypass the warning screen, it’s safe, honest)
The MonoGame backend also creates installers for every PR request, which makes it really easy to test and ensure new features will work when built with the build pipeline.
For Windows 10, you HAVE to use the latest dev installer, as UWP has issues in the 3.6 build.
As of 5/20/18 this bug is STILL THERE
JUST SUBMITTED TO MICROSOFT STORE!!!
FAILED
Supported APIs
Error Found: The supported APIs test detected the following errors:
API MFCreateMuxStreamAttributes in mfplat.dll is not supported for this application type. SharpDX.MediaFoundation.dll calls this API.
API MFCreateMuxStreamMediaType in mfplat.dll is not supported for this application type. SharpDX.MediaFoundation.dll calls this API.
API MFCreateMuxStreamSample in mfplat.dll is not supported for this application type. SharpDX.MediaFoundation.dll calls this API.
API MFCreateSensorGroup in mfplat.dll is not supported for this application type. SharpDX.MediaFoundation.dll calls this API.
API MFCreateSensorStream in mfplat.dll is not supported for this application type. SharpDX.MediaFoundation.dll calls this API.
How the F&%K do you get around it and if it means cleaning out the DLL and making a null XML then for the love of god put that in a new dev version to force people NOT to use the damn thing until it’s fixed correctly!!!
Lolol yeah, I know the feeling man. I fixed it by clearing the dll but I believe if you update one of the components on NuGet (see the above comments towards the end of this thread) it should fix the error.
If that doesn’t work I’d recommend clearing the DLL and just move forward with that.
Nope, Tried 5/19/18, didn’t do diddly, updates to the latest and greatest monogame, dev.
Been working all morning to get it fixed, I 'm VERY hopeful of this work around, I just re-submitted it and since my upload has NO Sharpdx.MediaFoundation has no calls or references to it…… well fingers crossed, here’s what I did
in the c:\program file(86)\monogame\3.0\Assemblies\WindowsUniversal\ folder I renamed the offending xml and dll
Removed all reference to songs in my app and inserted this class, feel free to use it and try it
using System;
using Windows.Media.Core;
using Windows.Media.Playback;
using Windows.UI.Xaml;
namespace Pick_and_Pile
{
public class Music
{
public MediaPlayer mediaPlayer;
/*****************************************************************************************
Function Name : Music
Description : Constructor for this class
******************************************************************************************/
public Music()
{
mediaPlayer = new MediaPlayer();
mediaPlayer.Volume = 1f;
}
/*********************************************************************************************
* Function Name : PlayMedia
* Description : play a song using internal media player "filename.xxx" where xxx = mp3
* ******************************************************************************************/
public void PlayMedia(string fileName)
{
// point to the base folder of the app, if you want to nest deeper go ahead
string name = "ms-appx:///" + fileName;
mediaPlayer.Pause();
mediaPlayer.IsLoopingEnabled = true;
mediaPlayer.Source = MediaSource.CreateFromUri(new Uri($"{name}", UriKind.RelativeOrAbsolute));
mediaPlayer.Play();
}
}
}
I tested it with my game works like a charm even with multiple tunes, invoking it should be obvious, if not let me know ill post it.
but I double checked and there was ZERO Sharpdx.MediaFoundation in my builds
Thanks for the code, I imagine clearing that dll will do the trick. I just recently uploaded again to the store with that fix and it worked. Fingers crossed, let us know how it goes!
Yep Certified and ready to publish, didn’t take over a year to figure out, sure would be nice if they would warn people during the install, something like,
“Oh FYI if you plan on trying to publish via Microsoft Store, don’t play any music, if you want to use (see above class) to do it!”
Maybe I should add that to the “Things you want to see in MonoGame” thread!
This really concerns me. I’m creating UWP game and using XNA MediaPlayer to play background music. Sounds like this will not pass certification? Is using SoundEffectInstance to play background music a possible workaround?