=== segmnt video ===
Contributors: segmnt
Tags: video, hls, streaming, arabic, embed
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Put a segmnt video on any WordPress page with a shortcode. Your API key stays
on your server; segmnt makes the signed playback token.

== Description ==

segmnt video embeds a video from [segmnt](https://segmnt.cloud) in a WordPress
page. You paste your API key and project id once, then add a shortcode:

`[segmnt id="vid_9xR4tL"]`

On each page render the plugin asks the segmnt API, from your server, for a
short-lived **playback token**, then prints the same player we use everywhere
(hls.js, automatic quality, Arabic RTL).

**What this plugin does not do:** it does not host, upload or encode videos. It
does not build a second player. It is a small bridge to your own segmnt project.

== Installation ==

1. Upload the `segmnt-video` folder to `/wp-content/plugins/`, or install the
   zip from **Plugins &rarr; Add New &rarr; Upload Plugin**.
2. Activate the plugin.
3. Go to **Settings &rarr; segmnt video** and paste:
   * your **project id** (`prj_...`), and
   * a **playback** API key (`sk_...`). Create a playback key in the segmnt
     dashboard; it can only make playback tokens.
4. Make sure the domain of this WordPress site is a **verified domain** of the
   project.
5. Add `[segmnt id="vid_..."]` to a page.

== Shortcode ==

`[segmnt id="vid_9xR4tL"]`

| Attribute | Required | Default | Meaning |
| --- | --- | --- | --- |
| `id` | yes | - | The video id, `vid_...` |
| `title` | no | `segmnt video` (localized) | iframe title, for screen readers |
| `locale` | no | the site locale, else `ar` | player language: `ar` or `en` |
| `aspect` | no | `16 / 9` | responsive aspect ratio |

== Frequently Asked Questions ==

= The video does not play. =

Check **Settings &rarr; segmnt video**:

* Is the site domain a verified domain of the project? If not, the API answers
  `400`.
* Does the API key start with `sk_` and is it a **playback** key?
* Is the video **ready** (encoded), and not held for review?

= The video plays, then stops after a while. =

Your page cache is probably holding the page longer than the playback token
lives. The plugin asks for the normal 4-hour token and re-mints a few minutes
before it expires, so keep the page-cache lifetime below 4 hours, or leave
`[segmnt]` pages uncached.

= I revoked the key. Does playback stop? =

New page views stop getting a token at once. A viewer who already loaded the
page keeps playing until that token expires.

== Changelog ==

= 1.0.0 =
* First version. Settings page, `[segmnt]` shortcode, server-side token mint
  with a small cache, Arabic and English player language.
