An open API service indexing awesome lists of open source software.

https://github.com/negat1v9/tgs-player

TGS file player for your website
https://github.com/negat1v9/tgs-player

telegram-mini-app tgs tma

Last synced: 26 days ago
JSON representation

TGS file player for your website

Awesome Lists containing this project

README

        



# TGS Player Web Component
A lightweight web component for playing Telegram Sticker animations (*.tgs files) in web browsers using WebAssembly technology.

### Features
- Extremely small footprint (~30KB for the core WebAssembly module)
- Hardware-accelerated rendering using WebAssembly
- Support for Telegram's TGS (Lottie) animation format
- Simple API with declarative usage
- Customizable playback controls

### Installation
1. Add the `/js` folder to the root of your project or to an existing directory
2. Include the component in your HTML:
```html

```

### Usage
Basic implementation:
```html

```

### Attributes
| Attribute | Description |
|---------|----------|
| `src` | Path to .tgs file (required) |
| `once` | Play animation only once |
| `onclick` | Enable click-to-play functionality |
| `autoplay` | Start animation automatically |

### Examples

### Basic Usage:
```html

```

### Click-to-Play Animation:
```html

```

### One-time Autoplay:
```html

```

### Technical Details
- Uses WebAssembly for high-performance animation rendering
- Optimized for modern browsers
- No external dependencies required
- Efficient memory management through WebAssembly

### Browser Support
Supports all modern browsers with WebAssembly capabilities:

- Chrome (v57+)
- Firefox (v52+)
- Safari (v11+)
- Edge (v79+)

### Performance
- Minimal CPU usage due to WebAssembly optimization
- Small memory footprint
- Hardware acceleration when available
- Efficient animation caching system

### Source code
Some of the code is taken from the demo mini application [durgerKing](https://t.me/DurgerKingBot) which was created by the team telegarm to demonstrate the capabilities of TMA