[4.0.1a] Player start playing new audio from the time, when last audio file was stopped
Hello, I am using prerelease build 4.0.1a. When I assign new file to mediaPlayer.media, it starts playing it from the time, when last file was stopped.
That's how I stop previous audio:
func stopAudioPlayer() {
mediaPlayer.media?.clearStoredCookies()
mediaPlayer.pause()
mediaPlayer.time = VLCTime(number: NSNumber(value: 0))
mediaPlayer.stop()
}
That's how I load new audio:
func loadMedia(url: url) {
let media = VLCMedia(url: url)
self?.mediaPlayer.media = media
self?.mediaPlayer.minimalTimePeriod = 500
self?.mediaPlayer.timeChangeUpdateInterval = 0.05
self?.mediaPlayer.play()
}
Media player time for new audio will start from previous audio player stoppered time. Example: I listened to 1st audio and stopped it on 3d second, then I start playing new audio, it starts from 3d second, then it resets to 0 and all good. But I need it to start from 0. I didn't have this issue with 3.5.0 version. Before I used to do this:
func stopAudioPlayer() {
mediaPlayer.stop()
mediaPlayer.media = nil
}
and all was good, but now, if I will put nil inside media, app will crash.