diff --git a/Sources/VLCUI/UIVLCVideoPlayerView.swift b/Sources/VLCUI/UIVLCVideoPlayerView.swift index f446ad1..2a8618a 100644 --- a/Sources/VLCUI/UIVLCVideoPlayerView.swift +++ b/Sources/VLCUI/UIVLCVideoPlayerView.swift @@ -233,7 +233,9 @@ extension UIVLCVideoPlayerView: VLCMediaPlayerDelegate { private func setConfigurationValues(with player: VLCMediaPlayer, from configuration: VLCVideoPlayer.Configuration) { - player.time = VLCTime(int: configuration.startTime.asTicks.asInt32) + if !configuration.skipInitialTimeSet { + player.time = VLCTime(int: configuration.startTime.asTicks.asInt32) + } let defaultPlayerSpeed = player.rate(from: configuration.rate) player.fastForward(atRate: defaultPlayerSpeed) diff --git a/Sources/VLCUI/VLCVideoPlayer/Configuration.swift b/Sources/VLCUI/VLCVideoPlayer/Configuration.swift index fa64bf7..5ade3ac 100644 --- a/Sources/VLCUI/VLCVideoPlayer/Configuration.swift +++ b/Sources/VLCUI/VLCVideoPlayer/Configuration.swift @@ -23,6 +23,14 @@ public extension VLCVideoPlayer { public var subtitleColor: ValueSelector<_PlatformColor> = .auto public var playbackChildren: [PlaybackChild] = [] public var options: [String: Any] = [:] + /// When `true`, the initial `player.time` assignment in + /// `setConfigurationValues` is skipped. + /// + /// Use this for live streams where an explicit seek — even to the + /// current position — causes VLC to flush its buffers and re-acquire + /// the stream, resulting in long rebuffering delays or loss of the + /// live-edge position. + public var skipInitialTimeSet: Bool = false public init(url: URL) { self.url = url