Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix iOS above 2.0 playback speed bug #356

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/pages/history/history_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ class _HistoryPageState extends State<HistoryPage>
SliverPadding(
padding: const EdgeInsets.only(
left: StyleString.cardSpace + 2,
right: StyleString.cardSpace + 2),
right: StyleString.cardSpace + 2,
bottom: StyleString.safeSpace * 2),
sliver: SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
mainAxisSpacing: StyleString.cardSpace - 2,
Expand Down
9 changes: 5 additions & 4 deletions lib/pages/player/player_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class _PlayerItemState extends State<PlayerItem>
Timer? playerTimer;
Timer? mouseScrollerTimer;

double lastPlayerSpeed = 1.0;

/// 处理 Android/iOS 应用后台或熄屏
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
Expand Down Expand Up @@ -857,8 +859,8 @@ class _PlayerItemState extends State<PlayerItem>
setState(() {
showPlaySpeed = true;
});
playerController.setPlaybackSpeed(
playerController.playerSpeed * 2.5);
lastPlayerSpeed = playerController.playerSpeed;
playerController.setPlaybackSpeed(2.0);
},
onLongPressEnd: (_) {
if (lockPanel) {
Expand All @@ -867,8 +869,7 @@ class _PlayerItemState extends State<PlayerItem>
setState(() {
showPlaySpeed = false;
});
playerController.setPlaybackSpeed(
playerController.playerSpeed / 2.5);
playerController.setPlaybackSpeed(lastPlayerSpeed);
},
child: Container(
color: Colors.transparent,
Expand Down
8 changes: 2 additions & 6 deletions lib/utils/constans.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Map<String, String> bangumiHTTPHeader = {
'referer': '',
};

// 可选播放倍速
// 可选播放倍速,iOS平台有的视频无法以高于2.0的播放倍速播放
const List<double> playSpeedList = [
0.25,
0.5,
Expand All @@ -39,11 +39,7 @@ const List<double> playSpeedList = [
1.25,
1.5,
1.75,
2.0,
2.25,
2.5,
2.75,
3.0
2.0
];

// 可选弹幕透明度
Expand Down