I am working on porting a windows phone project to a portable class library that targets both Windows 8 and Windows Phone 8. One of the issues I ran into is that XNA libraries seem to be unavailable for Windows 8.
I was thinking of using the MediaElement class since it seems to be available in both Windows Phone 8 and Windows 8. However, they are in two different namespaces on the respective platforms so MediaElement doesn’t seem to be accessible in this portable class library.
It looks like all of the xaml control classes are in different namespaces for these two platforms.
Am I mistaken? If not, is there some other workaround for have a portable class library that can play audio? More generically, is it possible for the library to be able to use common xaml control classes (e.g. BitmapImage etc.)?
in a portable class library you only have access to a little part of the .net framework common to both platforms. Specific WinRT APIs like sensors, GPS or XAML oriented ones like MediaElement are not available.
One thing you can do is isolate the code using MediaElement in an interface in your portable Class Library and implement the interface in each project with a class. Later you can inject the class of the project whenever you need it, using dependency injection or other methods.