Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module provides a simple Form API element to embed a modern, responsive Video.js player on your Drupal site. It allows developers to control player settings and includes an option to prevent users from skipping ahead, making it ideal for educational content.

Easily embed a modern, responsive Video.js player anywhere in your Drupal site using a simple Form API element. This module is perfect for adding videos to custom forms, with a key feature to prevent users from skipping ahead—ideal for training and educational content.

Features

This module provides a new Form API element, '#type' => 'videojs', which allows developers to embed videos declaratively within their forms. Its primary function is to simplify the process of adding a feature-rich video player without needing to write custom JavaScript or libraries.

  • Simple Form API Integration: Add a video player to any form with just a few lines of PHP.
  • Forward-Seek Prevention: An optional setting ('#prevent_forward_seek' => TRUE) disables the progress bar, forcing users to watch a video from start to finish. This is ideal for compliance training, tutorials, or educational courses.
  • Fully Customizable: Control every aspect of the player, including autoplay (with mute), looping, controls, preload behavior, and aspect ratio (16:9, 4:3, etc.).
  • Responsive Out-of-the-Box: The player is fully responsive and will adapt to any theme and screen size without extra configuration.
  • Multiple Sources: Provide multiple video formats (e.g., MP4, WebM) for maximum browser compatibility.

Post-Installation

Once installed and enabled, there is no central configuration page for this module. All configuration is done directly within the Form API element definition in your custom code.

To use the module, simply define an element with '#type' => 'videojs' in your form builder function and pass in the required options, such as #sources. See the code examples on this page for guidance.

To see a working example immediately after installation, visit the demo page at:

/admin/config/content/videojs-example

This page demonstrates a sample video player with the forward-seek prevention feature enabled.

Additional Requirements

This module requires:

  • Drupal 10 or later.

No external libraries need to be downloaded or installed. The required Video.js library and its CSS are loaded automatically from a CDN.

There are no recommended modules or libraries at this time.

Similar projects

While other modules exist for embedding media, VideoJS Element is differentiated by its focus on providing a simple, developer-centric Form API element. Its lightweight nature and built-in feature for preventing forward seeking make it uniquely suited for applications where video playback control is essential for business or educational logic.

Supporting this Module

This module was originally developed by Haas Automation, Inc., and generalized for open-source release. If you would like to support its continued development, please contribute via the project issue queue.

Community Documentation

You can view a live demo of the module's functionality, including the seek prevention feature, on the built-in demo page:

/admin/config/content/videojs-example

Activity

Total releases
4
First release
Jul 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 4
Maintenance
Slowing

Release Timeline

Releases

Version Type Release date
1.2.1 Stable Jul 17, 2025
1.2.0 Stable Jul 17, 2025
1.1.0 Stable Jul 17, 2025
1.0.x-dev Dev Jul 17, 2025