Skip to content

Commit

Permalink
fix(player): set src on poster image to prevent white border
Browse files Browse the repository at this point in the history
  • Loading branch information
mihar-22 committed Jan 9, 2024
1 parent 778ff6c commit 437764f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/components/ui/poster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const PosterImg = React.forwardRef<HTMLImageElement, PosterImgProps>(
return (
<Primitive.img
{...props}
src={$src || undefined}
src={$src || ''}
alt={$alt || undefined}
crossOrigin={$crossOrigin || undefined}
ref={composeRefs(img.set as any, forwardRef)}
Expand Down
2 changes: 1 addition & 1 deletion packages/vidstack/src/components/ui/poster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class Poster extends Component<PosterProps, PosterState> {

const { started } = this._media.$state;
this.setAttributes({
'data-visible': () => !started(),
'data-visible': () => !started() && !this.$state.hidden(),
'data-loading': this._isLoading.bind(this),
'data-error': this._hasError.bind(this),
'data-hidden': this.$state.hidden,
Expand Down
2 changes: 1 addition & 1 deletion packages/vidstack/src/elements/define/poster-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class MediaPosterElement extends Host(HTMLElement, Poster) {
effect(() => {
setAttribute(this._img, 'alt', alt());
setAttribute(this._img, 'crossorigin', crossOrigin());
setAttribute(this._img, 'src', src());
setAttribute(this._img, 'src', src() || '');
});
}
}
Expand Down

0 comments on commit 437764f

Please sign in to comment.