Windows phone compatibility?

Apr 30, 2013 at 10:07 PM
Anyone know if it's possible to get this to work with Windows Phone. I've got ogg files in a content directory but the VorbisReader cannot access them. I've tried:

using (var vorbis = new NVorbis.VorbisReader(@"\\Audio\file.ogg"))
and
Stream myFileStream = Application.GetResourceStream(new Uri("Audio/file.ogg", UriKind.Relative)).Stream;
using (var vorbis = new NVorbis.VorbisReader(myFileStream, true))

Thanks
Coordinator
May 1, 2013 at 12:19 AM
Markbt:

Does it work you open the stream like so:
using (var myFileStream = File.Open(@"\\Audio\file.ogg"))
using (var vorbis = new NVorbis.VorbisReader(myFileStream, true))
{
   // blah blah blah
}
May 1, 2013 at 12:43 AM
It gives An exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.ni.dll but was not handled in user code

I'm guessing the code is using standard methods to access the files where in windows phone they are a bit different?
Coordinator
May 1, 2013 at 2:08 AM
NVorbis uses standard stream access for the files, so I don't see why there would be an issue unless you are doing something cross-thread... Does the issue show up if you single-thread the open / read / decode?
May 1, 2013 at 2:35 AM
Not doing any multi threading, just tried the example in the documentation. It's maybe not much help but I just got CSVORBIS on GITHUB working in my Windows phone app which uses a similar format to get the file:

Stream myFileStream = Application.GetResourceStream(new Uri("Audio/file.ogg", UriKind.Relative)).Stream;
OggDecodeStream decode = new OggDecodeStream(myFileStream, true);

Not sure whats different in this one - I'm still a beginner coder. I'd still like to get NVorbis working though as it updates through NuGet. I'll try a bit more later when I get time.
Coordinator
May 7, 2013 at 12:27 PM
Markbt,

Without a full stack trace, I don't know that I can assist much further. Windows Phone is doing something strange with the stream, so I'm not sure where to go with it.

Thoughts?

NB: CsVorbis is great, but I wrote a new decoder because it doesn't follow C# guidelines and because it makes seeking a bit of a trick (unless I've just missed something).
May 7, 2013 at 12:56 PM
I just stick with what I've got now as it seems to be working. I haven't tested seeking - I just convert the ogg to a byte array. I was using wav's in the project but they were taking up too much space. Thanks for your help anyway, I'll keep an eye on this project and will have another go when I covert my app to a Windows 8 version.