auto play on tvOS
This commit is contained in:
parent
47249c2edd
commit
a9d37033e6
|
@ -75,7 +75,7 @@ struct tvOSOverlayContentView_Previews: PreviewProvider {
|
||||||
overlayType: .compact,
|
overlayType: .compact,
|
||||||
shouldShowPlayPreviousItem: true,
|
shouldShowPlayPreviousItem: true,
|
||||||
shouldShowPlayNextItem: true,
|
shouldShowPlayNextItem: true,
|
||||||
shouldShowAutoPlayNextItem: true)
|
shouldShowAutoPlay: true)
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
|
|
@ -55,7 +55,6 @@ struct tvOSVLCOverlay: View {
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
|
|
||||||
if viewModel.shouldShowPlayPreviousItem {
|
if viewModel.shouldShowPlayPreviousItem {
|
||||||
SFSymbolButton(systemName: "chevron.left.circle", action: {
|
SFSymbolButton(systemName: "chevron.left.circle", action: {
|
||||||
viewModel.playerOverlayDelegate?.didSelectPlayPreviousItem()
|
viewModel.playerOverlayDelegate?.didSelectPlayPreviousItem()
|
||||||
|
@ -74,6 +73,18 @@ struct tvOSVLCOverlay: View {
|
||||||
.foregroundColor(viewModel.nextItemVideoPlayerViewModel == nil ? .gray : .white)
|
.foregroundColor(viewModel.nextItemVideoPlayerViewModel == nil ? .gray : .white)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if viewModel.shouldShowAutoPlay {
|
||||||
|
Button {
|
||||||
|
viewModel.autoplayEnabled.toggle()
|
||||||
|
} label: {
|
||||||
|
if viewModel.autoplayEnabled {
|
||||||
|
Image(systemName: "play.circle.fill")
|
||||||
|
} else {
|
||||||
|
Image(systemName: "stop.circle")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !viewModel.subtitleStreams.isEmpty {
|
if !viewModel.subtitleStreams.isEmpty {
|
||||||
if viewModel.subtitlesEnabled {
|
if viewModel.subtitlesEnabled {
|
||||||
SFSymbolButton(systemName: "captions.bubble.fill") {
|
SFSymbolButton(systemName: "captions.bubble.fill") {
|
||||||
|
@ -140,7 +151,7 @@ struct tvOSVLCOverlay_Previews: PreviewProvider {
|
||||||
overlayType: .compact,
|
overlayType: .compact,
|
||||||
shouldShowPlayPreviousItem: true,
|
shouldShowPlayPreviousItem: true,
|
||||||
shouldShowPlayNextItem: true,
|
shouldShowPlayNextItem: true,
|
||||||
shouldShowAutoPlayNextItem: true)
|
shouldShowAutoPlay: true)
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct VLCPlayerOverlayView: View {
|
||||||
.foregroundColor(viewModel.nextItemVideoPlayerViewModel == nil ? .gray : .white)
|
.foregroundColor(viewModel.nextItemVideoPlayerViewModel == nil ? .gray : .white)
|
||||||
}
|
}
|
||||||
|
|
||||||
if viewModel.shouldShowAutoPlayNextItem {
|
if viewModel.shouldShowAutoPlay {
|
||||||
Button {
|
Button {
|
||||||
viewModel.autoplayEnabled.toggle()
|
viewModel.autoplayEnabled.toggle()
|
||||||
} label: {
|
} label: {
|
||||||
|
@ -337,7 +337,7 @@ struct VLCPlayerCompactOverlayView_Previews: PreviewProvider {
|
||||||
overlayType: .compact,
|
overlayType: .compact,
|
||||||
shouldShowPlayPreviousItem: true,
|
shouldShowPlayPreviousItem: true,
|
||||||
shouldShowPlayNextItem: true,
|
shouldShowPlayNextItem: true,
|
||||||
shouldShowAutoPlayNextItem: true)
|
shouldShowAutoPlay: true)
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ZStack {
|
ZStack {
|
||||||
|
|
|
@ -116,7 +116,7 @@ extension BaseItemDto {
|
||||||
overlayType: overlayType,
|
overlayType: overlayType,
|
||||||
shouldShowPlayPreviousItem: shouldShowPlayPreviousItem,
|
shouldShowPlayPreviousItem: shouldShowPlayPreviousItem,
|
||||||
shouldShowPlayNextItem: shouldShowPlayNextItem,
|
shouldShowPlayNextItem: shouldShowPlayNextItem,
|
||||||
shouldShowAutoPlayNextItem: shouldShowAutoPlay)
|
shouldShowAutoPlay: shouldShowAutoPlay)
|
||||||
|
|
||||||
return videoPlayerViewModel
|
return videoPlayerViewModel
|
||||||
})
|
})
|
||||||
|
|
|
@ -53,7 +53,7 @@ final class VideoPlayerViewModel: ViewModel {
|
||||||
|
|
||||||
let shouldShowPlayPreviousItem: Bool
|
let shouldShowPlayPreviousItem: Bool
|
||||||
let shouldShowPlayNextItem: Bool
|
let shouldShowPlayNextItem: Bool
|
||||||
let shouldShowAutoPlayNextItem: Bool
|
let shouldShowAutoPlay: Bool
|
||||||
|
|
||||||
// MARK: General
|
// MARK: General
|
||||||
let item: BaseItemDto
|
let item: BaseItemDto
|
||||||
|
@ -104,9 +104,7 @@ final class VideoPlayerViewModel: ViewModel {
|
||||||
overlayType: OverlayType,
|
overlayType: OverlayType,
|
||||||
shouldShowPlayPreviousItem: Bool,
|
shouldShowPlayPreviousItem: Bool,
|
||||||
shouldShowPlayNextItem: Bool,
|
shouldShowPlayNextItem: Bool,
|
||||||
shouldShowAutoPlayNextItem: Bool
|
shouldShowAutoPlay: Bool) {
|
||||||
|
|
||||||
) {
|
|
||||||
self.item = item
|
self.item = item
|
||||||
self.title = title
|
self.title = title
|
||||||
self.subtitle = subtitle
|
self.subtitle = subtitle
|
||||||
|
@ -122,7 +120,7 @@ final class VideoPlayerViewModel: ViewModel {
|
||||||
self.overlayType = overlayType
|
self.overlayType = overlayType
|
||||||
self.shouldShowPlayPreviousItem = shouldShowPlayPreviousItem
|
self.shouldShowPlayPreviousItem = shouldShowPlayPreviousItem
|
||||||
self.shouldShowPlayNextItem = shouldShowPlayNextItem
|
self.shouldShowPlayNextItem = shouldShowPlayNextItem
|
||||||
self.shouldShowAutoPlayNextItem = shouldShowAutoPlayNextItem
|
self.shouldShowAutoPlay = shouldShowAutoPlay
|
||||||
|
|
||||||
self.jumpBackwardLength = Defaults[.videoPlayerJumpBackward]
|
self.jumpBackwardLength = Defaults[.videoPlayerJumpBackward]
|
||||||
self.jumpForwardLength = Defaults[.videoPlayerJumpForward]
|
self.jumpForwardLength = Defaults[.videoPlayerJumpForward]
|
||||||
|
|
Loading…
Reference in New Issue