Skip to content

Commit

Permalink
Merge pull request #185 from dolbyio-samples/bugfix/stream-not-saved
Browse files Browse the repository at this point in the history
Fixes an issue where the stream is not saved when it's offline.
  • Loading branch information
aravind-raveendran authored May 12, 2024
2 parents b1fa808 + 97dd2a3 commit de9d6a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ final class RecentStreamsViewModel: ObservableObject {
}

func connect(streamDetail: SavedStreamDetail, saveLogs: Bool) -> Bool {
streamDataManager.updateLastUsedDate(for: streamDetail)

let currentDate = dateProvider.now
let rtcLogPath = saveLogs ? URL.rtcLogPath(for: currentDate) : nil
let sdkLogPath = saveLogs ? URL.sdkLogPath(for: currentDate) : nil
Expand All @@ -102,8 +104,6 @@ final class RecentStreamsViewModel: ObservableObject {
accountID: streamDetail.accountID,
configuration: configuration
)

self.streamDataManager.updateLastUsedDate(for: streamDetail)
}

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ final class StreamDetailInputViewModel: ObservableObject {
validationError = .emptyStreamNameOrAccountID
return false
}

if saveStream {
streamDataManager.saveStream(
SavedStreamDetail(
accountID: accountID,
streamName: streamName,
useDevelopmentServer: useDevelopmentServer,
videoJitterMinimumDelayInMs: videoJitterMinimumDelayInMs,
noPlayoutDelay: noPlayoutDelay,
disableAudio: disableAudio,
primaryVideoQuality: primaryVideoQuality,
saveLogs: saveLogs
)
)
}

let currentDate = dateProvider.now
let rtcLogPath = saveLogs ? URL.rtcLogPath(for: currentDate) : nil
let sdkLogPath = saveLogs ? URL.sdkLogPath(for: currentDate) : nil
Expand All @@ -74,21 +90,6 @@ final class StreamDetailInputViewModel: ObservableObject {
accountID: accountID,
configuration: configuration
)

if saveStream {
self.streamDataManager.saveStream(
.init(
accountID: accountID,
streamName: streamName,
useDevelopmentServer: useDevelopmentServer,
videoJitterMinimumDelayInMs: videoJitterMinimumDelayInMs,
noPlayoutDelay: noPlayoutDelay,
disableAudio: disableAudio,
primaryVideoQuality: primaryVideoQuality,
saveLogs: saveLogs
)
)
}
}

return true
Expand Down

0 comments on commit de9d6a5

Please sign in to comment.