Browse Source

30fps stickers for non-safari on macOS

master
morethanwords 4 years ago
parent
commit
a53581c3f0
  1. 1
      src/helpers/userAgent.ts
  2. 8
      src/lib/lottieLoader.ts

1
src/helpers/userAgent.ts

@ -1,6 +1,7 @@
export const userAgent = navigator ? navigator.userAgent : null; export const userAgent = navigator ? navigator.userAgent : null;
export const isApple = navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i) != -1; export const isApple = navigator.userAgent.search(/OS X|iPhone|iPad|iOS/i) != -1;
export const isAndroid = navigator.userAgent.toLowerCase().indexOf('android') != -1; export const isAndroid = navigator.userAgent.toLowerCase().indexOf('android') != -1;
export const isChromium = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
/** /**
* Returns true when run in WebKit derived browsers. * Returns true when run in WebKit derived browsers.

8
src/lib/lottieLoader.ts

@ -1,10 +1,10 @@
import { logger, LogLevels } from "./logger"; import RLottieWorker from 'worker-loader!./rlottie/rlottie.worker';
import animationIntersector from "../components/animationIntersector"; import animationIntersector from "../components/animationIntersector";
import apiManager from "./mtproto/mtprotoworker";
import EventListenerBase from "../helpers/eventListenerBase"; import EventListenerBase from "../helpers/eventListenerBase";
import mediaSizes from "../helpers/mediaSizes"; import mediaSizes from "../helpers/mediaSizes";
import { isAndroid, isApple, isAppleMobile, isSafari } from "../helpers/userAgent"; import { isAndroid, isApple, isAppleMobile, isSafari } from "../helpers/userAgent";
import RLottieWorker from 'worker-loader!./rlottie/rlottie.worker'; import { logger, LogLevels } from "./logger";
import apiManager from "./mtproto/mtprotoworker";
import { MOUNT_CLASS_TO } from "./mtproto/mtproto_config"; import { MOUNT_CLASS_TO } from "./mtproto/mtproto_config";
let convert = (value: number) => { let convert = (value: number) => {
@ -94,7 +94,7 @@ export class RLottiePlayer extends EventListenerBase<{
// Skip ratio // Skip ratio
let skipRatio: number; let skipRatio: number;
if(options.skipRatio !== undefined) skipRatio = options.skipRatio; if(options.skipRatio !== undefined) skipRatio = options.skipRatio;
else if((isAndroid || isAppleMobile) && this.width < 100 && this.height < 100) { else if((isAndroid || isAppleMobile || (isApple && !isSafari)) && this.width < 100 && this.height < 100) {
skipRatio = 0.5; skipRatio = 0.5;
} }

Loading…
Cancel
Save