Download the PHP package rajendra/youtube-progress without Composer

On this page you can find all versions of the php package rajendra/youtube-progress. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package youtube-progress

Rajendra YouTube Progress

Enterprise-grade YouTube video progress tracking for Laravel with anti-cheat detection, segment-based verification, and LMS-optimized completion tracking.

That single line loads the YouTube IFrame API, tracks watch progress with verified watched segments, blocks forward-skip cheating, saves progress to Local Storage, and resumes playback on the viewer's next visit — automatically.


Table of Contents


Why v1.0.2

In v1.0.0, a student could cheat by dragging the YouTube seek bar to the end of a video, instantly receiving course completion. v1.0.2 solves this with a comprehensive anti-cheat system:

Problem Solution
Student drags seek bar to end Forward seek prevention — player snaps back to the farthest watched point
Completion based on current position Segment-based completion — only unique watched time counts
Student plays at 16x speed Speed monitoring — tracking pauses above configured limit
Student skips 5-minute chunks Watched segments — gaps in watched time are never counted

Completion now requires actually watching the required percentage of the video. No workarounds, no shortcuts.


Requirements

Requirement Version
PHP ^8.2
Laravel ^11.0 / ^12.0

Installation

Laravel's package auto-discovery registers the service provider and facade automatically.

Publish the config file and the compiled JS/CSS assets:

You can publish each piece independently:


Configuration

Every key can also be set via .env:


Usage

Blade component

With options:

video accepts a bare 11-character ID or a full YouTube URL (watch?v=, youtu.be/, embed/, shorts/) — it's normalized to an ID internally.

Anti-cheat options

Progress bar component

A standalone indicator that syncs with the player via events:

Helper function

Facade

Multiple videos on one page

Each gets a unique generated player ID and fully independent progress tracking. The IFrame API is loaded exactly once.


How anti-cheat tracking works

Segment-based progress

Instead of storing a single currentTime number, the package stores an array of watched segments — time ranges the viewer has actually watched:

Overlapping segments are merged automatically. The unique watched duration is the sum of all segment lengths.

Completion algorithm

A video is marked completed only when this percentage reaches completion_percentage (default 95%). Dragging the seek bar to the end does not count as watched.

Forward seek prevention

When prevent_forward_seek is enabled (default), the player tracks maxWatchedTime — the farthest point reached through normal playback. Any attempt to seek beyond this boundary:

  1. Automatically snaps the player back to maxWatchedTime
  2. Displays a toast notification
  3. Dispatches a youtube-progress:blocked event

Playback verification

Watched time is only counted while the YouTube player state is PLAYING. The following states are ignored:

Speed monitoring

If playback speed exceeds maximum_allowed_speed (default 2x), the tracking system pauses segment recording and dispatches a youtube-progress:speed-warning event. Speed is checked on every tracking tick.


Storage format

Everything lives in localStorage. Each video gets a key: {prefix}{videoId}.

Saved automatically:


Events

All events are dispatched on document as native CustomEvents:

Event Description
youtube-progress:loaded Player finished initializing
youtube-progress:resume Playback seeked to a saved position
youtube-progress:saved Progress written to Local Storage
youtube-progress:pause Video was paused
youtube-progress:completed Unique watched duration reached the threshold
youtube-progress:seek A seek was detected (forward or backward)
youtube-progress:blocked A forward seek was blocked by anti-cheat
youtube-progress:speed-warning Playback speed exceeded the configured maximum
youtube-progress:segment-added A new segment was recorded (fires on each tracking tick)

Developer callbacks

Pass JavaScript function names as Blade attributes:


Public JavaScript API

Access via window.YouTubeProgress:


Configuration reference

Key Type Default Description
save_interval int (ms) 10000 Autosave frequency while playing
completion_percentage int 95 Unique watched % required for completion
storage_prefix string rajendra_progress_ Local Storage key prefix
auto_resume bool true Seek to saved position on load
auto_load_api bool true Inject the YouTube IFrame API script
debug bool false Console-log lifecycle events
prevent_forward_seek bool true Block seeking beyond maxWatchedTime
maximum_allowed_speed int 2 Max playback rate before tracking pauses
seek_tolerance float 1.5 Seconds — threshold for seek detection
toast_duration int (ms) 3000 How long the blocked-seek toast displays
toast_message string (see config) Text shown when a forward seek is blocked
default_width string 100% Fallback player width
default_height string|int 480 Fallback player height

Blade component attributes

Attribute Type Default Description
video string (required) Video ID or YouTube URL
width string|int config default Player width
height string|int config default Player height
autoplay bool false Auto-play on load
controls bool true Show YouTube controls
muted bool false Mute on load
loop bool false Loop when ended
prevent-seek bool true Per-player seek prevention override
show-progress bool false Show inline progress bar
show-debug bool false Show debug overlay
theme string "dark" "light" or "dark"
on-complete string null JS function name called on completion
on-seek-blocked string null JS function name called when seek blocked
on-progress string null JS function name called on each save

Security


Accessibility


Performance


Browser & platform support

Desktop: Chrome, Firefox, Safari, Edge, Opera. Mobile: Android and iOS (responsive layout via CSS aspect-ratio).


Migration from v1.0.0

Automatic. When the package reads an old localStorage record (no version field), it automatically migrates it to the v1.0.2 segment format:

No data is lost. Students retain their existing progress. The migration happens transparently on the first page load after upgrading.

If you need to handle this in your own code:


Example app

See example-app/ for a minimal consumer app demonstrating: anti-cheat player, debug overlay, light theme, free-seeking mode, standalone progress bar, multiple players, public API usage, and live event logging.


Testing

The suite covers:


FAQ

Does this require a database? No. All progress lives in the visitor's browser via localStorage.

Does progress sync across devices? No — by design. Use youtube-progress:saved to persist to your own server.

Can students still cheat? The anti-cheat system makes cheating significantly harder. Forward seeks are blocked, completion requires actual watched time, and speed abuse is detected. Dedicated attackers with browser dev tools could theoretically modify localStorage directly — for server-side verification, listen to youtube-progress:saved and validate against your own records.

Can I use this with Livewire, Inertia, or Turbo? Yes. Dispatch youtube-progress:rescan on document after injecting new players into the DOM:

What happens if localStorage is unavailable? Reads/writes are wrapped in try/catch; playback still works, it just won't persist progress.

Can I style the player or progress bar? Override .yt-progress-wrapper, .yt-progress-player, .yt-progress-bar-track, .yt-progress-bar-fill, .yt-progress-bar-label, .yt-progress-toast, or .yt-progress-debug in your CSS, or publish the views to change the markup.


Troubleshooting

Symptom Fix
Player never appears Check console for invalid video value — must resolve to an 11-char ID
Progress doesn't resume Confirm auto_resume is true and localStorage isn't blocked
Assets 404 Run php artisan vendor:publish --tag=youtube-progress-assets
Multiple players interfere Ensure published/bundled JS is loaded — don't hardcode duplicate IDs
Toast doesn't appear Check prevent_forward_seek is true and the CSS is loaded
Debug overlay missing Ensure show-debug attribute is true on the component
Safari doesn't save on close Safari Private Browsing may block localStorage entirely
Seek tolerance too sensitive Increase seek_tolerance in config (e.g., 2.0 or 3.0)

License

MIT. See LICENSE.


All versions of youtube-progress with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^11.0|^12.0
illuminate/contracts Version ^11.0|^12.0
illuminate/view Version ^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rajendra/youtube-progress contains the following files

Loading the files please wait ...