Closed mshandan closed 1 year ago
Please attach the reproducer project.
Could you create a repository for that? Don't forget to include the affected GIF file.
hello,I wrote a simple repository that can basically reproduce the phenomenon of lag, which is a white screen phenomenon.
I look forward to your reply very much. I'm not sure if my writing is incorrect. This phenomenon has indeed caused me a lot of trouble.
OK thanks, I'll check that.
It seems to be the same issue as https://github.com/koral--/android-gif-drawable/issues/267#issuecomment-206962158 You can modify your Handler like in the linked comment.
Okay, I'll take a look
I'm very sorry, I can't understand what this "source" means? I don't know how to associate GifImageView in XML with this. Can you provide a detailed explanation?
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); ExecutorHandler handler = new ExecutorHandler(executor); gifDrawable = new GifDrawableBuilder().taskExecutor(executor).from(source).build();
source
is resoruces, R.mimpap.<id>
in your case.
Instead of using XML, associate the drawable with view in the code:
gifImageView.setImageDrawable(gifDrawable)
Okay, where should I control the changes in gif frames? I tried to add logic to modify gif frames in ExecutorHandler, but it doesn't seem to change the playback of gifs?
I've deleted a duplicated comment. You don't have to add any logic to modify frames. Here are the only modifications: https://github.com/mshandan/demo/compare/main...koral--:demo:main
Sorry, it's possible that I didn't describe my problem clearly. I now need to implement a function that changes the display of gif based on a parameter. If the value is large, the gif will play to the back, and if the value is small, the gif will fall back to the front. In short, gif has 60 frames. When my parameter is 5, frame 5 is displayed, and when my parameter is 40, frame 40 is displayed.
Using ExecutorHandler, I feel that the playback of gif is indeed very smooth, but this is not the feature I need, which is very regrettable.
Ok now it seems I understand. I'm afraid you can't achieve smoother seeking using this library. The frames of a gif can contain only a difference between the actual frames which user sees. So in order to render the 100th frame it may be needed to render all the 99 frames before.
I'm closing this issue as it seems to be answered, but you can still comment if needed.
Hello, I have encountered some issues while using it. Mainly using the seekToFrame() method, there will be a black screen phenomenon.