Skip to content

Commit a187b55

Browse files
luweskarlhorky
andauthored
feat!: v3 refactor (#1886)
* feat!: enable Suspense by default (#1775) BREAKING CHANGES: enable Suspense by default, remove environment checks * feat!: try out ESM only on canary (#1826) BREAKING CHANGES: remove CJS and IIFE * fix: type issue * fix: improve types resolution (#1827) * fix: Move exports.key.default to last position (#1828) * feat: TS, function comps, media-elements * feat: add config prop support * test: update tests * fix: upgrade Mux player * fix: re-render issue, remove default wrapper, update App to use function components, update responsive logic and docs * test: fix tests * docs: add more docs and migration docs * fix: allow video without src for source & track * example: fix error callback * fix: rename url to src * docs: add more migrating changes --------- Co-authored-by: Karl Horky <[email protected]>
1 parent 3cda23f commit a187b55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3356
-9261
lines changed

.github/workflows/cd.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,8 @@ jobs:
5656
- run: npm ci
5757
- run: npm run lint
5858
- run: npm run test:coverage
59-
- run: npm run build:lib
59+
- run: npm run build
6060
- run: npm run build:demo
61-
- run: npm run build:dist
62-
- run: npm run build:standalone
6361
- run: npx --yes [email protected] release ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }} --provenance --github-release --verbose
6462
- name: Get NPM version
6563
id: npm-version

.github/workflows/ci.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ jobs:
5858
node-version: ${{ matrix.node-version }}
5959
cache: npm
6060
- run: npm ci
61-
- run: npm run build:lib
61+
- run: npm run build
6262
- run: npm run build:demo
63-
- run: npm run build:dist
64-
- run: npm run build:standalone
6563

6664
deploy-preview:
6765
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
@@ -82,7 +80,7 @@ jobs:
8280
with:
8381
node-version: 20
8482
- run: npm ci
85-
- run: npm run build:lib
83+
- run: npm run build
8684
- run: npm run build:demo
8785
- uses: actions/upload-pages-artifact@v3
8886
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ yarn-error.log
1010
.idea/
1111
.vscode/
1212
/disttest/
13+
/dist/

.npmignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

MIGRATING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
1+
## Migrating to `v3.0`
2+
3+
Breaking changes are in 🔥 __bold and on fire__.
4+
5+
### Some player providers are not supported yet
6+
7+
Since `v3.0` is a new architecture not all providers have been updated.
8+
It is recommended to keep using `v2` and vote to add this provider to `v3` in [discussions](https://github.com/cookpete/react-player/discussions).
9+
These include:
10+
11+
- `Dailymotion`
12+
- `SoundCloud`
13+
- `Streamable`
14+
- `Twitch`
15+
- `Facebook`
16+
- `Mixcloud`
17+
- `Kaltura`
18+
19+
### Lazy players
20+
21+
As of `v3.0` all the players are lazy loaded by default.
22+
Due to the use of `lazy` and `Suspense`, 🔥 __React 16.6 or later is now required__.
23+
24+
### Player props
25+
26+
As of `v3.0` some player props are renamed to be closer to the native
27+
[HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) naming.
28+
29+
- 🔥 __`url` => `src`__
30+
- 🔥 __`playsinline` => `playsInline`__
31+
- 🔥 __`progressInterval` deprecated
32+
- 🔥 __`stopOnUnmount` => deprecated
33+
- 🔥 __`wrapper` is `undefined` by default. Set to `div` if you want a wrapper element.
34+
35+
### Player instance methods
36+
37+
As of `v3.0` use [`ref`](https://react.dev/learn/manipulating-the-dom-with-refs) to call instance methods on the player. See [the demo app](examples/react/src/App.js) for an example of this. Since `v3`, the instance methods aim to be 🔥 __compatible
38+
with the [HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) interface__.
39+
40+
### Player callback props
41+
42+
As of `v3.0` some player callback props are renamed to be closer to the native
43+
[HTMLMediaElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement) event naming.
44+
45+
- 🔥 __`onProgress` => `onTimeUpdate` and `onProgress`__
46+
- 🔥 __`onDuration` => `onDurationChange`__
47+
- 🔥 __`onPlaybackRateChange` => `onRateChange`__
48+
- 🔥 __`onSeek` => `onSeeking` and `onSeeked`__
49+
- 🔥 __`onBuffer` => `onWaiting`__
50+
- 🔥 __`onBufferEnd` => `onPlaying`__
51+
- 🔥 __`onEnablePIP` => `onEnterPictureInPicture`__
52+
- 🔥 __`onDisablePIP` => `onLeavePictureInPicture`__
53+
54+
155
## Migrating to `v2.0`
256

357
Breaking changes are in 🔥 __bold and on fire__.

README.md

Lines changed: 57 additions & 163 deletions
Large diffs are not rendered by default.

biome.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"files": {
3+
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"],
4+
"ignore": ["dist/**"]
5+
},
6+
"formatter": {
7+
"indentStyle": "space"
8+
}
9+
}

dist/ReactPlayer.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

dist/ReactPlayer.js.map

Lines changed: 0 additions & 7 deletions
This file was deleted.

dist/ReactPlayer.standalone.es6.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)