Open daria-kopaliani opened 7 years ago
I'd do it this way (code in Swift):
let player = ... // create player
let url = ...
let dataSource = STKAudioPlayer.dataSource(from: url)
player.queue(dataSource, withQueueItemId: SampleQueueId(url: url, andCount: 0))
player.seek(toTime: 42)
self.player = player // to keep strong reference to player
It should work. But if it won't work, then I'd move player.seek(toTime: 42)
to -(void) audioPlayer:(STKAudioPlayer*)audioPlayer didStartPlayingQueueItemId:(NSObject*)queueItemId;
method of STKAudioPlayerDelegate
.
What is the rightmost way to start streaming file from an offset? Should I subclass
STKDataSource
or is there an easier way?