Instead of download the whole uploaded audio content from Google Drive (extension can be m4a) I would like to play as buffered content (eg on YouTube, Spotify, etc).
I use drive rest api to download a chunk.
public Stream GetStreamChunk(string fileId, RangeHeaderValue range)
var getrequest = driveService.Files.Get(fileId);
var stream = new MemoryStream();
What I have tried:
public long KB(long value)
return value * 1024;
First of all, I would like to play just a chunk.
long from = 0;
long to = KB(500);
RangeHeaderValue range = new RangeHeaderValue(from, to);
Stream stream = GetStreamChunk(file.Id, range);
using (WaveStream aacStream =
using (WaveOut waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback()))
Unfortunately, I get an "System.Runtime.InteropServices.COMException" exception at call Play():
In case, if it's a Stream: The byte stream type of the given URL is unsupported. (Exception from HRESULT: 0xC00D36C4)
In case, if it's a MemoryStream: Operation is not allowed for the current position.