befovy / fijkplayer

ijkplayer for flutter. ijkplayer 的 flutter 封装。 Flutter video/audio player. Flutter media player plugin for android/iOS based on ijkplayer. fijkplayer 是基于 ijkplayer 封装的 flutter 媒体播放器,开箱即用,无需编译 ijkplayer
https://fijkplayer.befovy.com
MIT License
1.64k stars 347 forks source link

How to get a callback or silently render first image/frame of the Video #328

Open aytunch opened 4 years ago

aytunch commented 4 years ago

How I can make the video in a state that it is showing the first frame/image and stays in a paused state? After the Video is in the prepared state, I make: controller.seekTo(100) But I still see a black screen. I see that IjkPlayer has a setOnSeekCompleteListener and a OnSeekComplete. Do we have something similar which tells us that the seek has finished? Only way to see an image is to controller.start. But I don't want the video to play.

In IjkPlayer, they say different solutions like: we should listen to MEDIA_INFO_VIDEO_RENDERING_START or IJKMPMoviePlayerFirstVideoFrameRendered or IJKMPMoviePlayerFirstVideoFrameRenderedNotification.

But I could not find anything similar to these 3 in FijkPlayer. Can you please show me how to render first frame after prepare state?

MichaelPei commented 3 years ago

You can achieve this by FijkPlayer's setDataSource method with parameters autoPlay false and showCover true according to FAQ https://fijkplayer.befovy.com/docs/zh/faq.html#%E6%92%AD%E6%94%BE%E5%99%A8%E5%B0%81%E9%9D%A2%E5%9B%BE%E7%89%87

And BTW, this will cause more memory usage and more loading time according to author, you'd better set another image (from local or from network) as cover.