Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/poor-baths-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"react-native-vimeo-bridge": patch
---

fix(styling): replace CSS file with inline iframe styling

- Remove CSS file dependency causing webpack parse errors
- Apply width/height styles directly via JavaScript after iframe loads
- Improves package compatibility without requiring CSS loaders
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function App() {
[player],
);

const getPlayerInfo = async () => {
const getPlayerInfo = useCallback(async () => {
try {
const [videoId, title, url, width, height] = await Promise.all([
player.getVideoId(),
Expand All @@ -93,7 +93,7 @@ function App() {
} catch (error) {
console.error('Error getting player info:', error);
}
};
}, [player]);

useVimeoEvent(player, 'playing', (data) => {
console.log('playing', data);
Expand Down
10 changes: 9 additions & 1 deletion src/VimeoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,15 @@ const VimeoPlayer = ({
player.on('bufferstart', sendMessage('bufferstart'));
player.on('bufferend', sendMessage('bufferend'));
player.on('error', sendMessage('error'));
player.on('loaded', sendMessage('loaded'));
player.on('loaded', (data) => {
sendMessage('loaded')(data);

const iframe = document.querySelector('iframe');
if (iframe) {
iframe.style.width = '100%';
iframe.style.height = '100%';
}
});
player.on('durationchange', sendMessage('durationchange'));
player.on('fullscreenchange', sendMessage('fullscreenchange'));
player.on('qualitychange', sendMessage('qualitychange'));
Expand Down
4 changes: 1 addition & 3 deletions src/VimeoPlayer.web.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { useEffect, useRef, useState } from 'react';
import { useWindowDimensions } from 'react-native';
import WebVimeoPlayerController from './module/WebVimeoPlayerController';
import { INTERNAL_SET_CONTROLLER_INSTANCE } from './symbol';
import type { VimeoPlayerProps } from './types';
import VimeoPlayerWrapper from './VimeoPlayerWrapper';

import './styles.css';
import { INTERNAL_SET_CONTROLLER_INSTANCE } from './symbol';

const VimeoPlayer = ({ player, height = 200, width, style, iframeStyle }: VimeoPlayerProps) => {
const containerRef = useRef<HTMLDivElement>(null);
const [isInitialized, setIsInitialized] = useState(false);
Expand Down
11 changes: 11 additions & 0 deletions src/module/WebVimeoPlayerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ class WebVimeoPlayerController {

this.player = new window.Vimeo.Player(containerId, options);

if (this.player) {
this.player.on('loaded', () => {
const iframe = container.querySelector('iframe');

if (iframe) {
iframe.style.width = '100%';
iframe.style.height = '100%';
}
});
}

return this.player;
}

Expand Down
4 changes: 0 additions & 4 deletions src/styles.css

This file was deleted.

12 changes: 7 additions & 5 deletions src/types/vimeo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,23 +115,25 @@ export interface VimeoPlayerOptions {
color?: string | undefined;
controls?: boolean | undefined;
dnt?: boolean | undefined;
height?: number | undefined;
interactive_params?: string | undefined;
keyboard?: boolean | undefined;
loop?: boolean | undefined;
maxheight?: number | undefined;
maxwidth?: number | undefined;
muted?: boolean | undefined;
pip?: boolean | undefined;
playsinline?: boolean | undefined;
portrait?: boolean | undefined;
responsive?: boolean | undefined;
speed?: boolean | undefined;
quality?: VimeoVideoQuality | undefined;
texttrack?: string | undefined;
title?: boolean | undefined;
transparent?: boolean | undefined;
width?: number | undefined;

// NOTE - https://github.com/vimeo/player.js/issues/38#issuecomment-242462979
// maxheight?: number | undefined;
// maxwidth?: number | undefined;
// responsive?: boolean | undefined;
// width?: number | undefined;
// height?: number | undefined;
}

export interface VimeoPlayerEventMap {
Expand Down