feat: fullscreen video + click icon to toggle control toolbar

- Video fills entire window via VideoPlayerRepresentable
- MiniPlayerIcon in top-left corner toggles ControlToolbar visibility
- ControlToolbar slides up from bottom with animation
- Removed Bricks JSON UI dependency for main view
- All toolbar features preserved: open/prev/play/next/volume/tracks/repeat/fullscreen/playlist
This commit is contained in:
yumoqing 2026-06-22 20:47:27 +08:00
parent e7bca7269e
commit 20f4dec0b9

View File

@ -129,23 +129,37 @@ struct MiniPlayerApp: App {
struct BricksAppView: View {
@ObservedObject var bridge: PlayerBridge
@ObservedObject var engine: BricksEngine
@State private var jsonString: String?
@State private var showToolbar = false
@State private var isHoveringIcon = false
var body: some View {
ZStack(alignment: .topLeading) {
if let json = jsonString {
BricksView(json: json, engine: engine)
} else {
ProgressView("Loading UI...")
.task {
jsonString = loadJSONString()
}
}
//
VideoPlayerRepresentable(player: bridge.player)
.ignoresSafeArea()
//
//
MiniPlayerIcon()
.frame(width: 32, height: 32)
.padding(12)
.opacity(isHoveringIcon ? 1.0 : 0.6)
.onHover { isHoveringIcon = $0 }
.onTapGesture {
withAnimation(.easeInOut(duration: 0.25)) {
showToolbar.toggle()
}
}
// /
VStack {
Spacer()
if showToolbar {
ControlToolbar(bridge: bridge, isHovering: .constant(false)) {
// onTouch:
}
.transition(.move(edge: .bottom).combined(with: .opacity))
}
}
}
.sheet(isPresented: $bridge.showURLDialog) {
URLInputDialog(bridge: bridge)
@ -157,20 +171,6 @@ struct BricksAppView: View {
PlaylistWindowView(bridge: bridge)
}
}
private func loadJSONString() -> String {
// Resources miniplayer.ui
if let url = Bundle.module.url(forResource: "miniplayer", withExtension: "ui"),
let data = try? Data(contentsOf: url),
let str = String(data: data, encoding: .utf8) {
return str
}
// Fallback: schema
return """
{"widgettype":"VBox","options":{"width":"100%","height":"100%"},"subwidgets":[{"widgettype":"Text","options":{"text":"Failed to load UI schema"}}]}
"""
}
}