Skip to content

Commit

Permalink
Fix performance issue (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
defagos authored Oct 23, 2024
1 parent 1ae9247 commit 478fd41
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/CommandersAct/iOSV5.git",
"state" : {
"revision" : "ec5b7d6192ce5ecd1ab40a8f7a6aa75a19f7d1c7",
"version" : "5.4.11"
"revision" : "24ffbad1da8467b615958be9d0dd1e92c4396699",
"version" : "5.4.12"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ enum ComScoreHitInterceptor {
}

private extension Notification.Name {
static let didReceiveComScoreRequest = Notification.Name("URLSessionDidReceiveComScoreRequestNotification")
static let didReceiveComScoreRequest = Notification.Name("PillarboxAnalytics_didReceiveComScoreRequest")
}

private extension URLSession {
Expand Down
6 changes: 3 additions & 3 deletions Sources/Monitoring/Types/Notification.Name.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import Foundation

enum MetricRequestInfoKey: String {
case identifier = "MetricRequestIdentifier"
case payload = "MetricRequestIdentifierPayload"
case identifier = "MetricRequestInfoKey_identifier"
case payload = "MetricRequestInfoKey_payload"
}

extension Notification.Name {
static let didSendMetricRequest = Notification.Name(rawValue: "MetricsTrackerDidSendMetricRequestNotification")
static let didSendMetricRequest = Notification.Name(rawValue: "PillarboxMonitoring_didSendMetricRequest")
}
2 changes: 1 addition & 1 deletion Sources/Player/Extensions/AVAudioSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ extension AVAudioSession {
}

extension Notification.Name {
static let didUpdateAudioSessionOptions = Notification.Name("PillarboxPlayerDidUpdateAudioSessionOptionsNotification")
static let didUpdateAudioSessionOptions = Notification.Name("PillarboxPlayer_didUpdateAudioSessionOptions")
}
4 changes: 2 additions & 2 deletions Sources/Player/Extensions/Notification.Name.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ enum SeekKey: String {
}

extension Notification.Name {
static let willSeek = Notification.Name("QueuePlayerWillSeekNotification")
static let didSeek = Notification.Name("QueuePlayerDidSeekNotification")
static let willSeek = Notification.Name("PillarboxPlayer_willSeekNotification")
static let didSeek = Notification.Name("PillarboxPlayer_didSeekNotification")
}
12 changes: 3 additions & 9 deletions Sources/Player/Player+PlaybackSpeed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension Player {
Publishers.Merge3(
desiredPlaybackSpeedUpdatePublisher(),
supportedPlaybackSpeedPublisher(),
avPlayerViewControllerPlaybackSpeedUpdatePublisher()
defaultRateSpeedUpdatePublisher()
)
.removeDuplicates()
.eraseToAnyPublisher()
Expand Down Expand Up @@ -92,14 +92,8 @@ private extension Player {
.eraseToAnyPublisher()
}

func avPlayerViewControllerPlaybackSpeedUpdatePublisher() -> AnyPublisher<PlaybackSpeedUpdate, Never> {
propertiesPublisher
.slice(at: \.rate)
.filter { rate in
rate != 0 && Thread.callStackSymbols.contains { symbol in
symbol.contains("AVPlayerController")
}
}
func defaultRateSpeedUpdatePublisher() -> AnyPublisher<PlaybackSpeedUpdate, Never> {
queuePlayer.publisher(for: \.defaultRate)
.removeDuplicates()
.map { .value($0) }
.eraseToAnyPublisher()
Expand Down

0 comments on commit 478fd41

Please sign in to comment.