C# UWP MediaPlayer crash on emulator - c#

I'm new to UWP, and i tried instantinate MediaPlayer class. On local machine it's work fine, but on mobile emulator throws next exception:
An exception of type 'System.Runtime.InteropServices.COMException'
occurred in project.exe but was not handled in user code
Additional information: ClassFactory cannot supply requested class
(Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))
StackTrace:
at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD)
at Windows.Media.Playback.MediaPlayer..ctor()
at Project.Services.PlaybackServiceFactory.Create(PlayerArgument arg)
at Project.ViewModels.PlayerViewModel..ctor(PlayerArgument arg)
at Project.MainPage.d__3.MoveNext()
All uwp examples with MediaPlayer also crashes. Previously it worked fine, whats maybe wrong? I would be glad of any help, thank you.
UPD: Problem actual for 10.0.10586 emulator version

The MediaPlayer constructor is available from "Universal, introduced version 10.0.14393.0". So please run your project in 14393 emulator or grater.
You could dynamically detect features with API contracts (10 by 10)
The Universal Windows Platform (UWP) allows you to write your app once and target multiple device families, while also taking advantage of new APIs introduced on later versions of the OS as well as using unique APIs only present on certain device families.

Related

Why is my Unity IOS App crashing after uploading it to Xcode?

I've been a developer Unity iOS developer for a while now and I recently tried to test out my app on my phone. After building the project and uploading it to xCode so I can upload the app on my phone, the app was developed but crashes once I opened it. There are some warning logs but not sure which one is causing the crashing.
https://i.stack.imgur.com/FKY8e.jpg
https://i.stack.imgur.com/D4ryX.png
I also might think this is because I am not paying for the Apple developer program, yet before I was able to test it without paying for it.
Logs:
2020-03-28 14:11:21.207192-0700 TheSuccFinal[2733:973093] Error loading /var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework, 265): no suitable image found. Did find:
/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: code signature invalid for '/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework'
/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: stat() failed with errno=3
/private/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: code signature invalid for '/private/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework'
2020-03-28 14:11:21.247919-0700 TheSuccFinal[2733:973093] Error loading /var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: dlopen(/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework, 265): no suitable image found. Did find:
/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: code signature invalid for '/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework'
/private/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework.framework/UnityFramework: code signature invalid for '/private/var/containers/Bundle/Application/A8DD7379-FF01-4A00-AF26-77A546A87C8E/TheSuccFinal.app/Frameworks/UnityFramework
It is related to iOS 13.3.1 since recent releases from Apple iOS builder, personal (non-developer) Apple accounts cannot sign frameworks correctly, since Unity is a framework itself it is not signed when built.
You can check this unity forum discussion and this discussion in the flutter framework about the bug.
Apparently it is fixed in iOS 13.4, so check your XCode version, iOS target version and you should be good to go.

Windows UWP BLE DeviceInformation.CreateWatcher throws Property key syntax error

We have a Desktop Windows app using some UWP Bluetooth LE UWP functions. We start the watcher:
string BTLEDeviceWatcherAQSString = "(System.Devices.Aep.ProtocolId:=\"{bb7bb05e-5972-42b5-94fc-76eaa7084d49}\")";
string[] props = { "System.Devices.Aep.DeviceAddress", "System.Devices.Aep.IsConnected", "System.Devices.Aep.Bluetooth.Le.IsConnectable"};
watcher = DeviceInformation.CreateWatcher(BTLEDeviceWatcherAQSString, props, DeviceInformationKind.AssociationEndpoint);
It runs OK on most machines, just rarely we have an anonymized error log:
System.Exception: Element not found. Property key syntax error. A property key must either be specified as a canonical property name (preferred) or be of the form {fmtid} pid.
at Windows.Devices.Enumeration.DeviceInformation.CreateWatcher(String aqsFilter, IEnumerable`1 additionalProperties, DeviceInformationKind kind)
We run this code for Windows 10.0.15063 (i.e. 1703) or higher, so all properties should be available by doc.
What may cause this error? Some HW configuration or Windows 10 settings?
I have seen this exception in a windows WPF desktop application. The reason was that I had neglected to detect the revision of Windows 10 was greater than version 1703 AKA creators edition. Therefore anyone running the application on an earlier version of Windows 10 would see this error. Its unfortunate that the error is so obscure, a not supported error would be better.

VR application (Unity with TrinusVR lib) Windows build: Connection reset

I am developing a VR application using Unity 2018.2.8f1 and the TrinusVR lib (a framework that does serverside rendering). When I press play in the editor or build for Linux it works as expected. However, when using the Windows build, only about one frame gets transmitted to the client, then the connection is reset. On the client it shows the errors:
Error streaming video error: java.net.SocketException: Connection reset
Error Error delivering sensor data: java.net.SocketException: Connection reset
Digging into into the logs of the server it seems that this reset is caused by a null reference exception:
Disconnected (Reason: ERROR:ERR_IMG_PROC:Could not deliver frame to client.
System.TypeInitializationException: The type initializer for 'ManagedToNativeWrapper' threw an exception. --->
System.NullReferenceException: Object reference not set to an instance of an object
at System.Drawing.ComIStreamMarshaler+ManagedToNativeWrapper..cctor () [0x00049] in :0`
Does somebody know, what is wrong here? Has anybody seen this problem before?
You can find the complete log files (Windows 10 server and android 7 client) here:
https://transfernow.net/419cp2m92898
Thank you
Turns out that it actually is a problem of the .NET version on Windows as the trinus lib is made for an older version. Setting the right parameters in Edit > Project Settings > Player, section Other Settings, resolves:
Scripting Runtime Version: .NET 3.5 Equivalent
Api Compatibility Level: .NET 2.0

Failed to add a WMAsfReader into the FilterGraph

Add a WMAsfReader caused Error,HRESULT was -2147024770.The code is as follow:
sourceFilter = (IBaseFilter) new WMAsfReader();
((IFileSourceFilter)sourceFilter).Load(fileSource, null);
hr = filterGraph.AddFilter(sourceFilter, "WM ASF Reader");
MessageBox.Show(hr.ToString());
When I run this code on Win10 with WMP,it works well;but it does not work on Win7 without WMP.But I can find the "WM Asf Reader" in the registry,qasf.dll as well.What is the problem?Thanks.
Error Image:
The error code -2147024770 is 0x8007007E ERROR_MOD_NOT_FOUND "The specified module could not be found."
Such error for a Windows core component might indicate that something is broken in your Windows (e.g. certain application installed and registered the same DLL and then it was deinstalled - resulting in broken registration of the original module). It might also be caused by Windows 7 N version having no Windows Media in the default configuration, you are supposed to add the feature by installing a Feature Pack.
but it does not work on Win7 without WMP...
...The Media Feature Pack for Windows 7 N or Windows 7 KN will install Media Player and related technologies on a computer running...
It is not only Windows Media Player missing in N editions, but also the underlying APIs, used by WM ASF Reader.

Windows 10 iot speech synthesis language change

I recently installed Windows 10 IoT on my Raspberry Pi 2 following this tutorial, but it's not working.
foreach (var voice in SpeechSynthesizer.AllVoices)
{
Debug.WriteLine($"Name: {voice.DisplayName} Lang: {voice.Language} Type: {voice.Gender} Description : {voice.Description}");
}
On my first try, the above code showed "es-ES" language pack but, when trying to use the TTS it threw an exception:
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.CoreLib.ni.dll
So, I did a fresh install again, copied again the files but, this time shows this:
Exception thrown: 'System.InvalidOperationException' in System.Linq.dll.
Does somebody know how to properly install a new language pack on Windows 10 IoT core?
Thanks so much for your help, the solution was really easy, hope this helps somebody else. I did a fresh install again (using the flash image from Core Dashboard) and suddenly noticed that some old files were still there, even after the flash… So I did this:
I went to Partition Wizard and deleted the SD Card partition, then made a new Fat32 volume.
I reformatted the SD Card using Windows format storage tool and unticked the “Quick Format” option and selected default cluster. For a SD Card 8GB Class 10 took about 10 minutes.
Flashed again the W iot Core image.
Copied again Speech_OneCore\TTS\es-ES and System32\Speech_OneCore\Common\es-ES to my board and reboot.
Run again the code snippet to show available languages and it showed es-ES along en-US, I tested it with a TTS code and is talking in my mother tongue without problem.

Categories

Resources