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...
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.