Draft: [3.0] Added processing related to libvlc_MediaPlayerBuffering
This may improve UX.
let mediaPlayer: VLCMediaPlayer = ...
print(mediaPlayer.buffer)
For use with VLCMediaPlayerDelegate
// MARK: - VLCMediaPlayerDelegate
func mediaPlayerBufferChanged(_ aNotification: Notification) {
guard let mediaPlayer = aNotification.object as? VLCMediaPlayer else { return }
print(mediaPlayer.buffer)
}
func mediaPlayerStateChanged(_ aNotification: Notification) {
guard let mediaPlayer = aNotification.object as? VLCMediaPlayer else { return }
let currentState: VLCMediaPlayerState = mediaPlayer.state
if (currentState == .buffering) {
print(mediaPlayer.buffer)
}
}
For use with NotificationCenter
NotificationCenter.default.addObserver(forName: VLCMediaPlayer.bufferChanged, object: nil, queue: .main) {
guard let mediaPlayer = $0.object as? VLCMediaPlayer else { return }
print(mediaPlayer.buffer)
}
For use with KVO
var bufferKVO: NSKeyValueObservation?
bufferKVO = mediaPlayer.observe(\.buffer) { mp, change in
print(mp.buffer)
}
If this attempt is not suitable, please close this merge request.
best regards.