=== Shelfcompass Video Voice Translator ===
Contributors: shelfcompass
Tags: video, dubbing, translation, subtitles, localization
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.5.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Generate AI voice-over for your videos in 31 languages and play them with a language switcher. Audio and subtitles land in your own Media Library.

== Description ==

Pick a video in your Media Library, choose the languages, and get a dubbed audio
track plus translated subtitles for each one. The files are stored in your own
Media Library, and the included player keeps your original video while switching
only the audio.

**How it works**

1. Open *Voice Translator → Settings* and press **Connect this site**. You sign in
   to dubanyvideo.com (or create an account), approve this site by name, and the
   plugin fetches its key itself — there is no key to copy. If you already have a
   key, or your site cannot open dubanyvideo.com in a browser, *Enter a key
   manually* on the same screen still works.
2. Open *Voice Translator* — it lists your videos and which languages each one has.
3. Choose languages, then pick how much control you want:
   * **Transcribe & review first** — the video is transcribed and translated at
     half the minute rate, and nothing is voiced yet. You get a review screen:
     correct the transcript and the translation, nudge the timings, say who
     speaks each line, and choose a voice per speaker. Then generate the audio.
   * **Dub now** — the machine's own reading, straight to audio. Cheaper, with
     nothing to correct first.
4. Either way the cost, and your remaining minutes, are shown before the click.
5. When a language finishes, its MP3, SRT and VTT files appear in your Media
   Library and can be played right there.
6. Add the *Dubbed video* block to a page, or use `[dubanyvideo id="123"]`.
   Viewers get an *Audio:* switcher labelled in each language's own name.

**Editing a dub you already published**

Change a line, a speaker or a voice and the languages you already generated are
marked *out of date* — the files keep playing, nothing is charged, and you decide
which language is worth generating again.

**Why only the audio is replaced**

One copy of the picture serves every language. Three languages of a ten-hour
library is roughly 0.8 GB of audio, against roughly 19 GB if every language were a
full video copy. Switching languages does not reload the video.

**What this plugin does not do**

* It does not host your media. Files are downloaded into your Media Library and
  served from your site. If this plugin disappears, your dubbed videos keep
  playing.
* It does not re-encode or modify your original video.
* It does not claim a translation is correct. Review the subtitles before you
  publish; they are ordinary SRT files you can edit.

**Voice and quality**

Speech is generated with synthetic voices and speaker detection. There is no voice
cloning and no lip sync, so the result suits lessons, tutorials, onboarding,
product and process videos rather than close-up advertising.

== External services ==

This plugin sends data to **dubanyvideo.com**, which performs the transcription,
translation and voice generation. Nothing is sent until you press *Connect this
site* or enter an API key.

* **What is sent:** the URL of the video you select and the target language
  codes. The dubbing service downloads the file from that URL. When your site is
  not reachable from the internet, the video file itself is uploaded instead, and
  the dubbing screen tells you so before you start. Your API key is sent as an
  authorization header.
* **When you connect:** this site's address, its name, a return address inside
  your admin and the hash of a one-time secret are carried in the link that opens
  dubanyvideo.com. Approving sends back a single-use code, which the plugin trades
  for your API key in a direct request from your server. The key itself never
  travels through the browser, and disconnecting revokes it.
* **When:** when you open a video's dubbing screen (a free length, balance and
  reachability check), while that screen is open (job status), once a minute
  through WP-Cron while a dub is running, when you press *Start dubbing*, and on
  the review screen when you edit a line, a speaker or a voice.
* **The price list:** once connected, the settings screen asks the service for
  the plans, their monthly minutes and their prices (`GET /api/v1/plans`) so
  nothing about pricing is hardcoded in the plugin. No key, no site data and no
  personal data are sent, and the answer is cached for twelve hours.
* **Identification:** requests name the plugin and its version in the
  User-Agent header. The site's address is not included.
* **The Contact screen:** only when you press *Send message*, and only what you
  typed — the category and the text — sent with your API key so the reply can go
  to the address on your account. Nothing about your site or your videos is
  attached, and the screen is never contacted otherwise.
* **What comes back:** a dubbed audio file and subtitle files, which the plugin
  downloads into your Media Library.
* **Retention:** an uploaded source file is deleted from the service after seven
  days. The finished audio and subtitles live in your Media Library, not on the
  service.
* Terms: https://dubanyvideo.com/terms — Privacy policy: https://dubanyvideo.com/privacy

An account on dubanyvideo.com is required; dubbing consumes minutes from that
account's balance.

== Frequently Asked Questions ==

= Does my site have to be publicly reachable? =

No. The service prefers to download the video from your site's URL, and when that
is not possible — a local install, a staging site behind a password, protected
uploads — the plugin uploads the file instead. The dubbing screen says which of
the two will happen before any minutes are spent. Files above 200 MB on an
unreachable site are the one case that needs a public URL.

= How long does one video take? =

Processing runs on the service's side and typically takes a few minutes per
language. The plugin checks every minute and imports the files when they are
ready; you can leave the page.

= Can I edit the subtitles? =

Yes. Both an SRT and a VTT file are added to your Media Library. The player uses
the VTT, so edit that file (or replace it) to change what viewers see.

= What happens if a language fails? =

The failure and its reason are shown on the video's dubbing screen, and nothing is
published. Minutes for a failed job are refunded by the service.

= Does it work with my theme's player? =

The block and the shortcode render their own lightweight player, because
switching audio tracks requires control over playback. Your original video stays
a normal attachment and can still be used anywhere else.

= Does the language switcher work on iPhone? =

Yes. The player keeps the video muted and plays the dubbed track alongside it,
which is the arrangement iOS permits, and it stops both together when the system
interrupts one of them — losing your headphones pauses the video rather than
leaving a silent picture.

== Screenshots ==

1. Every video in your library, the languages each one already speaks, and the shortcode to paste.
2. One video: what a language costs, what your balance is, and every finished language with its audio and subtitle files.
3. The script before anything is voiced — lines, timings, speakers and the voice each one gets.
4. The player a visitor sees, with the audio language menu under the video.

== Changelog ==

= 0.5.2 =
* The videos list and a video's dubbing screen load their styles and scripts again (lost in the 0.5.1 rename).

= 0.5.1 =
* Renamed to Shelfcompass Video Voice Translator; the plugin now installs as shelfcompass-video-voice-translator, which is also its text domain.

= 0.5.0 =
* Nothing is sent to dubanyvideo.com until you connect: the settings screen no longer fetches the price list on an unconnected site, and requests no longer carry the site's address in their User-Agent.
* Dubbing, deleting a language, retrying, reviewing and previewing check permission for that particular video, so an Author can act only on their own uploads.
* The "Create a draft page with this video" button now works.
* Every option, meta key, hook, handle and class uses the `dubanyvideo` prefix. A site that ran a pre-release build has to connect again, and videos dubbed with it no longer show their languages; the audio and subtitle files stay in the Media Library.

= 0.4.9 =
* A Contact screen: write to us from wp-admin, with your account and plan already attached, or use the email address beside the form when the connection itself is what is broken. A rejected message stays in the box instead of being lost.
* When every language of a video is finished, you land back on that video's own screen — each language with its player, its files, an edit that re-dubs it, and a delete — instead of a dead-end preview page. A failure keeps you where the error and the retry are.
* The video list sorts by name or by upload date.
* The audio switcher under the player is a menu rather than a row of buttons: a library with a dozen languages no longer wraps into a wall or scrolls the wanted language off-screen, and a phone gets the system picker.
* Admin screens and the player redrawn on one set of design tokens, with a dark mode that follows the visitor's system setting.
* A balance of zero that came from a refused starter grant now says so — "this network or this site already had the free minutes" — instead of reading as a billing fault.

= 0.4.4 =
* Deleting the plugin now revokes this site's key on the service and removes the plugin's own options, so a reinstall starts from the connect step instead of announcing a connection the owner thought they had removed. Dubbed audio, subtitles and their attachment records are left alone — they are your media.

= 0.4.3 =
* Settings screen lists the plans, with prices fetched from the service rather than compiled into the plugin, the current plan marked, and the per-hour price derived from the quota. Cards in a row now share one width and one baseline.

= 0.4.2 =
* Settings screen: account, plan and balance as three cards, with what a minute buys stated outright (one dubbed language costs a minute per minute of video, transcription for review half of that, same voices on every plan) and a link to upgrade or buy minutes. Disconnecting moved to a quiet footer row.

= 0.4.1 =
* A balance of zero now says which zero it is: free minutes held back until the
  account's email is confirmed are named as such, instead of sending you to the
  pricing page for minutes you already have.
* Plan names read as names, not as database values.

= 0.4.0 =
* A first-run screen that says what the plugin needs before it can dub anything:
  connect an account, then add a video. Activation lands there instead of on a
  screen whose only offer was an upload that could not lead anywhere.
* Every admin screen rebuilt on one layout — panels, headers and state pills that
  match across the videos list, the settings, the dubbing screen and the editor.
* The editor no longer loads its own copy of shared styles.

= 0.3.0 =
* Connect this site with one press: you sign in on dubanyvideo.com and approve
  the site by name, and the plugin fetches its own key. Copying a key between two
  tabs was the step people abandoned the setup on.
* The settings screen now leads with the connection — the account, the plan, the
  minutes left and the site it is connected as — and offers *Disconnect this
  site*, which revokes the key on our side. Audio already in your Media Library
  keeps playing.
* Free accounts get 10 minutes once, on connecting, so a first dub can be heard
  before anything is bought.
* Entering a key by hand is still there, collapsed under *Enter a key manually*,
  for an existing key or a site that cannot reach dubanyvideo.com in a browser.

= 0.2.1 =
* "Watch with the video": a finished dub can be checked in the real player from
  the dubbing and review screens, before the video is on any page. Listening to
  the mp3 never showed whether the dub sits on the picture.
* The script editor no longer appears while a video is still being transcribed;
  that screen now says what is running and what comes next.
* Finished audio shows its length straight away instead of "0:00 / 0:00".
* The shortcode accepts force="on" to make its default language win over the
  viewer's remembered choice.

= 0.2.0 =
* Reviewable dubbing: a video can be transcribed and translated first, then the
  transcript, timings, speakers and per-speaker voices edited before any audio is
  generated. Editing a finished language marks it out of date so it can be
  regenerated deliberately.
* The source-language transcript returned with every dub is now imported and
  offered in the player as the "Original" subtitle track.
* A videos screen with dubbing state, the cost and remaining minutes shown before
  a dub starts, live per-language progress, in-place preview of finished audio,
  and a "Dubbed video" block for the editor.

= 0.1.0 =
* First release: a videos screen with dubbing state, per-language dubbing with the
  cost shown before it is spent, live progress, automatic import of audio and
  subtitles into your Media Library, a *Dubbed video* block and a shortcode
  player with an audio language switcher.
