Skip to content

Conversation

@zusorio
Copy link

@zusorio zusorio commented Aug 27, 2025

Allow importing OvenPlayer on the server without errors using the following fixes:

  • Update the webpack config to disable chunk loading and set the global Object to work in both contexts.
  • Update VTT.js to work in both contexts.
  • Update resize-sensor to not access window right away.

Closes #482

Allow importing OvenPlayer on the server without errors using the following fixes:
Update the webpack config to disable chunk loading and set the global Object to work in both contexts.
Update VTT.js to work in both contexts.
Update resize-sensor to not access window right away.
@SangwonOh SangwonOh self-requested a review August 28, 2025 09:26
zusorio added a commit to zusorio/OvenPlayer that referenced this pull request Aug 28, 2025
…me polyfills

- Remove the WebRTC adapter.js, it wasn't being used
- Replace the hardcoded bundle of underscore.js with a version from npm
- Remove the dom.js polyfill as it isn't needed in even somewhat modern browsers
- Use the VTTCue and VTTRegion polyfills from the media-captions package and remove the hardcoded ones from vtt.js. This could be further optimized by using some of the parsing from media-captions in the future.
- Remove the fetch polyfill as it's been available in all browsers since 2017
- Re-organize package.json: Since all dependencies are put in the bundle, they should be in devDependencies to prevent users from unnecessarily installing them
- Update webpack config to disable chunkLoading. This is necessary to create a single bundle and was also already done in AirenSoft#481
- I haven't replaced the hardcoded vast-client.js bundle yet, as the version from npm seemed to increase the bundle size by 60kb. I think this didn't happen with the vite version, so this is something we can do in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make import SSR compatible

1 participant