Dadsoo Aparat Performance
Performance-focused Aparat embeds for WordPress, Gutenberg and Elementor, with local posters and click-to-play video.
by ishadmehri · github.com/ishadmehri/dadsoo-aparat-performance · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/ishadmehri/dadsoo-aparat-performance/archive/refs/heads/main.zipA WordPress plugin for performance-focused Aparat embeds, with a Gutenberg block, an optional Elementor widget, a shortcode, and a PHP API for article injectors.
Author: ishadmehri · Plugin website
Download the installable ZIP · راهنمای فارسی
Features
- Accepts Aparat links such as
https://www.aparat.com/v/ytf50k5, video hashes, and individual legacy script/iframe embed codes. - Shows a local poster with a circular, icon-only Play control and an accessible name.
- Creates the player only after a click. No video element, Aparat iframe, or Aparat player script is loaded by this plugin before the click.
- Uses the native browser MP4 player by default and starts playback from the first click when media is available. Browser restrictions can cause a muted retry.
- Automatically retries an alternative route/CDN on initial media failure or timeout. A final failure shows an in-page retry control instead of sending the visitor to Aparat.
- Imports posters into the WordPress media library once per video, with WebP conversion when supported by the server.
- Supports start time, muted playback, poster override, aspect ratio, and above-fold poster priority. Optional official Aparat mode also supports title/icon visibility and same-channel recommendations.
- Loads one dependency-free frontend script only on pages containing its embeds, with Delay JS exclusions for WP Rocket and Perfmatters.
Installation
Requires WordPress 6.3+ and PHP 7.4+. Tested with WordPress 7.1. Elementor is optional.
- Download
dadsoo-aparat-performance-1.2.4.zipfrom Releases. - In WordPress, go to Plugins → Add New → Upload Plugin, upload the ZIP, and activate it.
- Add the آپارات بهینه دادسو block or Elementor widget and paste the Aparat link.
- Clear page/CDN caches after replacing an older plugin version or embed.
The release ZIP contains the dadsoo-aparat-performance plugin directory. Use that asset for installation.
Shortcode
[dadsoo_aparat url="https://www.aparat.com/v/ytf50k5"]
[dadsoo_aparat url="https://www.aparat.com/v/ytf50k5" start_time="65" muted="true"]
To use the official Aparat iframe player:
[dadsoo_aparat url="https://www.aparat.com/v/ytf50k5" player="aparat" title_show="true" recom="self"]
The current official player may require a second internal Play click. title_show and recom apply only to official-player mode.
Existing article injectors
Replace your injector's individual embed output with:
if (function_exists('dadsoo_aparat_performance_render')) {
$video_html = dadsoo_aparat_performance_render($aparat_url, array(
'startTime' => 65,
'muted' => true,
));
}
The function also accepts one stored legacy embed snippet. Installing the plugin does not rewrite existing article content automatically. Preserve any accurate VideoObject schema already produced by your injector.
Performance and delivery
Posters are served from your own site. Missing poster metadata is prepared in the editor/save flow or a background WP-Cron job; public rendering does not make a synchronous Aparat API call.
Version 1.2.2 repairs empty image sources and malformed responsive candidates such as srcset=" 900w, …". It uses the media file's upload metadata as a fallback, preserves valid responsive/lazy-load attributes, and adds no network requests. Clear page and CDN caches after updating; existing media do not need to be imported again.
After a click, a public WordPress endpoint resolves a temporary MP4 URL from Aparat and redirects the browser to its CDN. PHP does not proxy video bytes. Signed source URLs are cached briefly on the server and never stored in cached article HTML. Live playback depends on host access to the Aparat API and visitor access to its CDN; no PageSpeed score is guaranteed.
Exclude the dadsoo_aparat_stream action on /wp-admin/admin-ajax.php and /wp-json/dadsoo-aparat/v1/stream/* from independent CDN/REST caching. The plugin sends Cache-Control: no-store for those media responses.
Enable above-fold poster priority only for posters visible without scrolling. WP-Cron must run for background poster imports. See the Persian guide for the full settings and cache integration notes.
Development checks
Run the dependency-free player regression tests with Node.js:
node --test tests/player.test.cjs
The nine tests cover click-to-play, settings, dynamic embeds, route fallback, loading timeout, and in-page retry after failure. PHP syntax was checked with PHP 8.3; WordPress/Elementor integration and real Aparat MP4 playback were also checked in an isolated development environment.
php tests/poster.php /path/to/disposable-wordpress-bootstrap.php checks poster rendering and the blank-src/900w regression against WordPress. Use a disposable database: the test creates and removes its own attachment record.
License
GPL-2.0-or-later. See LICENSE.txt.