move onReceive to the chapter header in VideoDetails

This commit is contained in:
Toni Förster 2023-12-04 23:00:20 +01:00
parent d361ef01d4
commit 4ca8adc4dd
No known key found for this signature in database
GPG Key ID: 292F3E5086C83FC7
2 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,3 @@
import CoreMedia
import Foundation
import SDWebImageSwiftUI
import SwiftUI
@ -24,15 +23,6 @@ import SwiftUI
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.onReceive(
NotificationCenter.default
.publisher(for: .getTimeUpdatesNotification)
.receive(on: DispatchQueue.main)
) { notification in
if let cmTime = notification.object as? CMTime {
player.updateTime(cmTime)
}
}
}
var verticalChapter: some View {

View File

@ -1,3 +1,4 @@
import CoreMedia
import Defaults
import Foundation
import SDWebImageSwiftUI
@ -485,6 +486,15 @@ struct VideoDetails: View {
.padding(.horizontal)
}
}
.onReceive(
NotificationCenter.default
.publisher(for: .getTimeUpdatesNotification)
.receive(on: DispatchQueue.main)
) { notification in
if let cmTime = notification.object as? CMTime {
player.updateTime(cmTime)
}
}
}
}