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

Make animated image playback speed match browser (Firefox and Chrome) behaviour #3506

Merged

Conversation

goldbattle
Copy link
Contributor

@goldbattle goldbattle commented Jan 14, 2022

Pull request checklist:

  • CHANGELOG.md was updated, if applicable

Description

Animated emotes can have very fast animation compared to the twitch web viewer. This is caused by the browser enforcing a minimum frame time. For example an emote could be animated in chatterino at 1ms per frame, but in any web browser the actual framerate is 100ms for frame. I think most people would expect emotes the behave like in the browser. See this issue for some background: SevenTV#46

Details on how browsers implement it are here:
https://source.chromium.org/chromium/chromium/src/+/fe1bca993584d616f52d9088d6b1411537441e9d:third_party/blink/renderer/platform/graphics/deferred_image_decoder.cc;l=353-360;bpv=1;bpt=0
https://bugzilla.mozilla.org/show_bug.cgi?id=1511298#c7

base::TimeDelta DeferredImageDecoder::FrameDurationAtIndex(size_t index) const {
  base::TimeDelta duration;
  if (metadata_decoder_)
    duration = metadata_decoder_->FrameDurationAtIndex(index);
  if (index < frame_data_.size())
    duration = frame_data_[index].duration_;
  // Many annoying ads specify a 0 duration to make an image flash as quickly as
  // possible. We follow Firefox's behavior and use a duration of 100 ms for any
  // frames that specify a duration of <= 10 ms. See <rdar://problem/7689300>
  // and <http://webkit.org/b/36082> for more information.
  if (duration <= base::TimeDelta::FromMilliseconds(10))
    duration = base::TimeDelta::FromMilliseconds(100);
  return duration;
}

@Felanbird
Copy link
Collaborator

I don't have this issue so I'm not sure if this fixes it, but both PR's will need a Changelog entry either way.

@jupjohn
Copy link
Contributor

jupjohn commented Jan 14, 2022

SevenTV#46 is is actually caused by missing frames, unrelated :)

src/messages/Image.cpp Outdated Show resolved Hide resolved
src/messages/Image.cpp Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@pajlada pajlada changed the title Fix animated emote playback rate Make animated emote playback speed match browser (Firefox and Chrome) behaviour Jan 15, 2022
@pajlada pajlada changed the title Make animated emote playback speed match browser (Firefox and Chrome) behaviour Make animated image playback speed match browser (Firefox and Chrome) behaviour Jan 15, 2022
goldbattle and others added 3 commits January 15, 2022 12:27
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
@goldbattle goldbattle requested a review from pajlada January 15, 2022 17:41
@zneix zneix enabled auto-merge (squash) January 15, 2022 19:04
@zneix zneix merged commit e742860 into Chatterino:master Jan 15, 2022
@goldbattle goldbattle deleted the to-upstream-fix-emote-playback-rate branch January 15, 2022 19:38
@pajlada
Copy link
Member

pajlada commented Jan 16, 2022

Thanks for your contribution! As a first-time contributor, you can now add yourself to the contributors list that's shown inside the application.

To do so, open a new PR where you modify the resources/contributors.txt file and add yourself to the list. Make sure to read the comments at a top for instructions.

zneix added a commit to SevenTV/chatterino7 that referenced this pull request Jan 16, 2022
Now we're on commit 1d272c3; Changes from upstream we've pulled

- Minor: Make animated emote playback speed match browser (Firefox and Chrome) behaviour. (Chatterino#3506)
- Minor: Add feedback when using the whisper command `/w` incorrectly. (Chatterino#3439)
- Minor: Add feedback when writing a non-command message in the `/whispers` split. (Chatterino#3439)
- Minor: Opening streamlink through hotkeys and/or split header menu matches `/streamlink` command and shows feedback in chat as well. (Chatterino#3510)
- Minor: Removed timestamp from AutoMod messages. (Chatterino#3503)
- Minor: Added ability to copy message ID with `Shift + Right Click`. (Chatterino#3481)
- Bugfix: Fixed crash that would occur if the user right-clicked AutoMod badge. (Chatterino#3496)
- Bugfix: Fixed being unable to drag the user card window from certain spots. (Chatterino#3508)
- Bugfix: Fixed being unable to open a usercard from inside a usercard while "Automatically close user popup when it loses focus" was enabled. (Chatterino#3518)
- Bugfix: Usercards no longer close when the originating window (e.g. a search popup) is closed. (Chatterino#3518)
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

Successfully merging this pull request may close these issues.

5 participants