That should work fine. Buffer the data yourself and then give it to the stream as the stream requests it. If you run out of data, you could just supply a whole load of blank data to the stream so you get no sound, but the stream is still playing.