Show stream opening status with AVPlayer

This commit is contained in:
Arkadiusz Fal
2023-05-21 12:09:18 +02:00
parent 2b7ccc4b03
commit c6798be167
6 changed files with 174 additions and 143 deletions

View File

@@ -32,6 +32,17 @@ extension PlayerModel {
}
}
var playerItemEndTimeWithSegments: CMTime? {
if let duration = playerItemDuration,
let segment = sponsorBlock.segments.last,
segment.endTime.seconds >= duration.seconds - 3
{
return segment.endTime
}
return playerItemDuration
}
private func skip(_ segment: Segment, at time: CMTime) {
if let duration = playerItemDuration, segment.endTime.seconds >= duration.seconds - 3 {
logger.error("segment end time is: \(segment.end) when player item duration is: \(duration.seconds)")