Skip to content

Modernize to ES modules (Phases 1-3, GA4, iOS12 compat)#1077

Open
devin-ai-integration[bot] wants to merge 5 commits into
freedom-player-8from
devin/1777303636-modernize-typescript
Open

Modernize to ES modules (Phases 1-3, GA4, iOS12 compat)#1077
devin-ai-integration[bot] wants to merge 5 commits into
freedom-player-8from
devin/1777303636-modernize-typescript

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Apr 27, 2026

Copy link
Copy Markdown

Summary

Major modernization of the Freedom Player engine for 2026 web standards. All source files converted from CommonJS to plain ES modules, bundled with Rollup (replacing Browserify).

Phase 1 — Quick wins: Removed requestAnimationFrame polyfill, Flash references, vendor prefix cleanup. Updated browserslist. Replaced document.execCommand('copy') with navigator.clipboard (iOS 12 fallback kept).

Phase 2 — Dependency removal (6 packages → 0): bean → native addEventListener with namespace support, class-list → classList, computed-style → getComputedStyle(), extend-object → Object.assign(), is-function → typeof, punycode → removed.

Phase 3 — Architecture: Simplified support.js/fullscreen.js/mobile.js (removed IE/WP/Silk/old-Android code). Migrated to Rollup/ES modules. Build outputs: UMD, minified, ESM.

GA4: Rewrote analytics.js from deprecated Universal Analytics to GA4/gtag.

iOS 12 compat: All iOS < 15 workarounds marked with // iOS12-COMPAT: for future removal. jQuery bridge preserved for WordPress plugin.

Review & Testing Checklist for Human

This is a full engine rewrite — high risk. Thorough testing is essential:

  • Test basic MP4 playback — load a page with a simple MP4 video, verify play/pause/seek work
  • Test HLS playback — verify HLS streams load and quality switching works (via hls.js engine)
  • Test on mobile (iOS Safari, Android Chrome) — verify touch controls, fullscreen, volume
  • Test the WordPress plugin integration — replace freedomplayer.min.js in the WP plugin with this build and verify the player works on foliovision.com
  • Verify jQuery bridge — check that $('.freedomplayer').data('flowplayer') returns the player API

Recommended test plan:

  1. Drop dist/freedomplayer.min.js and dist/skin/skin.css into the WordPress plugin
  2. Load foliovision.com in Chrome, Safari, Firefox — play a video on a post page
  3. Test on an iPhone (Safari) and Android phone (Chrome)
  4. Check browser console for JS errors during playback

Notes

  • The circular dependency warning (freedomplayer.js ↔ bar-slider.js) is benign and pre-existing from the original codebase
  • The Sass deprecation warning in skin/sass/_media.scss line 17 is pre-existing and unrelated to this PR
  • Build is significantly faster now — Rollup compiles in ~2.5s vs ~11s with TypeScript
  • make all produces the full zip with JS + CSS + fonts

Link to Devin session: https://app.devin.ai/sessions/7368b1339e3b4ecdabb1374ff52330a3

Complete rewrite of freedom-video-player engine:

Phase 1 — Quick wins:
- Updated browserslist to modern browser floor
- Removed IE/old-browser polyfills (matches, CSSStyleDeclaration, rAF fallback)
- Removed Flash references and webkit-playsinline (keep playsinline)
- Replaced document.execCommand('copy') with navigator.clipboard (iOS12 fallback)

Phase 2 — Dependency removal:
- Replaced bean event library with native addEventListener via domOn/domOff/domOne
- Replaced class-list with native classList
- Replaced computed-style with native getComputedStyle()
- Replaced extend-object with Object.assign()
- Replaced is-function with typeof checks
- Removed punycode dependency
- Zero runtime dependencies

Phase 3 — Architecture:
- Simplified support.js: removed IE/WP/Silk/old-Android detection
- Simplified fullscreen.js: standard API + webkit fallback only
- Cleaned up mobile.js: removed IE Mobile, old Android workarounds
- Replaced <a> controls with <button> elements
- Only inject active skin SVG pair (not all 8 variants)
- Migrated from browserify/CommonJS to Rollup/ES modules

Additional:
- Rewrote analytics.js for GA4/gtag (replaced deprecated UA)
- Converted entire codebase to TypeScript with strict mode
- All iOS < 15 workarounds marked with // iOS12-COMPAT: comments
- Build produces UMD, minified, and ESM outputs
- TypeScript declarations in dist/types/
- Maintained jQuery bridge for WordPress plugin compatibility

Co-Authored-By: martinv <martinv@foliovision.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration Bot and others added 4 commits April 28, 2026 07:09
PostCSS errored with 'contains both browserslist and package.json with browsers'.
The browserslist targets are already defined in package.json.

Co-Authored-By: martinv <martinv@foliovision.com>
… in package.json)

Co-Authored-By: martinv <martinv@foliovision.com>
Co-Authored-By: martinv <martinv@foliovision.com>
- Convert all .ts files back to .js while keeping modernization intact
- Remove TypeScript, tslib, @rollup/plugin-typescript from dependencies
- Remove tsconfig.json and type declarations
- Fix pick() bug: merge picked source into video object before engine.load()
- Fix trigger() to return event object when returnEvent=true
- Update test/minimal.html with working CDN video URL
- Build is faster (no TS compilation), output is identical
- Tested: video plays successfully in test/minimal.html

Co-Authored-By: martinv <martinv@foliovision.com>
@devin-ai-integration devin-ai-integration Bot changed the title Modernize to TypeScript + ES modules (Phases 1-3, GA4, iOS12 compat) Modernize to ES modules (Phases 1-3, GA4, iOS12 compat) Apr 28, 2026
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.

0 participants