Search code examples
ioshttp-live-streamingsuperpowered

Superpowered audio player pause at position


I'm streaming audio using _audioPlayer->openHLS() and I need to start and stop at specific positions.

The best way seems to be to use loopBetween and then call exitLoop in the LoopEnd event. However, I can't get loopBetween to play!

    _audioPlayer->loopBetween(startTimeMS, stopTimeMs, true, 255, false);

I have tried calling _audioPlayer->play(false) before or after the loopBetween, but then the audio plays without stopping. If I just call loopBetween it never starts playing.

Is there some config I'm missing to get loopBetween to work? The SDK has no sample code covering looping.

EDIT: I've found one way to do this, by polling positionMs in the audio processing callback. I'd still like to know how to make looping work, as that seems like a cleaner solution.


Solution

  • Looping doesn't work for HLS streams. Polling positionMs in the audio processing callback is a perfect solution.