Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Mar 17, 2024
1 parent 2c2f845 commit ed884c2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Sources/KSPlayer/AVPlayer/KSVideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extension KSVideoPlayer: UIViewRepresentable {
playerLayer?.player.isMuted = isMuted
}
}

@Published
public var playbackVolume: Float = 1.0 {
didSet {
Expand Down
2 changes: 1 addition & 1 deletion Sources/KSPlayer/MEPlayer/ThumbnailController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class ThumbnailController {
}
let ret = avcodec_receive_frame(codecContext, frame)
if ret < 0 {
if (ret == -(EAGAIN)) {
if ret == -EAGAIN {
continue
} else {
break
Expand Down
26 changes: 14 additions & 12 deletions Sources/KSPlayer/SwiftUI/KSVideoPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public struct KSVideoPlayerView: View {
.opacity(playerCoordinator.isMaskShow ? 1 : 0)
.padding()
}

private func ornamentView(playerWidth: Double) -> some View {
VStack(alignment: .leading) {
KSVideoPlayerViewBuilder.titleView(title: title, config: playerCoordinator)
Expand All @@ -259,10 +259,12 @@ public struct KSVideoPlayerView: View {
.buttonStyle(.plain)
.padding(.vertical, 24)
.padding(.horizontal, 36)
.glassBackgroundEffect()
#if os(xrOS)
.glassBackgroundEffect()
#endif
}
private func ornamentControlsView(playerWidth: Double) -> some View {

private func ornamentControlsView(playerWidth _: Double) -> some View {
HStack {
KSVideoPlayerViewBuilder.playbackControlView(config: playerCoordinator, spacing: 16)
Spacer()
Expand Down Expand Up @@ -430,13 +432,13 @@ struct VideoControllerView: View {
private var muteButton: some View {
#if os(xrOS)
HStack {
Slider(value: $config.playbackVolume, in: 0...1)
.onChange(of: config.playbackVolume, { _, newValue in
config.isMuted = newValue == 0
})
.frame(width: volumeSliderSize ?? 100)
.tint(.white.opacity(0.8))
.padding(.leading, 16)
Slider(value: $config.playbackVolume, in: 0 ... 1)
.onChange(of: config.playbackVolume) { _, newValue in
config.isMuted = newValue == 0
}
.frame(width: volumeSliderSize ?? 100)
.tint(.white.opacity(0.8))
.padding(.leading, 16)
KSVideoPlayerViewBuilder.muteButton(config: config)
}
.padding(16)
Expand Down Expand Up @@ -548,7 +550,7 @@ struct VideoTimeShowView: View {
}
.frame(maxHeight: 20)
#if os(xrOS)
.tint(.white.opacity(0.8))
.tint(.white.opacity(0.8))
#endif
Text((model.totalTime).toString(for: .minOrHour)).font(timeFont ?? .caption2.monospacedDigit())
}
Expand Down
27 changes: 13 additions & 14 deletions Sources/KSPlayer/SwiftUI/KSVideoPlayerViewBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import SwiftUI

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
enum KSVideoPlayerViewBuilder {

@MainActor
static func playbackControlView(config: KSVideoPlayer.Coordinator, spacing: CGFloat? = nil) -> some View {
HStack(spacing: spacing) {
Expand All @@ -28,7 +28,7 @@ enum KSVideoPlayerViewBuilder {
#endif
}
}

@MainActor
static func contentModeButton(config: KSVideoPlayer.Coordinator) -> some View {
Button {
Expand All @@ -37,7 +37,7 @@ enum KSVideoPlayerViewBuilder {
Image(systemName: config.isScaleAspectFill ? "rectangle.arrowtriangle.2.inward" : "rectangle.arrowtriangle.2.outward")
}
}

@MainActor
static func subtitleButton(config: KSVideoPlayer.Coordinator) -> some View {
MenuView(selection: Binding {
Expand All @@ -58,7 +58,7 @@ enum KSVideoPlayerViewBuilder {
Image(systemName: "text.bubble.fill")
}
}

@MainActor
static func playbackRateButton(playbackRate: Binding<Float>) -> some View {
MenuView(selection: playbackRate) {
Expand All @@ -71,7 +71,7 @@ enum KSVideoPlayerViewBuilder {
Image(systemName: "gauge.with.dots.needle.67percent")
}
}

@MainActor
static func titleView(title: String, config: KSVideoPlayer.Coordinator) -> some View {
HStack {
Expand All @@ -81,7 +81,7 @@ enum KSVideoPlayerViewBuilder {
.opacity(config.state == .buffering ? 1 : 0)
}
}

@MainActor
static func muteButton(config: KSVideoPlayer.Coordinator) -> some View {
Button {
Expand All @@ -91,7 +91,7 @@ enum KSVideoPlayerViewBuilder {
}
.shadow(color: .black, radius: 1)
}

static func infoButton(showVideoSetting: Binding<Bool>) -> some View {
Button {
showVideoSetting.wrappedValue.toggle()
Expand All @@ -105,8 +105,8 @@ enum KSVideoPlayerViewBuilder {
}
}

@available(iOS 16.0, macOS 13.0, tvOS 16.0, *)
private extension KSVideoPlayerViewBuilder {

static var playSystemName: String {
#if os(xrOS)
"play.fill"
Expand All @@ -122,8 +122,7 @@ private extension KSVideoPlayerViewBuilder {
"pause.circle.fill"
#endif
}



static var speakerSystemName: String {
#if os(xrOS)
"speaker.fill"
Expand All @@ -139,7 +138,7 @@ private extension KSVideoPlayerViewBuilder {
"speaker.slash.circle.fill"
#endif
}

@MainActor
@ViewBuilder
static func backwardButton(config: KSVideoPlayer.Coordinator) -> some View {
Expand All @@ -155,7 +154,7 @@ private extension KSVideoPlayerViewBuilder {
#endif
}
}

@MainActor
@ViewBuilder
static func forwardButton(config: KSVideoPlayer.Coordinator) -> some View {
Expand All @@ -171,7 +170,7 @@ private extension KSVideoPlayerViewBuilder {
#endif
}
}

@MainActor
static func playButton(config: KSVideoPlayer.Coordinator) -> some View {
Button {
Expand All @@ -185,7 +184,7 @@ private extension KSVideoPlayerViewBuilder {
.font(.largeTitle)
}
#if os(xrOS)
.contentTransition(.symbolEffect(.replace))
.contentTransition(.symbolEffect(.replace))
#endif
#if !os(tvOS)
.keyboardShortcut(.space, modifiers: .none)
Expand Down

0 comments on commit ed884c2

Please sign in to comment.