benwiley4000 / react-gif-player

📽 A GIF component that moves when YOU want it to!
https://benwiley4000.github.io/react-gif-player/
MIT License
94 stars 32 forks source link

Gif working without click event #12

Closed vikramjit575 closed 6 years ago

vikramjit575 commented 7 years ago

I am using the same code and when my page loads gif starts playing by itself without click event

benwiley4000 commented 7 years ago

Thanks for pointing out your issue! I'm wondering a few things that will help me diagnose this:

  1. Are you specifying a still prop? (It's fine not to, but the calculated still frame won't be available until the gif has fully loaded).
  2. Is the component in the playing state (i.e. the button is hidden)?
  3. Does it stop playing after the gif has loaded?

Thanks again

vikramjit575 commented 7 years ago

Hi

1.Yes i am specifying a still prop and its value is still image of the gif

Here is how i used it <GifPlayer gif="public/images/GuruRamDass.gif" still="public/images/GuruRamDass.jpg" />

3.No it keeps on playing by its own

vikramjit575 commented 7 years ago

I tested it after removing still props.It works fine after that:)

benwiley4000 commented 7 years ago

Glad you found something that's working for you! 🙂 However I'm still a bit confused about the issue you're experiencing when you do specify the still frame. I'd love to help solve it - is there any way you could provide a repo demoing the problem?

benwiley4000 commented 7 years ago

I should add, not specifying a still probably does look fine while you're testing locally, but it may look less good on a slow internet connection.

vikramjit575 commented 7 years ago

yes thanks a lot for addressing my concern and i will update my repo very soon:)

benwiley4000 commented 7 years ago

Thanks I look forward to it! Please keep me posted.

benwiley4000 commented 7 years ago

@vikramjit575 I'd still love to see your code example when available. Will you still have one soon?

andrewjroyce commented 7 years ago

When I have both gif and still set to the same .gif I want to use, it autoplays - which is the behavior I want anyway.

benwiley4000 commented 7 years ago

@andrewjroyce hm, that would be expected behavior. There's no validation on the image source you provide for either prop, so providing your gif as the still would mean the gif would play.

However that seems undesirable - you won't have a "paused" state to go back to.

Do you think there should be a defaultPaused prop (true by default)?

andrewjroyce commented 7 years ago

I've combined this with a tooltip, so it automatically plays on hover (tooltip opens) and stops on leave (tooltip closes) I don't see a need for that as a prop as the default is already paused, and that behavior can be circumvented with the method I described.

benwiley4000 commented 7 years ago

@andrewjroyce just to humor me, could you provide a code snippet demonstrating what you've just described? I'm curious, and also not sure I'm totally following.

benwiley4000 commented 6 years ago

Closing as there's been no followup and the autoplay prop is introduced in v0.3.0. Please comment if you believe something here hasn't been addressed! :slightly_smiling_face: