1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 06:10:32 +05:30
yattee/Shared/Player/PlayerQueueRow.swift
Arkadiusz Fal 70c089e696 Initial functionality of player items queue
Fix environment objects

Hide video player placeholder on tvOS

Queue improvements
2021-10-13 23:47:56 +02:00

38 lines
1.0 KiB
Swift

import Foundation
import SwiftUI
struct PlayerQueueRow: View {
let item: PlayerQueueItem
var history = false
@Binding var fullScreen: Bool
@EnvironmentObject<PlayerModel> private var player
var body: some View {
Group {
Button {
player.addCurrentItemToHistory()
if history {
let newItem = player.enqueueVideo(item.video, prepending: true)
player.advanceToItem(newItem!)
if let historyItemIndex = player.history.firstIndex(of: item) {
player.history.remove(at: historyItemIndex)
}
} else {
player.advanceToItem(item)
}
if fullScreen {
withAnimation {
fullScreen = false
}
}
} label: {
VideoBanner(video: item.video)
}
.buttonStyle(.plain)
}
}
}