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

https://github.com/react-native-bridges/react-native-vimeo-bridge

πŸŽ₯ Easy-to-use Vimeo player for React Native with cross-platform support
https://github.com/react-native-bridges/react-native-vimeo-bridge

android expo expo-vimeo ios player react-native react-native-vimeo react-native-vimeo-iframe react-native-vimeo-player vimeo vimeo-player web

Last synced: about 2 months ago
JSON representation

πŸŽ₯ Easy-to-use Vimeo player for React Native with cross-platform support

Awesome Lists containing this project

README

          

# React Native Vimeo Bridge

> English | [ν•œκ΅­μ–΄](./README-ko_kr.md)

## Overview

Have you ever struggled with complex setup and manual WebView integration just to use Vimeo player in React Native?

With the lack of actively maintained Vimeo player libraries for React Native, `react-native-vimeo-bridge` provides a seamless way to integrate the [Vimeo Player JS API](https://developer.vimeo.com/player/sdk) into your React Native applications.

### Key Features

- βœ… **Full TypeScript Support** - Enhanced type safety and developer experience
- βœ… **Cross-Platform** - Works on iOS, Android, and Web
- βœ… **New Architecture Compatible** - Full support for React Native's latest architecture
- βœ… **Rich API Support** - Access to all core Vimeo Player JS API features
- βœ… **React-Native Design** - Intuitive, easy-to-use Hook-based API
- βœ… **Expo Compatible** - Ready to use in Expo projects

## Quick Start

### Examples & Demo
- [πŸ“ Example Project](/example/) - Real implementation code and various use cases
- [🌐 Web Demo](https://react-native-vimeo-bridge-example.pages.dev/) - Try it in your browser



### Installation

```bash
# npm
npm install react-native-vimeo-bridge

# pnpm
pnpm add react-native-vimeo-bridge

# yarn
yarn add react-native-vimeo-bridge

# bun
bun add react-native-vimeo-bridge
```

## Usage

### Basic Usage

```tsx
import { useVimeoPlayer, VimeoPlayer } from 'react-native-vimeo-bridge';

function App() {
const player = useVimeoPlayer('https://player.vimeo.com/video/76979871?h=8272103f6e');

return (

);
}
```

### Event Handling

Listen to Vimeo Player state changes in real-time. Use the `useVimeoEvent` Hook to subscribe to [events](https://github.com/vimeo/player.js/#events) in two ways.

```tsx
import { useVimeoEvent, useVimeoPlayer, VimeoPlayer } from 'react-native-vimeo-bridge';

function App() {
const [isPlaying, setIsPlaying] = useState(false);

const player = useVimeoPlayer('https://player.vimeo.com/video/76979871?h=8272103f6e');

// Method 1: Receive as state (timeupdate event supports interval configuration)
const timeupdateState = useVimeoEvent(player, 'timeupdate', 250); // 250ms interval (default)

// Method 2: Handle with callback
useVimeoEvent(player, 'playing', (data) => {
console.log('Playback started:', data);
setIsPlaying(true);
});

useVimeoEvent(player, 'pause', () => {
setIsPlaying(false);
});

console.log('Current time:', timeupdateState?.seconds);

return (

);
}
```

### Player Control

Control various player functions programmatically through Vimeo Player [methods](https://github.com/vimeo/player.js/#methods) such as play, pause, seek, volume control, and more.

```tsx
import { useVimeoEvent, useVimeoPlayer, VimeoPlayer } from 'react-native-vimeo-bridge';

function App() {
const player = useVimeoPlayer('https://player.vimeo.com/video/76979871?h=8272103f6e');

const [isPlaying, setIsPlaying] = useState(false);

const timeupdate = useVimeoEvent(player, 'timeupdate', 250);
const currentTime = safeNumber(timeupdate?.seconds);

const handlePlayPause = useCallback(async () => {
if (isPlaying) {
await player.pause();
} else {
await player.play();
}
}, [isPlaying, player]);

const seekTo = useCallback(async (seconds: number) => {
await player.setCurrentTime(seconds);
}, [player]);

return (


seekTo(currentTime - 10)}>
βͺ -10초


{isPlaying ? '⏸️ μΌμ‹œμ •μ§€' : '▢️ μž¬μƒ'}

seekTo(currentTime + 10)}>
⏭️ +10초



);
}
```

### Embed Options

Customize initial settings through Vimeo Player [embed options](https://developer.vimeo.com/player/sdk/embed).

```tsx
import { useVimeoPlayer, VimeoPlayer } from 'react-native-vimeo-bridge';

function App() {
const player = useVimeoPlayer('https://player.vimeo.com/video/76979871?h=8272103f6e', {
autoplay: true,
controls: true,
loop: true,
quality: '1080p',
playsinline: true,
});

return (

);
}
```

### Style Customization

Customize the player's iframe or webview styling.

```tsx
import { VimeoPlayer } from 'react-native-vimeo-bridge';

function App() {
return (

);
}
```

## Contributing

See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.

## License

[MIT](./LICENSE)