-
-
Notifications
You must be signed in to change notification settings - Fork 145
Open
Description
I ran into some issues regarding using the OvenPlayer Vue component with an SSR environment, and fixing that issue lead me down a rabbit hole and I refactored a bunch of different parts of OvenPlayer in a fork.
I think that some of these changes might be useful for the project but don't want to waste anyone's time by making unwanted PRs, could you let me know if any of these things sound interesting/useful to you, and I can make PRs for them.
- Use Vite instead of Webpack for building
This means builds are significantly faster, there's less configuration required, and Vite produces a smaller bundle.
In the same step, I've also removed core-js which means support for legacy browsers is reduced, if this is a problem@vitejs/plugin-legacycould be used to fix this. - Use dependencies from npm instead of hardcoding bundles
Currently, vast-client and underscore.js are hardcoded. The latest versions can be pulled in from NPM and still be included in the bundle, which means they don't need to be installed to use OvenPlayer as a client. By pulling them from NPM, we can get security updates and clean up the codebase. - Make import SSR compatible #482
Obviously OvenPlayer can't run server-side, but importing it should be possible without causing any errors.
I modified parts of the resize sensor and VTTCue Polyfill to not error out during import.
If you're interested in none of the other changes, this is one that would still be pretty important to me. - Replace Vtt.js
Vtt.js hasn't been updated in many years, and there's a modern alternative from vidstack calledmedia-captions. Either the Polyfilled variants of VTTCue and VTTRegion could be used from it, or itsparseResponsefunction could be used to replace all caption parser code (although this currently doesn't support SAMI) - Remove some unnecessary Polyfills
The DOM.js Polyfill seems to only be necessary for versions of Internet Explorer and was removed. - Move packages into pnpm monorepo
I moved the core OvenPlayer code into a package and set up a pnpm workspace with changesets. This means a cleaner project structure and the ability to automatically version and publish all packages. - I've probably forgotten something here
All changes can be viewed by comparing the fork and original repository
All of these changes reduce the total bundle size from 540KB to 330KB.
They can be tested using the @zusor/ovenplayer, @zusor/ovenplayer-react, and @zusor/ovenplayer-vue3 packages on NPM.
Let me know if you're interested in any of these or have any other questions, and I can make PRs for them.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels