mirror of
https://github.com/yattee/yattee.git
synced 2025-10-29 19:51:54 +00:00
Implement SponsorBlock API
This commit is contained in:
@@ -117,6 +117,14 @@ struct PlayerViewController: UIViewControllerRepresentable {
|
||||
#if os(tvOS)
|
||||
controller.transportBarCustomMenuItems = items
|
||||
#endif
|
||||
|
||||
if let skip = skipSegmentAction {
|
||||
if controller.contextualActions.isEmpty {
|
||||
controller.contextualActions = [skip]
|
||||
}
|
||||
} else {
|
||||
controller.contextualActions = []
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate var streamingQualityMenu: UIMenu {
|
||||
@@ -149,4 +157,16 @@ struct PlayerViewController: UIViewControllerRepresentable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var skipSegmentAction: UIAction? {
|
||||
if state.currentSegment == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return UIAction(title: "Skip \(state.currentSegment!.title())") { _ in
|
||||
DispatchQueue.main.async {
|
||||
state.player.seek(to: state.currentSegment!.skipTo)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user