=== BunStream ===
Contributors: bunstream
Tags: video, video hosting, lms, tutor lms, learndash
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed protected BunStream videos in any post, page or LMS lesson, with the signed-in student's id on the watermark.

== Description ==

BunStream is a video hosting platform for teachers and course sellers. This plugin puts your BunStream lessons on your WordPress site without copying embed codes.

* A "BunStream lesson" block: search your lessons and pick one.
* An "Add BunStream lesson" button in the classic editor.
* A shortcode: `[bunstream id="VIDEO_UUID"]`, with optional `max-width="800px"` or `width="100%"`.
* Works inside lesson content in Tutor LMS and LearnDash.
* The signed-in student's WordPress ID, email or username can be shown on the player's watermark. It is signed on your server when your account requires signed ids.

The connection key and the signing secret stay on your server and never reach the browser.

The plugin's settings screens are in Arabic.

== External services ==

This plugin needs a BunStream account. It connects to the BunStream service, run by BunStream (https://bunstream.net), in two ways.

**The BunStream API (https://bunstream.net/api/integration/v1).** Used by your WordPress server to show your account name, folders and lessons in the settings screen and the editor. Each request sends your connection key and, when you search, your search text. Requests are made when an editor searches for a lesson, when you save the settings or test the connection, and about once a day when the plugin refreshes your account details.

**The BunStream player.** Each embedded lesson is an iframe loaded from the player address of your account, by default on bunstream.net. Your visitors' browsers load it when they open a page with a lesson, and BunStream receives their IP address and browser details, as any video host does. For signed-in users it also receives the student id you chose in the settings (WordPress ID, email or username). Choose "none" in the settings to send no student id.

BunStream [terms of service](https://bunstream.net/terms) and [privacy policy](https://bunstream.net/privacy).

== Installation ==

1. Install the plugin from Plugins > Add New, and activate it.
2. In BunStream, open "WordPress plugin", create a new WordPress key, paste it in Settings > BunStream on your site and press the connection test button.
3. Add your site's domain to the allowed domains in BunStream.
4. Add the "BunStream lesson" block, or write `[bunstream id="VIDEO_UUID"]`.

== Frequently Asked Questions ==

= Do I need a BunStream account? =

Yes. The videos are stored and played by BunStream, so the plugin does nothing without an account.

= The lesson does not play on my site =

Check that your site's domain is in the allowed domains in BunStream. The settings screen warns you when it is missing.

= Does it work with a page cache? =

The lesson link carries the student's id, so it must not be cached for signed-in students. Most cache plugins skip signed-in users by default, and the plugin asks them to skip pages that carry a student id.

= How do I send a value from another field? =

Use the `bunstream_student_id` filter:
`add_filter( 'bunstream_student_id', function ( $id, $user ) { return get_user_meta( $user->ID, 'student_code', true ); }, 10, 2 );`

== Changelog ==

= 1.0.2 =
* Prepared for WordPress.org: English readme, external services documented, tested with WordPress 7.1.

= 1.0.1 =
* The platform's address is now https://bunstream.net (the old address keeps working).

= 1.0.0 =
* First release: settings, connection test, block, classic button, shortcode, signed student ids.

== Upgrade Notice ==

= 1.0.2 =
No change in how the plugin works.
