我想创建一个像YouTube一样创建flutter应用程序,我希望我的应用程序具有无限的滚动卡列表,默认情况下,该卡将显示图像。如果用户停止滚动,则只有视口中的第一张卡就会开始播放视频。该视频只能在屏幕上可见时播放,并且一旦移出视口就应该停止。
例如:
我不知道我必须使用哪个包。 YouTube播放器会颤抖吗?
I wanted to create a flutter app just like youtube, I want my app to have an infinite scrolling list of cards where by default the card will display an image. If the user stops scrolling, then only the first card in the viewport will start playing a video. The video should only play while the card is visible on the screen and should stop as soon as it moves out of the viewport.
For example:
https://drive.google.com/file/d/19HMdjrFl8ZbE5TEE3ekq62wMjNl0eWpU/view
I have no idea on which package I have to use. Will flutter youtube player work?
发布评论
评论(3)
使用控制器添加listView。考虑一张高度200的卡。现在,如果控制器偏移量为800,则播放该800/200的视频。这是第四。您可以使用任何可以选择并停止视频的视频播放器软件包
Add a listview with a controller. consider a card of height 200. Now if the controller offset is 800 play the video of that 800/200. Which is 4th one. You can use any video player package which has an option to statt and stop video
您好检查此软件包并尝试测试它,以查看是否是您的解决方案。
https://pub.dev/packages/inview_notifier_list
Hello check this package and try to test it to see if it is your solution.
https://pub.dev/packages/inview_notifier_list
使用
visibilityDetector
检测屏幕上的视频是否可见use
VisibilityDetector
to detect if the video is visible on the screen