gadenbuie / xaringanExtra

:ferris_wheel: A playground of enhancements and extensions for xaringan slides.
https://pkg.garrickadenbuie.com/xaringanExtra
Other
448 stars 36 forks source link

freezeFrame() has inconsistent behavior #145

Open gpapageorgiou opened 2 years ago

gpapageorgiou commented 2 years ago

I have been experiencing some inconsistent behavior with xaringanExtra:::use_freezeframe(). Most of the times seems to work but there are instances that some of the .gif files will be already playing when reaching the corresponding slide.

The issue seems to be present mostly when viewing the slides in chrome (e.g. not in Rstudio's viewer).

For example if I open in chrome and go back and forward between the two gif slides, it is not always the case that they will start from the beginning. I can tell however that use_freezeframe() works as when I click on the slide the animation stops and when I click again it starts from the beginning. However, the moment I turn on the slide with the animation sometimes it seems to be already playing rather than starting from the beginning.

I tried to create a reproducible example below:

---
title: "Presentation"
subtitle: ""
author: ""
institute: "RStudio, PBC"
date: "2016/12/12 (updated: `r Sys.Date()`)"
output:
  xaringan::moon_reader:
    self_contained: true
    css: ["default", "custom.css"]
    lib_dir: libs
    nature:
      ratio: '16:9'
      highlightStyle: github
      highlightLines: true
      countIncrementalSlides: false
    seal: false
---

```{r xaringanExtra-freezeframe, echo=FALSE}
xaringanExtra:::use_freezeframe()



gadenbuie commented 2 years ago

I've noticed this too on occasion and had a really hard time reproducing it or figuring out the context in which it happens.

Thanks for submitting an example, but it's not quite a reprex yet since I don't have custom.css, animation_haz.gif or animation_obs.gif. If you can create a reprex that doesn't include those files (you can see the freezeframe docs for some examples gifs you could use), I'd be happy to take another look.