SuRGeoNix / Flyleaf

Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
GNU Lesser General Public License v3.0
708 stars 97 forks source link

Caching Support (for live streams, backwards seeking) #270

Open shushu789 opened 1 year ago

shushu789 commented 1 year ago

How to enable progress bar buffering for the flv from the URL (https://xxx.com/test.flv), for example, when I play the flv live broadcast of this URL address in the potplayer player, it can be played like a normal video To adjust the progress, for flv live streaming, at least you should be able to adjust the buffer position that has been played at will. I am currently using WPF. When I play the flv live stream in the URL, the progress bar slider will not move, it is always fixed at the current live time position. I'm new to Flyleaf, I checked the wiki and couldn't find instructions for that, maybe I'm missing something? Thank you!

my development environment

SuRGeoNix commented 1 year ago

@shushu789 Just to confirm, when you open the input (eg. with potplayer) you can't directly seek backwards, right? Only the time that you buffer and probably after sometime it will not buffer more (eg. 2min behind?). If that's the case currently Flyleaf, does not support backwards buffering/seeking.

shushu789 commented 1 year ago

@shushu789确认一下,当你打开输入时(比如用potplayer)你不能直接向后搜索,对吧?只有你缓冲的时间,可能在一段时间后它不会缓冲更多(例如,落后 2 分钟?)。如果目前 Flyleaf 是这种情况,则不支持向后缓冲/查找。

Playing flv live streaming on potplayer can buffer infinitely, that is to say, as long as it keeps playing, the buffered position will always be there. We can adjust the progress slider at any time to watch the previous position. It is not 2 minutes, there is no limit. It is similar to the video in the on-demand type, which is temporarily cached locally. In this way, users can watch back and forth some previously missed clips while playing the live stream. For example, a live stream address in tiktok (https://pull-flv-f11-sg01.tiktokcdn.com/stage/stream-7216991120713075457_or4.flv) is like this.

It may be possible to implement this function by generating a temporary cache while playing. When the player window is closed or the playback is stopped, the cached data will be deleted. But I don't know how to decode these cached data while playing this live stream to achieve this goal by adjusting the position of the slider at will. I don't know what you think, and the same is true for hls streams.

SuRGeoNix commented 1 year ago

Yes, that's local caching of potplayer. Flyleaf currently does caching(buffering) only for forward packets (based on Config.Demuxer.BufferDuration). I'm planning to support this in the future. Just wanted to make sure that the stream (input format) does not support seeking, currently live seeking is supporting in HLS (if the streams provide earlier cache)