From 541f9fef73e3106b7d95abe4a50bb5a8c4fe03b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=B3=A2Zac?= Date: Sun, 2 Jul 2023 21:11:13 +0900 Subject: [PATCH 1/3] Update CommonPlayerViewController.swift Fixed the bug that play speed will reset to 1 when pause and play the video. --- BilibiliLive/Component/Player/CommonPlayerViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BilibiliLive/Component/Player/CommonPlayerViewController.swift b/BilibiliLive/Component/Player/CommonPlayerViewController.swift index 05c0b620..8607632c 100644 --- a/BilibiliLive/Component/Player/CommonPlayerViewController.swift +++ b/BilibiliLive/Component/Player/CommonPlayerViewController.swift @@ -205,7 +205,7 @@ class CommonPlayerViewController: AVPlayerViewController { let speedActions = playSpeedArray.map { playSpeed in UIAction(title: playSpeed.name, state: player?.rate ?? 1 == playSpeed.value ? .on : .off) { [weak self] action in self?.player?.currentItem?.audioTimePitchAlgorithm = .timeDomain - self?.player?.rate = playSpeed.value + self?.selectSpeed(AVPlaybackSpeed(rate: playSpeed.value, localizedName: playSpeed.name)) self?.danMuView.playingSpeed = playSpeed.value } } From 726041a86f991b2ed75e8c0b164df7a321ac0555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=B3=A2Zac?= Date: Mon, 3 Jul 2023 21:40:51 +0900 Subject: [PATCH 2/3] Added OS version check --- .../Component/Player/CommonPlayerViewController.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/BilibiliLive/Component/Player/CommonPlayerViewController.swift b/BilibiliLive/Component/Player/CommonPlayerViewController.swift index 8607632c..2610c87c 100644 --- a/BilibiliLive/Component/Player/CommonPlayerViewController.swift +++ b/BilibiliLive/Component/Player/CommonPlayerViewController.swift @@ -205,7 +205,11 @@ class CommonPlayerViewController: AVPlayerViewController { let speedActions = playSpeedArray.map { playSpeed in UIAction(title: playSpeed.name, state: player?.rate ?? 1 == playSpeed.value ? .on : .off) { [weak self] action in self?.player?.currentItem?.audioTimePitchAlgorithm = .timeDomain - self?.selectSpeed(AVPlaybackSpeed(rate: playSpeed.value, localizedName: playSpeed.name)) + #available(tvOS 16.0, *) { + self?.selectSpeed(AVPlaybackSpeed(rate: playSpeed.value, localizedName: playSpeed.name)) + } else { + self?.player?.rate = playSpeed.value + } self?.danMuView.playingSpeed = playSpeed.value } } From 610a4923233a907694a38e56127f706330e0ace9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=B3=A2Zac?= Date: Tue, 4 Jul 2023 21:00:39 +0900 Subject: [PATCH 3/3] Update CommonPlayerViewController.swift --- BilibiliLive/Component/Player/CommonPlayerViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BilibiliLive/Component/Player/CommonPlayerViewController.swift b/BilibiliLive/Component/Player/CommonPlayerViewController.swift index 2610c87c..c4a6195c 100644 --- a/BilibiliLive/Component/Player/CommonPlayerViewController.swift +++ b/BilibiliLive/Component/Player/CommonPlayerViewController.swift @@ -205,7 +205,7 @@ class CommonPlayerViewController: AVPlayerViewController { let speedActions = playSpeedArray.map { playSpeed in UIAction(title: playSpeed.name, state: player?.rate ?? 1 == playSpeed.value ? .on : .off) { [weak self] action in self?.player?.currentItem?.audioTimePitchAlgorithm = .timeDomain - #available(tvOS 16.0, *) { + if #available(tvOS 16.0, *) { self?.selectSpeed(AVPlaybackSpeed(rate: playSpeed.value, localizedName: playSpeed.name)) } else { self?.player?.rate = playSpeed.value