Close revoked remote sessions and document installation requirements
iOS build and tests / simulator (push) Has been cancelled
iOS build and tests / simulator (push) Has been cancelled
This commit is contained in:
@@ -45,7 +45,8 @@ final class PCMediaSession: RemoteMediaSessionRepresentable {
|
||||
}
|
||||
|
||||
var commands: [MediaCommand] {
|
||||
[
|
||||
guard attributes.hasSession else { return [] }
|
||||
return [
|
||||
.play { try await self.send(.play) }.enabled(attributes.capabilities.play),
|
||||
.pause { try await self.send(.pause) }.enabled(attributes.capabilities.pause),
|
||||
.next { try await self.send(.next) }.enabled(attributes.capabilities.next),
|
||||
@@ -62,7 +63,15 @@ final class PCMediaSession: RemoteMediaSessionRepresentable {
|
||||
}
|
||||
|
||||
private func send(_ action: SystemPlayerAction, value: Double? = nil) async throws {
|
||||
let state = try await transport.send(action, value: value, sessionID: id)
|
||||
attributes = SystemPlayerAttributes(id: id, state: state)
|
||||
do {
|
||||
let state = try await transport.send(action, value: value, sessionID: id)
|
||||
attributes = SystemPlayerAttributes(id: id, state: state)
|
||||
} catch BridgeError.unauthorized {
|
||||
try SystemPlayerCredentials.delete(id)
|
||||
attributes.hasSession = false
|
||||
attributes.playing = false
|
||||
attributes.volume = nil
|
||||
throw BridgeError.unauthorized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user