feat: 完善机巢任务实时状态、双路图传与继续查看入口
This commit is contained in:
@@ -23,7 +23,8 @@ final class DroneDockTaskLiveView: UIView {
|
||||
private var isPlaybackActive = false
|
||||
private let rtcView = UIView()
|
||||
private let rtcPlayer: any DroneDockLivePlaying
|
||||
private var requestedRTC: DroneDockVolcLiveConfiguration?
|
||||
private var requestedRTC: [DroneDockVolcLiveConfiguration] = []
|
||||
private var activeRTC: [DroneDockVolcLiveConfiguration] = []
|
||||
private var requestedSessionID: UUID?
|
||||
private var activeSessionID: UUID?
|
||||
|
||||
@@ -69,7 +70,7 @@ final class DroneDockTaskLiveView: UIView {
|
||||
requestButton.isHidden = model.actionTitle == nil
|
||||
requestButton.isEnabled = model.canLoad
|
||||
requestedURL = model.playbackURL.flatMap { $0.isFileURL ? $0 : nil }
|
||||
requestedRTC = model.rtcConfiguration
|
||||
requestedRTC = model.rtcConfigurations
|
||||
requestedSessionID = model.playbackSessionID
|
||||
let hasLocalPreview = requestedURL != nil
|
||||
let isPlaying = model.state == .playing
|
||||
@@ -147,12 +148,13 @@ final class DroneDockTaskLiveView: UIView {
|
||||
releaseRTC()
|
||||
return
|
||||
}
|
||||
if let config = requestedRTC, let sessionID = requestedSessionID {
|
||||
if !requestedRTC.isEmpty, let sessionID = requestedSessionID {
|
||||
releasePlayer()
|
||||
guard activeSessionID != sessionID else { return }
|
||||
releaseRTC()
|
||||
guard activeSessionID != sessionID || activeRTC != requestedRTC else { return }
|
||||
if activeSessionID != sessionID { releaseRTC() }
|
||||
activeSessionID = sessionID
|
||||
rtcPlayer.start(config, in: rtcView) { [weak self] event in
|
||||
activeRTC = requestedRTC
|
||||
rtcPlayer.start(requestedRTC, in: rtcView) { [weak self] event in
|
||||
guard let self, self.activeSessionID == sessionID else { return }
|
||||
self.onPlaybackEvent?(event, sessionID)
|
||||
}
|
||||
@@ -177,6 +179,7 @@ final class DroneDockTaskLiveView: UIView {
|
||||
private func releaseRTC() {
|
||||
guard activeSessionID != nil else { return }
|
||||
activeSessionID = nil
|
||||
activeRTC = []
|
||||
rtcPlayer.stop()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user