redesign iOS round into fullscreen swipe flow
This commit is contained in:
@@ -3,14 +3,16 @@ import SwiftUI
|
||||
|
||||
struct HermesVideoPlayerView: View {
|
||||
@ObservedObject var coordinator: PlayerCoordinator
|
||||
var cornerRadius: CGFloat = HermesTheme.cornerRadius
|
||||
var fixedHeight: CGFloat? = 224
|
||||
|
||||
var body: some View {
|
||||
VideoPlayer(player: coordinator.player)
|
||||
.frame(maxWidth: .infinity)
|
||||
.frame(height: 224)
|
||||
.clipShape(RoundedRectangle(cornerRadius: HermesTheme.cornerRadius, style: .continuous))
|
||||
.frame(height: fixedHeight)
|
||||
.clipShape(RoundedRectangle(cornerRadius: cornerRadius, style: .continuous))
|
||||
.overlay(
|
||||
RoundedRectangle(cornerRadius: HermesTheme.cornerRadius, style: .continuous)
|
||||
RoundedRectangle(cornerRadius: cornerRadius, style: .continuous)
|
||||
.stroke(HermesTheme.accent.opacity(0.12), lineWidth: 1)
|
||||
)
|
||||
.background(HermesTheme.surfaceElevated)
|
||||
|
||||
@@ -27,11 +27,26 @@ final class PlayerCoordinator: ObservableObject {
|
||||
isPlaying = true
|
||||
}
|
||||
|
||||
func play(rate: Float) {
|
||||
player.playImmediately(atRate: rate)
|
||||
isPlaying = true
|
||||
}
|
||||
|
||||
func pause() {
|
||||
player.pause()
|
||||
isPlaying = false
|
||||
}
|
||||
|
||||
func seek(to timeMs: Int) {
|
||||
let time = CMTime(seconds: Double(timeMs) / 1_000.0, preferredTimescale: 1_000)
|
||||
player.seek(to: time)
|
||||
}
|
||||
|
||||
func play(url: URL, startTimeMs: Int, rate: Float) {
|
||||
prepareForPreview(url: url, startTimeMs: startTimeMs)
|
||||
play(rate: rate)
|
||||
}
|
||||
|
||||
func restart(url: URL, startTimeMs: Int = 0) {
|
||||
prepareForPreview(url: url, startTimeMs: startTimeMs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user