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

When the video is loaded slowly, the current video will not be closed. When switching the video, there will be background music that does not close the video #44

Open
CarminBack opened this issue Mar 9, 2022 · 6 comments

Comments

@CarminBack
Copy link

When the video is loaded slowly, the current video will not be closed. When switching the video, there will be background music that does not close the video

@mjl0602
Copy link
Owner

mjl0602 commented Mar 11, 2022

Try call .pause() with every video player after your page dispose.

@sunjianan9900
Copy link

Try call .pause() with every video player after your page dispose.

实际情况是,有时候进入后台播放,实际已经脱离flutter的管理了,无法进行控制了,即使去控制对应index的视频,也只是在控制这个视频的另一个实例。或者说是,因为视频加载比较慢,这时候划走了,对flutter来说已经释放该视频,但是原生那里却开始背景播放,就好像脱离控制一样的感觉,即便是热重启也不行,必须冷启动重置。这个问题困扰了我很久还是解决不了。

@mjl0602
Copy link
Owner

mjl0602 commented Aug 1, 2022

@sunjianan9900 实际上,videoplayer一直会更新出奇奇怪怪的问题。本项目用videoplayer只是为了支持web,从代码也可以看出我并不想深度集成videoplayer,我提供了一个抽象层且限制了异步并发,来解决各种关于videoplayer的报错。如果你看log就会明白我已经在正确的时机调用各个函数,例如暂停/播放/加载/释放,但是videoplayer有些时候并不能正常响应这些函数调用。所以,如果videoplayer无法满足需求,你可以更换播放器,只需要实现对应的几个方法,很简单就可以替换成其他播放器。本项目也是从fijk换过来的。

@sunjianan9900
Copy link

@sunjianan9900 实际上,videoplayer一直会更新出奇奇怪怪的问题。本项目用videoplayer只是为了支持web,从代码也可以看出我并不想深度集成videoplayer,我提供了一个抽象层且限制了异步并发,来解决各种关于videoplayer的报错。如果你看log就会明白我已经在正确的时机调用各个函数,例如暂停/播放/加载/释放,但是videoplayer有些时候并不能正常响应这些函数调用。所以,如果videoplayer无法满足需求,你可以更换播放器,只需要实现对应的几个方法,很简单就可以替换成其他播放器。本项目也是从fijk换过来的。

理解,我不是说这个项目有什么问题,只是flutter视频播放的问题确实困扰了我很久。目前来看Flutter不太适合做Tiktok类型的应用了。

@mjl0602
Copy link
Owner

mjl0602 commented Aug 1, 2022

@sunjianan9900 其实,是videoplayer写的太差了,flutter反而展现出了非常高的性能。你能看到很多操作我都是大面积setState刷新,并不会造成任何卡顿,可以说明flutter的性能非常之强,几乎不用刻意考虑性能问题。关于播放器问题具体的你可以研究videoplayer,因为其实之前都是没有问题的,后面videoplayer更新后才会有这些问题,因为videoplayer一直写的不太好,我就一直没有去研究videoplayer具体是在哪儿改出的问题。

@dingjianjaja
Copy link

我也遇到了同样问题,请问这个问题有解决方案吗?

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