React Hover Video Player Versions Save

A React component for rendering videos that play on hover, including support for mouse and touch events and a simple API for adding thumbnails and loading states.

v10.0.1

11 months ago

This is a minor bug fix release.

Full changes

Changes

  • Fixes issue where the library's published TypeScript declaration file was not working in most TypeScript projects
  • Minor documentation updates

v10.0.0

1 year ago

This is a big release! It includes some breaking changes to the component's API, but should reduce the bundle size by ~18% and improve performance by simply removing a lot of unnecessary work that the component was doing at runtime before.

Full changes

Breaking changes

Deprecates passing config objects to videoSrc prop

The videoSrc prop still supports URL strings, but no longer accepts config objects or arrays of config objects for video sources. Instead, sources like this must now be defined as <source> elements.

Migration for a single source config object is fairly straightforward; the src and type properties on the config objects map directly to the attributes that need to be set on the <source> elements:

<HoverVideoPlayer
- videoSrc={{
-   src: "path-to/video.mp4",
-   type: "video/mp4",
- }}
+ videoSrc={(
+   <source
+     src="path-to/video.mp4"
+     type="video/mp4"
+   />
+ )}
/>

For an array of source config objects, simply wrap your <source> elements in a fragment:

<HoverVideoPlayer
- videoSrc={[
-   {
-     src: "video.webm",
-     type: "video/webm",
-   },
-   {
-     src: "video.mp4",
-     type: "video/mp4",
-   },
- ]}
+ videoSrc={(
+   <>
+     <source src="video.webm" type="video/webm" />
+     <source src="video.mp4" type="video/mp4" />
+   </>
+ )}
/>

Deprecates passing config objects to videoCaptions prop

The videoCaptions prop also no longer accepts config objects for caption tracks. Instead, caption tracks must be defined as <track> elements.

Like with the changes to videoSrc above, all of the properties on the caption track config objects should map directly to attributes on the <track> elements:

<HoverVideoPlayer
  videoSrc="video.mp4"
- videoCaptions={[
-   {
-     src: "english-captions.vtt",
-     srcLang: "en",
-     label: "English",
-     kind: "captions",
-     default: true,
-   },
-   {
-     src: "french-subtitles.vtt",
-     srcLang: "fr",
-     label: "Francais",
-     kind: "subtitles",
-   },
- ]}
+ videoCaptions={(
+   <>
+     <track src="english-captions.vtt" srcLang="en" label="English" kind="captions" default />
+     <track src="french-subtitles.vtt" srcLang="fr" label="Francais" kind="subtitles" />
+   </>
+ )}
/>

Removes shouldSuppressPlaybackInterruptedErrors prop

The shouldSuppressPlaybackInterruptedErrors prop is being removed, as it is not really needed anymore.

This prop defaulted to true and was not commonly used, so will likely not impact many people. You can simply remove the prop and things will continue functioning as normal.

<HoverVideoPlayer
  videoSrc="video.mp4"
- shouldSuppressPlaybackInterruptedErrors={false}
/>

Other things of note

  • Replaces Rollup with esbuild for builds
  • Replaces Cypress with Playwright for tests
  • Drops commit message formatting requirements, eases eslint rules in an effort to make it easier for other people to contribute
  • Switches CI from CircleCI to Github Actions, simplifies CI usage to only run tests

v9.7.1

1 year ago

9.7.1 (2022-10-05)

Bug Fixes

  • hovervideoplayer: remove default "anonymous" value for crossOrigin prop (b6b3f8d), closes #83 #84

v9.7.0

1 year ago

9.7.0 (2022-07-15)

Features

  • hovervideoplayer: enable passing through generic attributes to the container div (ff0593c), closes #81

v9.6.1

1 year ago

9.6.1 (2022-06-16)

Bug Fixes

  • changes to support usage in nextjs (57fb0e2)

v9.6.0

1 year ago

9.6.0 (2022-05-29)

Features

  • hovervideoplayer: add playbackStartDelay prop (0913fb4), closes #77

v9.5.0

2 years ago

9.5.0 (2022-03-31)

Features

  • add shouldSuppressPlaybackInterruptedErrors prop (2be89be), closes #71
  • improve handling for changes to the videoSrc prop (50f81a8), closes #72

v9.4.0

2 years ago

9.4.0 (2021-10-30)

v9.3.2

2 years ago

9.3.2 (2021-10-30)

Bug Fixes

  • add explicit handling for playback errors which aren't a NotAllowedError (2d046dd)

v9.3.1

2 years ago

9.3.1 (2021-10-06)

Bug Fixes

  • only run playback range update loop while the video is playing (3c10998)
  • hovervideoplayer: fix playback for unmuted videos getting blocked by browser autoplay policies (1a2d2b0), closes #64