=== DCAST Live ===
Contributors: dcast
Tags: live stream, video, streaming, embed, broadcast
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 8.1
Stable tag: 0.2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Put your DCAST live streams and videos on your site with a block or a shortcode, upload videos and create a stream from the WordPress admin.

== Description ==

DCAST Live connects your WordPress site to your DCAST account. You stop copying embed codes by hand: pick a stream or a video from a list inside WordPress, and the player appears on the page.

* **DCAST player block.** Add the block, pick a live stream or a video from your account, done. Optional live chat next to the stream player.
* **Shortcodes** for the classic editor: `[dcast_stream id="..."]` and `[dcast_video id="..."]`.
* **Upload a video** from the WordPress admin (DCAST, Upload video). The file goes from your computer straight to your DCAST account, so this site's upload size limit does not apply and the file does not take space on your web server. A progress bar shows the upload and then DCAST preparing the video; when it is ready it is in the block's list, with a button for a new post.
* **Create a stream** from the WordPress admin. The encoder settings (server and stream key for OBS) are shown right there, and a draft post with the player can be created in the same step.
* **Your streams and videos in WordPress.** One click puts one into a new draft or at the end of an existing post or page.
* **Allowed websites check.** If your DCAST account limits which websites may show your player, the settings screen says so and adds this site with one click.
* **Clear errors.** When DCAST refuses something (a plan limit, a wrong key), the message says what to do next.

The player code always comes from your DCAST account through the DCAST Partner API, so what you see on your site is the same player your DCAST account gives you. What your plan includes (for example, removing DCAST branding) is decided by your DCAST plan, not by this plugin; the plugin has no paid features of its own.

= Shortcode options =

* `[dcast_stream id="ID" chat="yes"]` shows the live chat under the player.
* `responsive="no"` uses a fixed-size player instead of one that fits the page width.
* `width="960" height="540"` sets the fixed size (with `responsive="no"`).
* `[dcast_video id="ID"]` takes `responsive`, `width` and `height` the same way.

== External services ==

This plugin is a client of the DCAST service (a live streaming and video hosting platform). It does nothing without a DCAST account.

* **What is sent and when.** When you save an API key, open the DCAST screens in the admin, use the block picker, create a stream, upload a video, or when a page with a DCAST block or shortcode is shown and no fresh copy is cached, the plugin sends a request to the DCAST Partner API (by default `https://api.dcast.pro/api/v1`; the address can be changed on the settings page). Each request carries your API key and, for the action you take, the id of the stream or video, the stream or video title, the file name and size and the visibility, or the list of websites allowed to show your player. Answers are cached on your site for 10 minutes.
* **Video uploads.** For an upload, your site asks DCAST for a signed upload address that is valid for one video and one hour, and gives only that address to your browser. Your browser then sends the video file directly to DCAST (to `api.dcast.pro`, which forwards it to a DCAST storage server). The API key is not sent to the browser.
* **What visitors load.** Pages with a DCAST block or shortcode show the DCAST player in an iframe. The visitor's browser then loads the player from DCAST, under DCAST's terms and privacy policy.
* DCAST terms of service: https://dcast.tv/terms
* DCAST privacy policy: https://dcast.tv/privacy

== Installation ==

1. Install and activate the plugin.
2. In your DCAST account open Settings, API Keys and create a key. For creating streams and uploading videos from WordPress, give it STANDARD or FULL_ACCESS access; for showing players only, READ_ONLY is enough.
3. In WordPress open DCAST, Settings and paste the key. The screen confirms the connection and the account it belongs to.
4. Add the DCAST player block to a post or page, or open DCAST, Streams and videos.

== Frequently Asked Questions ==

= Where is my API key stored? =

In your WordPress database (options table), and it is never shown again after saving. It is sent only to the DCAST API address on the settings page, from your server; it never reaches visitors' browsers or the block editor.

= The player frame is empty on my site. =

Your DCAST account may limit which websites can show your player. Open DCAST, Settings: if this site is not on the list, the screen offers to add it.

= Who may upload videos? =

Users who may add media to this site (the `upload_files` capability: by default administrators, editors and authors). A site can change it with the `dcast_live_upload_capability` filter. Every upload goes into the DCAST account whose key is saved in the settings and counts toward its storage.

= Is there a file size limit? =

This site's PHP upload limit does not apply, because the file does not pass through this site. The limits of your DCAST plan apply; when one is reached, the upload screen shows DCAST's message.

= Can I protect videos from downloading with this plugin? =

No. The plugin shows the DCAST player; access rules (who may watch) are set on the stream or video in DCAST.

== Changelog ==

= 0.2.0 =
* Upload to DCAST: upload a video file from the WordPress admin straight into the DCAST account, with progress, resume of interrupted pieces, cancel, and a new post with the video when it is ready.

= 0.1.1 =
* Tested with WordPress 7.1.
* Translation template (languages/dcast-live.pot).

= 0.1.0 =
* First version: settings, block, shortcodes, stream creation, stream and video list with one-click insert, allowed websites check.
