콘텐츠 플레이어
- 10초 이전/이후로 이동하는 기능 추가
This commit is contained in:
@@ -219,6 +219,19 @@ final class ContentPlayerPlayManager: NSObject, ObservableObject {
|
||||
player?.seek(to: cmTime)
|
||||
}
|
||||
|
||||
func seekBackward(seconds: Double) {
|
||||
guard let currentTime = player?.currentTime() else { return }
|
||||
let newTimeInSeconds = CMTimeGetSeconds(currentTime) - seconds
|
||||
seek(to: max(newTimeInSeconds, 0))
|
||||
}
|
||||
|
||||
func seekForward(seconds: Double) {
|
||||
guard let currentTime = player?.currentTime(), let duration = player?.currentItem?.duration else { return }
|
||||
let newTimeInSeconds = CMTimeGetSeconds(currentTime) + seconds
|
||||
let durationInSeconds = CMTimeGetSeconds(duration)
|
||||
seek(to: min(newTimeInSeconds, durationInSeconds))
|
||||
}
|
||||
|
||||
private func generateUrl(contentId: Int, onSuccess: @escaping (String) -> Void, onFailure: @escaping () -> Void) {
|
||||
if contentId < 0 {
|
||||
onFailure()
|
||||
|
||||
Reference in New Issue
Block a user