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

FrescoImage cannot load animated gif image #767

Open
1 task done
ryanhoo opened this issue Feb 8, 2021 · 1 comment
Open
1 task done

FrescoImage cannot load animated gif image #767

ryanhoo opened this issue Feb 8, 2021 · 1 comment

Comments

@ryanhoo
Copy link

ryanhoo commented Feb 8, 2021

Version

The newest develop branch in litho repo.

Issues and Steps to Reproduce

Paste the code below to PlaygroundComponentSpec and run the litho sample project.
Issue: the gif image is not animating as expected.

Expected Behavior

The gif image can animated as it should be.

Link to Code

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.facebook.samples.litho.playground;

import android.graphics.Color;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.litho.Column;
import com.facebook.litho.Component;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.annotations.LayoutSpec;
import com.facebook.litho.annotations.OnCreateLayout;
import com.facebook.litho.fresco.FrescoImage;

@LayoutSpec
public class PlaygroundComponentSpec {

    @OnCreateLayout
    static Component onCreateLayout(ComponentContext c) {
        final String url = "https://ops-1300522992.cos.ap-guangzhou.myqcloud.com/doc/YZ/images/index/%E5%B0%8F%E9%B9%85%E5%AF%BB%E5%AE%9D%E5%85%A5%E5%8F%A3.gif";
        final DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setAutoPlayAnimations(true)
                .setUri(url)
                .build();
        return Column.create(c)
                .backgroundColor(Color.WHITE)
                .child(FrescoImage.create(c)
                        .controller(controller)
                        .imageAspectRatio(2f))
                .build();
    }
}
@colriot
Copy link
Contributor

colriot commented Feb 9, 2021

Hi @ryanhoo! Did it work before?
I'm not particularly familiar with that Fresco part. I'd suggest asking people in Fresco repo about how to better configure it.

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

2 participants