=== Kashida Video Embed ===
Contributors: mrwanbg
Tags: video, embed, youtube, vimeo, shortcode
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.4.24
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed videos from share links or iframe codes, manage a video library, and create responsive collections with shortcodes or a Gutenberg block.

== Description ==
Kashida Video Embed helps site editors embed videos using regular share links. It includes a video library, shortcode, Gutenberg block, responsive display, aspect ratio settings, and direct video file playback.

Supported sources include YouTube, Vimeo, Facebook, X/Twitter, Dailymotion, TikTok, Twitch, Instagram and WordPress.tv when embedding is available, plus direct MP4, WebM and OGV URLs such as files in the WordPress Media Library.

Some providers restrict third-party embedding, require authentication, or change their embed APIs. Dailymotion requires a valid Player ID for its current iframe endpoint; enter the Player ID from Dailymotion Studio or paste the official embed code. Twitch requires a valid HTTPS site and parent domain. Some short links may need to be replaced with the canonical video URL.

== Features ==

* Save and manage videos in a searchable library.
* Embed by public share URL or supported provider iframe code.
* Use a shortcode or Gutenberg block.
* Create and edit reusable collections while keeping each saved collection shortcode stable.
* Choose from five layouts: Grid, List, Carousel, Slider and Featured + Playlist.
* Configure layout-specific presentation, including responsive item counts, spacing, card/background and text colors, overlays, border radius, image fit, slider height, arrows, pagination dots and autoplay where supported.
* Configure playlist height, scrolling, active-item color, border/icon colors and metadata visibility in Featured + Playlist.
* Use the visual collection designer with a live style preview, then generate or reuse the collection shortcode.
* Manage saved videos with search, sorting, edit controls and one-click shortcode copying.
* Use the Gutenberg block or the video and collection shortcodes.
* Control aspect ratio, player controls, lazy loading, display mode and supported provider embed code per video.
* Play supported direct MP4, WebM, OGV and OGG files.
* Translation-ready; the Arabic PO and compiled MO catalogs are included.

== Source code ==

The collection generator JavaScript is maintained as readable source in `assets/src/collection-generator.js`. The browser-loaded file is `assets/collection-generator.js`; both files are currently identical. There is no minification or build step required to update this script.

== Installation ==
1. Upload the plugin ZIP through Plugins > Add New > Upload Plugin.
2. Activate Kashida Video Embed.
3. Open Kashida Video Embed > Add New and paste a video URL or provider embed code.
4. Save, then copy the shortcode from All Videos.

== Shortcodes ==

Display one saved video by its library entry ID:
[kashida_video_embed id="123"]

Or embed a supported URL directly:
[kashida_video_embed url="https://youtu.be/VIDEO_ID" ratio="16:9"]

Supported single-video attributes:
* `id` — saved video entry ID.
* `url` — public provider URL or direct video file URL.
* `ratio` — `16:9`, `9:16`, `4:3` or `1:1`.
* `controls` — `yes` or `no`.
* `lazy` — `yes` or `no`.
* `display` — `player` or `provider`.

Display selected saved video IDs in a collection layout:
[kashida_video_gallery ids="123,124,125" layout="grid"]

Display a saved collection created in the collection designer:
[kashida_video_collection id="1"]

The gallery shortcode supports `grid`, `list`, `carousel`, `slider` and `featured_playlist` layouts. Collection designer output is available through the saved collection shortcode.

== External services ==

The plugin does not send analytics, advertising identifiers, visitor profiles or video-library data to Kashida. It does not load a remote Kashida tracking service.

External connections occur only for content and providers selected by the site owner:

* **X (formerly Twitter):** When an X post is embedded, the WordPress site may request the public post URL from X's oEmbed endpoint at `publish.twitter.com` to retrieve embed markup. For supported video-only rendering, the site may request the public post ID from `cdn.syndication.twimg.com` to retrieve public video variants. These are server-to-server requests initiated while rendering the video; the post URL or ID is sent and the response is cached. If the X post embed is displayed, the visitor's browser may load X's widgets script and connect to X. X may receive standard request data such as IP address, browser information and referrer, and may use cookies or similar technologies. Terms: https://x.com/en/tos . Privacy: https://x.com/en/privacy .
* **TikTok:** TikTok content is rendered using TikTok's official player iframe. When a visitor loads the player, the browser connects to TikTok and sends the player/content identifier and standard connection data such as IP address, browser information and referrer. TikTok may use cookies or similar technologies. Terms: https://www.tiktok.com/legal/terms-of-service . Privacy: https://www.tiktok.com/legal/privacy-policy .
* **Twitch:** Twitch videos and clips are rendered using Twitch's player iframe. The embed URL includes the content identifier and the parent hostname required by Twitch. When the player loads, the browser connects to Twitch and sends standard connection data, including IP address, browser information, referrer and the embedding site's hostname. Twitch may use cookies or similar technologies. Terms: https://www.twitch.tv/p/legal/terms-of-service/ . Privacy: https://www.twitch.tv/p/legal/privacy-notice/ .
* **YouTube, Vimeo, Facebook, Instagram, Dailymotion and WordPress.tv:** Depending on the URL and provider support, the plugin creates a provider iframe URL or asks WordPress oEmbed to retrieve embed markup. The visitor's browser connects to the selected provider when its player/embed loads. An oEmbed request, when used, is made by the WordPress site to the provider and includes the public video URL. Providers may receive standard connection data and apply their own cookies or similar technologies. Terms and privacy policies: YouTube https://www.youtube.com/t/terms and https://policies.google.com/privacy ; Vimeo https://vimeo.com/terms and https://vimeo.com/privacy ; Facebook/Instagram https://www.facebook.com/terms.php and https://www.facebook.com/privacy/policy/ ; Dailymotion https://www.dailymotion.com/legal/terms and https://www.dailymotion.com/legal/privacy ; WordPress.tv https://wordpress.tv/ .
* **Provider iframe code:** If the site owner supplies an accepted provider iframe code, the visitor's browser connects to the provider specified by that iframe. Only the supported provider domains accepted by the plugin are allowed.

The site owner chooses which providers appear by adding their video URLs or embed codes. The plugin does not load all providers on every page. Provider availability, cookies, data processing and embed restrictions are controlled by each provider and its current policies.

== Data storage and compatibility ==

Saved video records use the `kashida_video` post type. The previous `kve_video` post type remains registered and readable so existing saved videos, IDs, and shortcodes continue to work. Newly saved records use the namespaced post type. Collection settings are migrated from the previous `kve_saved_collections` option to `kashida_video_embed_saved_collections` when first read; collection IDs and existing collection shortcodes are preserved. The plugin does not delete the old records or option during migration.

== Privacy ==
The plugin does not send analytics or visitor data to Kashida. Third-party video providers may receive the video URL or identifier and standard connection data when their embed/player is loaded. See the External services section above for details.

== Frequently Asked Questions ==

= Why does Twitch fail on a local site? =
Twitch requires HTTPS and a matching parent domain. Local development domains or nested iframe policies can prevent playback. Test on the actual public site.

= Can every video URL be embedded? =
No. Providers may restrict embedding, require login, or disable external playback. Use the official embed code where available.

= Does the plugin track visitors? =
The plugin does not send analytics or video data to Kashida. Third-party players connect to their providers when loaded.

== Changelog ==

= 1.4.24 =
* Synchronized the plugin, Gutenberg block metadata, readme stable tag and translation catalog version metadata.
* Applied output-context sanitization to generated admin designer and video preview markup.
* Introduced namespaced identifiers for the current video post type, collection options, cache keys and registered assets, while retaining legacy video and collection compatibility.
* Expanded documentation for the five collection layouts, visual designer controls, saved collection behavior, shortcode/block usage and provider limitations.
* Expanded the external services disclosure to describe the provider requests, data categories, loading conditions and relevant provider policies.
* Repaired the Arabic PO catalog header and regenerated the compiled Arabic MO catalog.
* Clarified the collection-generator source file and browser-loaded file relationship; both are currently identical and no build/minification step is used.

= 1.4.22 =
* Replaced direct inline script output with WordPress inline-script APIs.
* Added a namespace for the plugin class and a distinct prefix for AJAX and admin-post actions.
* Added readable collection-generator JavaScript source and documented its location.
* Documented external video providers, data transmitted, and their terms and privacy policies.

= 1.4.9 =
* Expanded the plugin admin content width across all Kashida Video Embed admin pages.
* Strengthened toggle switch track and thumb styling so enabled and disabled states are visually distinct.
* Bumped the plugin asset version to invalidate cached admin CSS.

= 1.4.8 =
* Expanded the plugin settings and layout designer to use the available WordPress admin width.
* Improved on/off switch contrast and keyboard focus visibility.

= 1.4.3 =
* New collection designer in the admin: layout tabs, live preview that uses the real frontend styles, and a per-layout Display settings panel (steppers, switches, sliders, color + HEX fields, Reset settings).
* New saved settings: border radius, list thumbnail width, autoplay interval, slider image fit, playlist height and scrolling, active item color, show metadata.
* Frontend refresh of all layouts; existing collections and shortcodes keep working unchanged.

= 1.4.1 =
* Refined Grid, List, Carousel and Slider presentation to better match the supplied visual references.
* Improved per-layout settings visibility in the collection editor.
* Corrected title order for Grid and Carousel, and made the title toggle apply consistently to List details.
* Fixed surface color and overlay opacity CSS variables so saved color controls render reliably.
* Improved spacing, borders, focus states, navigation and responsive list layout.

= 1.4.0 =
* Added responsive desktop, tablet and mobile column counts for Grid and Carousel.
* Added list mode with video-only or a source-details side column.
* Added configurable Slider height, consistent frame sizing, optional titles, arrows and dots.
* Preserved per-layout title visibility and carousel/slider navigation settings.

= 1.3.9 =
* Refined visual styling for all collection layouts.
* Added layout-specific settings for surface color, arrows, dots, autoplay, and list thumbnail preference.
* Added responsive carousel/slider navigation dots and optional autoplay.

= 1.3.8 =
* Fixed featured playlist height to match the active video player and scroll internally when the list is longer.
* Refined playlist contrast, active state, spacing, scrollbar, and responsive behavior.

= 1.3.7 =
* Improved featured video and playlist layout with a playlist matching the player height and internal scrolling for long lists.
* Refined playlist styling, active state, hover state, and scrollbar.

= 1.3.6 =
* Enable Update collection immediately when editing saved collection settings, including layout changes.
* Preserve the permanent shortcode while changes are pending and allow saving without regenerating the shortcode.

= 1.3.5 =
* Added Featured Video + Side Playlist layout with fixed 16:9 featured player area and selectable video list.
* Added responsive side playlist interaction to reusable video collections and gallery shortcodes.

= 1.3.1 =
* Updated the collection shortcode generator to use a clear three-step workflow: select videos, customize display, then generate and copy the shortcode.
* Added Select all and Clear selection actions and a selected-video counter.
* The shortcode output stays disabled until generated, and becomes invalid when settings change.

= 1.3.0 =
* Added video collection shortcode and generator.
* Added Grid, List, Carousel and Slider layouts.
* Added per-collection columns, gap, overlay color/opacity, text color, title size and title visibility.
* Added responsive frontend styles and carousel/slider navigation.

= 1.2.1 =
* Expanded in-dashboard Help guide with setup, features, shortcode attributes, provider limitations, troubleshooting and privacy information.
* Added video library search, title/date sorting and one-click shortcode copy.
* Added a Help Guide shortcut from the Video Library.
* Updated plugin asset versioning.

= 1.1.2 =
* Fix Twitch preview by generating the iframe URL server-side with parent parameters; avoid relying on inline scripts inside AJAX-inserted preview HTML.

= 1.0.8 =
* Improve automatic Twitch parent-host detection.
* Use a fallback Dailymotion player ID when no custom ID is provided.

= 1.0.6 =
* Update TikTok links to the documented player/v1 endpoint.
* Preserve Instagram Reel/post URL types in generated embed URLs.
* Handle Twitch clip URLs and use a 4:3 embed frame to meet Twitch minimum player height requirements.
* Update Dailymotion embedding to the current Player ID-based endpoint and add a per-video Player ID field.
* Pass Dailymotion Player ID through preview and saved shortcode rendering.

= 1.0.5 =
* Show platform branding and platform-specific instructions when a video URL or embed source is selected.
* Include links to official provider help pages for copying share links or embed code.

= 1.0.4 =
* Rename the WordPress admin menu to Kashida Video Embed.
* Move all per-video options above the preview and arrange them in two responsive columns.
* Show a copyable shortcode on the saved video edit screen.
* Add Dailymotion, TikTok, Twitch and Instagram embed URL handling.
* Update preview to use the current source type and selected player settings.

= 1.0.1 =
* Keep the editor on the video edit screen after saving.
* Move player options into a collapsible per-video settings section and remove global settings.
* Add live preview requests and Facebook/X embed handling improvements.

= 1.0.0 =
* Initial release with URL-based embedding, responsive player, video library, Gutenberg block, and settings.
