Modernizing Code with xFactor

Introduction

The Fieldtrip Project, an NIH-sponsored website, was created to engage adolescents with educational content by inviting them to watch short films and participate in an online community. Researchers aimed to spur meaningful discussions and encourage adolescents to share their thoughts on education and identity development.

Fieldtrip Films Section Screenshot

A key component of this online environment was the Flash-based video player, which enabled users to watch short films and log their activity. However, as Flash support gradually phased out across modern browsers, the project faced the risk of losing its most critical features—particularly video playback and research logging.

Original Flash-Based Development Environment

The Refactoring Journey

With the gradual obsolescence of Flash, there was the need for a modern approach to preserve video playback and data logging. This strategy involved converting the Flash ActionScript solution into a fully functional HTML5/JavaScript player— capable of maintaining the same interactions while improving security and compatibility.

xFactor with imported code

xFactor is Devis' airgapped, AI-driven solution for full-stack development, system innovation, and secure refactoring of legacy applications. This platform leverages advanced AI technologies and custom Large Language Models (LLMs) to streamline every stage of development—from initial architecture and design to implementation and deployment—enabling organizations to build scalable, secure, and future-ready systems. By working on airgapped networks and employing advanced security measures, xFactor preserves data integrity and operational continuity even in sensitive environments. Development InfoStructure, LLC (Devis) proudly introduces xFactor as a state-of-the-art platform designed to transform Full-Stack Development and System Creation. It automates code conversion between languages to ensure accurate, context-aware translations and supports secure legacy application lift-and-shift operations, particularly on SIPRNet. Leveraging an airgapped network of LLMs, including custom Precision Language Models (PLMs), xFactor employs genetic algorithms and ensemble techniques to evaluate and refactor extensive codebases with improved precision, enhancing its effectiveness in code assessment and transformation.

xFactor with imported code

Initial refactoring prompt

xFactor was used to modernize this Flash code. After importing the code, an instruction to transform the Flash code into an HTML5-based video player. This prompt established that the resulting player must maintain the same functionality—especially its logging capability—and simply replace the video source with a modern URL.

"Refactor the provided Flash code into an HTML5 video player page using JavaScript and CSS. Ensure the refactored code maintains the same functionality and behavior as the original Flash code, including the logging functionality which should be displayed below the video player. Replace the existing video source with the video from the URL - https://genitive.ai/wp-content/uploads/2025/01/xFactor-Refactoring.mp4"

Initial Code Generation

xFactor's initial code generation produced a straightforward HTML5 structure for the video player, providing the essential skeleton for playback, controls, and logging. Below is the first draft of the refactored code that replaced the Flash interface.

Refactored & Commented Code

Next, xFactor applied its enhance code feature to thoroughly comment the initial code, clarifying each step's purpose and ensuring maintainability. Below is the fully Refactored & Commented Code that preserves logging functionality and introduces basic controls in a more robust, modern structure.

Security Evaluation

In addition to functionality, security was a major priority. The development team conducted a comprehensive security evaluation to identify potential vulnerabilities and risks. Because user data and engagement logs could be sensitive, ensuring that the refactored code adhered to best practices was essential. Some highlights included:

  • Validating user inputs where necessary
  • Ensuring no unbounded logging or storage that could lead to injection attacks
  • Maintaining secure HTTPS connections and avoiding mixed content
  • Implementing a clean code structure to reduce the overall attack surface

Interactive Demo

Below is a simple embedded version of the final refactored HTML5 video player. You can test the play/pause button, adjust the volume, and see the time/volume logs appear. It demonstrates how the same interactions formerly handled in Flash are now seamlessly managed by JavaScript and displayed in a logging area.

Code in Action with Logging

The refactored player above demonstrates the successful migration from Flash to HTML5. You can see how each interaction—play, pause, volume changes, video end—generates a new timestamped message in the logging area below the video. This mirrors the functionality that was once in Flash but is now fully supported in modern browsers without any plugins.

Conclusion

The XFactor refactor accomplished much more than a simple technical upgrade. It preserved key research objectives, such as logging and analysis of adolescent engagement, while ensuring the usability and security of a modern solution. By transitioning from Flash to HTML5, the development team has future-proofed the Fieldtrip Project's video functionality, reaffirming its continued mission: fostering meaningful dialogue about education among adolescent users.

This transformation showcases how xFactor's AI-powered refactoring capabilities can breathe new life into legacy applications, ensuring they remain functional, secure, and relevant in an ever-evolving technological landscape. The success of this project demonstrates the platform's ability to handle complex code migrations while maintaining critical business logic and user experience requirements.