Author Topic: BASS for Universal Windows Platform (UWP)  (Read 173483 times)

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #25 on: 24 Aug '15 - 14:21 »
A few questions to perhaps help narrow down what's wrong... Are you only having problems with the files when opening them from the internet (using BASS_StreamCreateURL), or does it affect local copies of the files (using BASS_StreamCreateFile) too? Can you play them with other (non-BASS) Windows Store apps? Also, are you only having the problem on the Windows Store platform, not on normal Windows?

Its actually a windows phone 8.1 project.  I've not tried the same code on a normal windows project.  The files play correctly in the same project when not using BASS).

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #26 on: 24 Aug '15 - 15:47 »
That's strange, both of your URLs are playing fine on a Windows Phone 8.1 device here. Have you tried multiple devices and got the problem on all of them? Please also show the code that you're using to open the stream and get the error code, as BASS_ErrorGetCode shouldn't give BASS_OK (0) if a BASS_StreamCreateURL call failed (make sure there are no other BASS calls in between as that will change the error code).

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #27 on: 26 Aug '15 - 15:58 »
That's strange, both of your URLs are playing fine on a Windows Phone 8.1 device here. Have you tried multiple devices and got the problem on all of them? Please also show the code that you're using to open the stream and get the error code, as BASS_ErrorGetCode shouldn't give BASS_OK (0) if a BASS_StreamCreateURL call failed (make sure there are no other BASS calls in between as that will change the error code).

I have tried multiple devices with the same result.

I'm using bass.net.compact, which might be the issue.

I initialize bass and then load the uri:

            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_NET_BUFFER, 2000);

            Task.Run(() =>
                {
                    _streamHandle = Bass.BASS_StreamCreateURL(Uri, 0, BASSFlag.BASS_STREAM_AUTOFREE, null, IntPtr.Zero);
                    Bass.BASS_ChannelPlay(_streamHandle, false);
                });

the call to BASS_StreamCreateURL never returns.  With the AAC-LC file, a streamhandle is returned and the music plays.

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #28 on: 26 Aug '15 - 17:01 »
The exact same code is working fine here, so that's very strange. Are you definitely testing with the HE-AAC URL that you posted above? Also, are you placing a breakpoint on the BASS_ChannelPlay call to confirm that the BASS_StreamCreateURL call never returns?

Regarding the BASS_OK (0) error code, were you getting that outside of the Task block? If so, please note that error codes are thread-specific, so you will need to get it within the Task block...

Code: [Select]
            Task.Run(() =>
                {
                    _streamHandle = Bass.BASS_StreamCreateURL(Uri, 0, BASSFlag.BASS_STREAM_AUTOFREE, null, IntPtr.Zero);
                    BASSError error = Bass.BASS_ErrorGetCode();
                    Bass.BASS_ChannelPlay(_streamHandle, false);
                });

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #29 on: 26 Aug '15 - 17:28 »
The exact same code is working fine here, so that's very strange. Are you definitely testing with the HE-AAC URL that you posted above? Also, are you placing a breakpoint on the BASS_ChannelPlay call to confirm that the BASS_StreamCreateURL call never returns?

Regarding the BASS_OK (0) error code, were you getting that outside of the Task block? If so, please note that error codes are thread-specific, so you will need to get it within the Task block...

Code: [Select]
            Task.Run(() =>
                {
                    _streamHandle = Bass.BASS_StreamCreateURL(Uri, 0, BASSFlag.BASS_STREAM_AUTOFREE, null, IntPtr.Zero);
                    BASSError error = Bass.BASS_ErrorGetCode();
                    Bass.BASS_ChannelPlay(_streamHandle, false);
                });

Yes, I'm using the same test url I posted.  Yes, I had a breakpoint on the BASS_ChannelPlay line that is never called. 

The the BASS_OK (0) error code was outside the task block, but since the BASS_StreamCreateURL doesn't return, I can't place it after it.

ileandros

  • Posts: 9
Re: BASS for Windows Store/Phone
« Reply #30 on: 26 Aug '15 - 23:26 »
Are you trying to use "Add Reference" to add the BASS.DLL file to your project? If so, you should use "Add Existing Item" instead and enable the "Copy to Output Directory" option in the item's properties. If you're using C++, then you should also add BASS.LIB to the linker "Additional Dependencies" (and add its path to "Additional Library Directories"). If you're using C#, then you will currently need to import the functions yourself, eg. using "DllImport". A Windows Store version of BASS.Net to handle that for you should be available soon.
That would work but check this out: DllImport cannot be used on user-defined methods.
We can not add a dll on WP8.1. C# Silverlight WP8.1 doesn't support it.

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #31 on: 27 Aug '15 - 15:29 »
The exact same code is working fine here, so that's very strange. Are you definitely testing with the HE-AAC URL that you posted above? Also, are you placing a breakpoint on the BASS_ChannelPlay call to confirm that the BASS_StreamCreateURL call never returns?

Regarding the BASS_OK (0) error code, were you getting that outside of the Task block? If so, please note that error codes are thread-specific, so you will need to get it within the Task block...

Code: [Select]
            Task.Run(() =>
                {
                    _streamHandle = Bass.BASS_StreamCreateURL(Uri, 0, BASSFlag.BASS_STREAM_AUTOFREE, null, IntPtr.Zero);
                    BASSError error = Bass.BASS_ErrorGetCode();
                    Bass.BASS_ChannelPlay(_streamHandle, false);
                });

Yes, I'm using the same test url I posted.  Yes, I had a breakpoint on the BASS_ChannelPlay line that is never called. 

The the BASS_OK (0) error code was outside the task block, but since the BASS_StreamCreateURL doesn't return, I can't place it after it.

with different AAC urls, I'm also getting exceptions thrown by BASS_StreamCreateURL. E.g. this uri (http://download.wavetlan.com/SVV/Media/HTTP/AAC/Nero_Soundtrax/NeroSoundTrax_test8_AAC-LC_v4_Stereo_ABR_192kbps_44100Hz.m4a) throws this

{System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at Un4seen.Bass.Bass.BASS_StreamCreateURL(String url, Int32 offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
   at MixPlayer.Player.<>c__DisplayClass1.<Load>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()}

And this uri (http://download.wavetlan.com/SVV/Media/HTTP/AAC/Roxio_Media_Manager/RoxioMediaManager_test3_AAC-LC_v4_Stereo_CBR_128kbps_44100Hz.aac)

{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Un4seen.Bass.Bass.BASS_StreamCreateURL(String url, Int32 offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
   at MixPlayer.Player.<>c__DisplayClass1.<Load>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}

Both these uris play using the normal MediaPlayer api.

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #32 on: 27 Aug '15 - 18:02 »
That would work but check this out: DllImport cannot be used on user-defined methods.
We can not add a dll on WP8.1. C# Silverlight WP8.1 doesn't support it.

A Windows Store version of BASS.Net is now up in the 1st post, so it should no longer be necessary to use "DllImport" yourself.

with different AAC urls, I'm also getting exceptions thrown by BASS_StreamCreateURL. E.g. this uri (http://download.wavetlan.com/SVV/Media/HTTP/AAC/Nero_Soundtrax/NeroSoundTrax_test8_AAC-LC_v4_Stereo_ABR_192kbps_44100Hz.m4a) throws this

{System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at Un4seen.Bass.Bass.BASS_StreamCreateURL(String url, Int32 offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
   at MixPlayer.Player.<>c__DisplayClass1.<Load>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()}

And this uri (http://download.wavetlan.com/SVV/Media/HTTP/AAC/Roxio_Media_Manager/RoxioMediaManager_test3_AAC-LC_v4_Stereo_CBR_128kbps_44100Hz.aac)

{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Un4seen.Bass.Bass.BASS_StreamCreateURL(String url, Int32 offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
   at MixPlayer.Player.<>c__DisplayClass1.<Load>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}

Both these uris play using the normal MediaPlayer api.

Please try setting the debugger type to "Mixed" or "Native" (in the project's "Debug" properties) to hopefully get some more info on the crashes, eg. a call stack in the native code.

Btw, the 1st URL there isn't streamable due to its MP4 atom order ("mdat" before "moov"), so it won't be playable with BASS_StreamCreateURL. If the MediaPlayer API is playing it, then I presume it must be downloading the entire file first?

ileandros

  • Posts: 9
Re: BASS for Windows Store/Phone
« Reply #33 on: 27 Aug '15 - 20:35 »
+ I tried adding "Microsoft Visual C++ 2013 Runtime Package for Windows Phone". For that I had to change the platform(in configuration manager) from Any CPU to ARM for my device.
Then I added the bass.dll as you suggested.
However when I call the function I got an exception, "$exception{"Exception has been thrown by the target of aninvocation."System.Reflection.TargetInvocationException".
I did a deeper search and the inner exception is, "InnerException{"DllImport cannot be used on user-defined methods."}System.Exception {System.NotSupportedException}".

My device is Nokia Lumnia 930. I am on 8.1 version. Any ideas?

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #34 on: 28 Aug '15 - 14:40 »
Are you still using "DllImport" to import the BASS functions, or the Windows Store version of BASS.Net from the 1st post? If the former, please try the latter (add a reference to it).

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #35 on: 28 Aug '15 - 14:56 »
That would work but check this out: DllImport cannot be used on user-defined methods.
We can not add a dll on WP8.1. C# Silverlight WP8.1 doesn't support it.

A Windows Store version of BASS.Net is now up in the 1st post, so it should no longer be necessary to use "DllImport" yourself.

with different AAC urls, I'm also getting exceptions thrown by BASS_StreamCreateURL. E.g. this uri (http://download.wavetlan.com/SVV/Media/HTTP/AAC/Nero_Soundtrax/NeroSoundTrax_test8_AAC-LC_v4_Stereo_ABR_192kbps_44100Hz.m4a) throws this

{System.Runtime.InteropServices.SEHException: External component has thrown an exception.
   at Un4seen.Bass.Bass.BASS_StreamCreateURL(String url, Int32 offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
   at MixPlayer.Player.<>c__DisplayClass1.<Load>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()}

And this uri (http://download.wavetlan.com/SVV/Media/HTTP/AAC/Roxio_Media_Manager/RoxioMediaManager_test3_AAC-LC_v4_Stereo_CBR_128kbps_44100Hz.aac)

{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at Un4seen.Bass.Bass.BASS_StreamCreateURL(String url, Int32 offset, BASSFlag flags, DOWNLOADPROC proc, IntPtr user)
   at MixPlayer.Player.<>c__DisplayClass1.<Load>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
   at System.Threading.Tasks.Task.ExecutionContextCallback(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)
   at System.Threading.Tasks.Task.ExecuteEntry(Boolean bPreventDoubleExecution)
   at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()}

Both these uris play using the normal MediaPlayer api.

Please try setting the debugger type to "Mixed" or "Native" (in the project's "Debug" properties) to hopefully get some more info on the crashes, eg. a call stack in the native code.


Mixed mode debugging doesn't work for me, but with Native, I get this message (but no stack trace):
First-chance exception at 0x68695965 (msvcr120_app.dll) in Windows.Media.BackgroundPlayback.exe: 0xC0000005: Access violation reading location 0x0000000A.

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #36 on: 28 Aug '15 - 15:40 »
Yeah, I don't think mixed mode debugging works on Windows Phone. Could you try reproducing the problem on Windows instead, ie. start the "App.Windows" project rather than the "App.WindowsPhone" project? It should be possible to use mixed mode debugging then, which will hopefully give a native call stack.

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #37 on: 28 Aug '15 - 16:50 »
Hello,

I'm trying to use bass.net in a windows phone 8.1 (c#) project.  I've added the bass.dll to the project, and reference bass.net.compact.  The project builds and runs, but I get an error when I try to call BASS_StreamCreateFileUser:

{System.EntryPointNotFoundException: Unable to find an entry point named 'BASS_StreamCreateFileUser_' in DLL 'bass.dll'.
   at Un4seen.Bass.Bass.BASS_StreamCreateFileUser_(BASSStreamSystem A_0, BASSFlag A_1, FILECLOSEPROC A_2, FILELENPROC A_3, FILEREADPROC A_4, FILESEEKPROC A_5, IntPtr A_6)
   at Un4seen.Bass.Bass.BASS_StreamCreateFileUser(BASSStreamSystem system, BASSFlag flags, BASS_FILEPROCS procs, IntPtr user)

I've noticed that FILELENPROC and FILESEEKPROC in bass.net.compact have int return types, instead of long (as in bass.net).  Is that the issue?

Should I even be using bass.net.compact?  I also tried bass.net (v 4.0), but I get an error when I try to call BASS_GetDevice():

{System.TypeInitializationException: The type initializer for 'Un4seen.Bass.Bass' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.
   at Un4seen.Bass.Bass.a()
   at Un4seen.Bass.Bass.b()
   at Un4seen.Bass.Bass..cctor()
   --- End of inner exception stack trace ---
   at Un4seen.Bass.Bass.BASS_GetDevice()

Thanks,

Matt

with the windows store dll, I get a bit more info:
First-chance exception at 0x771535D7 in WpBass.exe: Microsoft C++ exception: Platform::InvalidArgumentException ^ at memory location 0x076BEE70. HRESULT:0x80070057 The parameter is incorrect.

WinRT information: hostName

Stack trace:
[External Code]
bass.dll!68a8add9()
bass.dll!68a89297()
bass.dll!68a6476d()
bass.dll!68a68d71()
bass.dll!68a805e3()
[External Code]

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #38 on: 28 Aug '15 - 17:24 »
That looks more promising. So that I can locate where in BASS.DLL the call stack frames are, please reproduce the problem again and this time also get BASS.DLL's address from the "Modules" list.

ileandros

  • Posts: 9
Re: BASS for Windows Store/Phone
« Reply #39 on: 30 Aug '15 - 20:49 »
Are you still using "DllImport" to import the BASS functions, or the Windows Store version of BASS.Net from the 1st post? If the former, please try the latter (add a reference to it).
Let me show you.
This is how the executed code looks like. + the reference and dll the way you asked me to add.

Edit: This is the error
It is the debugger throwing the error. Just to let you know that exactly the same code works on a Windows application.
« Last Edit: 30 Aug '15 - 21:08 by ileandros »

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #40 on: 31 Aug '15 - 14:13 »
Please try using the BASS.Net version in the 1st post (add a reference to it and a "using Un4seen.Bass" line), and see if there is still a problem then.

ileandros

  • Posts: 9
Re: BASS for Windows Store/Phone
« Reply #41 on: 31 Aug '15 - 14:31 »
Please try using the BASS.Net version in the 1st post (add a reference to it and a "using Un4seen.Bass" line), and see if there is still a problem then.

Edit: I am on WP8.1 Silverlight, VS 2015  Win 8.1 x86

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #42 on: 31 Aug '15 - 17:41 »
That's strange. Are you using the latest VS2015 version, eg. not a preview? If so, perhaps the BASS.Net DLL currently requires Win10, I'm not sure. The BASS.Net developer is currently away on holiday, so we may have to wait until they return to find out. In the meantime, regarding using "DllImport", you could try something like this:

Code: [Select]
public sealed class MyBass
{
[DllImport("bass.dll")]
public static extern bool BASS_Init(int device, uint freq, uint flags, IntPtr win, IntPtr clsid);
// rest of imports...
}

...

MyBass.BASS_Init(-1, 44100, 0, IntPtr.Zero, IntPtr.Zero);

Note that pointer parameters should use "IntPtr" rather than "int" or "uint".

ileandros

  • Posts: 9
Re: BASS for Windows Store/Phone
« Reply #43 on: 1 Sep '15 - 19:46 »
Code: [Select]
public sealed class MyBass
{
[DllImport("bass.dll")]
public static extern bool BASS_Init(int device, uint freq, uint flags, IntPtr win, IntPtr clsid);
// rest of imports...
}

...

MyBass.BASS_Init(-1, 44100, 0, IntPtr.Zero, IntPtr.Zero);

Note that pointer parameters should use "IntPtr" rather than "int" or "uint".
That's the way I was calling it.

Are they going to be away on holidays for long?!

Thank you anyway

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #44 on: 11 Sep '15 - 16:53 »
That looks more promising. So that I can locate where in BASS.DLL the call stack frames are, please reproduce the problem again and this time also get BASS.DLL's address from the "Modules" list.

   msvcr120_app.dll!68855964()   Unknown
    bass.dll!68aa1ff2()   Unknown
    bass.dll!68aa4762()   Unknown
    bass.dll!68aa8d70()   Unknown
    bass.dll!68ac05e2()   Unknown
    [External Code]   
    Bass.Net.WinStore.ni.dll!68b290a2()   Unknown
    WpBass.ni.exe!6f45a2a6()   Unknown
    [External Code]   

bass.dll address: 68AA0000-68AFE000
Bass.Net.WinStore.ni.dll address: 68B00000-68B6C000   

Does that help?
   

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #45 on: 12 Sep '15 - 12:31 »
Strange, those call stack locations don't seem to quite match with the BASS.DLL that I have. Are you using the BASS.DLL v2.4.11.12 for Windows Phone dated 15:16 18-08-2015? Anyway, as the crash appears to be happening within a BASS_StreamCreateURL call, I will send you a debug BASS version to check what's happening in there.

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #46 on: 14 Sep '15 - 09:54 »
Strange, those call stack locations don't seem to quite match with the BASS.DLL that I have. Are you using the BASS.DLL v2.4.11.12 for Windows Phone dated 15:16 18-08-2015? Anyway, as the crash appears to be happening within a BASS_StreamCreateURL call, I will send you a debug BASS version to check what's happening in there.

I was actually using BASS.DLL v2.4.11.11.  I can't repro the initial issue with v2.4.11.12, so I'll do some further testing.

I switched to your debug version and the app crashed during launch.
« Last Edit: 14 Sep '15 - 09:59 by mcooper »

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #47 on: 1 Oct '15 - 17:20 »
I'm trying to play audio from a background task in windows phone 8.1 (https://code.msdn.microsoft.com/windowsapps/BackgroundAudio-63bbc319#content) using Bass.   I've modified the sample from MSDN and it plays audio, but the playback stops when the app is backgrounded or if the screen is locked.  Should this be supported, or is there anything special I need to do to get it to work?

Matt

Ian @ un4seen

  • Administrator
  • Posts: 26177
Re: BASS for Windows Store/Phone
« Reply #48 on: 2 Oct '15 - 12:54 »
Did you place the BASS calls in the background task, ie. the MyBackgroundAudioTask class? I had a quick go at that myself and it seemed to work OK, ie. BASS playback continued after leaving the app (pressing the back/start/search buttons). What I did was add a BASS_Init call (and BassNet.Registration) to the MyBackgroundAudioTask.Run function, and replace the MyBackgroundAudioTask.StartPlayback function's content with BASS stream creation and BASS_ChannelPlay calls.

mcooper

  • Posts: 53
Re: BASS for Windows Store/Phone
« Reply #49 on: 6 Oct '15 - 11:20 »
Did you place the BASS calls in the background task, ie. the MyBackgroundAudioTask class? I had a quick go at that myself and it seemed to work OK, ie. BASS playback continued after leaving the app (pressing the back/start/search buttons). What I did was add a BASS_Init call (and BassNet.Registration) to the MyBackgroundAudioTask.Run function, and replace the MyBackgroundAudioTask.StartPlayback function's content with BASS stream creation and BASS_ChannelPlay calls.

Yes, I did.  Tried it again, and it seems to play in the background while debugging, but if I detach the debugger or start the app without debugging, then the audio stops when leaving the app, and resumes when the app is brought back to the foreground. Were you debugging when you tried it?