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

[BUG]使用PageView组件滑动时视频会出现闪动 #623

Open
WenjieZhengJerry opened this issue Jan 23, 2024 · 4 comments
Open

[BUG]使用PageView组件滑动时视频会出现闪动 #623

WenjieZhengJerry opened this issue Jan 23, 2024 · 4 comments

Comments

@WenjieZhengJerry
Copy link

Describe the bug
使用flutter官方组件PageView滑动Page时视频会出现闪动,闪动的画面是下一个Page的视频画面,详情请看录屏

What attempts have you made to resolve this error ?
给FijkView添加了GlobalKey然而并不起作用

To Reproduce
问题的复现步骤

  1. 滑动时使当前视频到达屏幕顶部,当视频被tabbar遮挡时会出现闪动
  2. 来回滑动必定触发
  3. 除了上下滑动之外,左右滑动也会触发,只是触发概率没有上下滑动高

Expected behavior
上下滑动时不出现闪动

Screenshots
录屏路径:https://github.com/befovy/fijkplayer/assets/43103543/253d0ad3-fa1a-48b4-a9b9-62564fa7bd66

fijkplayer version
fijkplayer: 0.11.0

Smartphone (please complete the following information):
Android Studio模拟器:Pixel 7 Pro API 34

Additional context
下面是我的代码:

class ScrollPlayer extends StatefulWidget {
  const ScrollPlayer({super.key});

  @override
  State<ScrollPlayer> createState() => _ScrollPlayerState();
}

class _ScrollPlayerState extends State<ScrollPlayer> {
  final List<(FijkPlayer, GlobalKey)> playerList = [(FijkPlayer(), GlobalKey()),(FijkPlayer(), GlobalKey())];

  @override
  void initState() {
    super.initState();
    playerList[0].$1.setDataSource('https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4', showCover: true);
    playerList[1].$1.setDataSource('https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4', showCover: true);
  }

  @override
  Widget build(BuildContext context) {
    return PageView.builder(
      scrollDirection: Axis.vertical,
      itemCount: playerList.length,
      itemBuilder: (BuildContext context, int index) {
        return _buildItem(playerList[index].$1, playerList[index].$2);
      },
    );
  }

  Widget _buildItem(FijkPlayer player, GlobalKey globalKey) {
    return Container(key: globalKey, child: FijkView(player: player));
  }
}
@caisimai
Copy link

caisimai commented Mar 5, 2024

同样情况,您解决了吗?

@WenjieZhengJerry
Copy link
Author

同样情况,您解决了吗?

没解决,不知道什么问题。

@CYscared
Copy link

我也碰到了,我pageview开启allowImplicitScrolling属性就发现了这个问题。然后我是纵向pageview发现的,然后改成横向的发现100%出现,纵向还好,偶现。

@OnClickListener2048
Copy link

up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants