# Video Files for ProcessWire: documentation The complete documentation. The short overview is in the [README](../README.md). A field for self-hosted video files. It builds on the core file field, so uploading, descriptions, tags, sorting and multi-language support work the way editors know them. ## Contents - [Requirements](#requirements) - [Installation](#installation) - [Coming from FieldtypeVideoFile (0.39.0 and earlier)](#coming-from-fieldtypevideofile-0390-and-earlier) - [Upgrading](#upgrading) - [In the page editor](#in-the-page-editor) - [Tabs for video fields](#tabs-for-video-fields) - [Showing videos on the website](#showing-videos-on-the-website) - [Options](#options) - [More about a video: its custom fields](#more-about-a-video-its-custom-fields) - [Transcript](#transcript) - [Going on where the visitor stopped](#going-on-where-the-visitor-stopped) - [At the end of a video](#at-the-end-of-a-video) - [Statistics](#statistics) - [Background videos](#background-videos) - [Styling](#styling) - [CSS frameworks](#css-frameworks) - [Stylesheet and script](#stylesheet-and-script) - [Search engines](#search-engines) - [Things to know](#things-to-know) - [Videos in a text](#videos-in-a-text) - [Protected videos](#protected-videos) - [Embedding on other websites](#embedding-on-other-websites) - [Captions](#captions) - [Chapters and overlays](#chapters-and-overlays) - [Chapters and overlays on the website](#chapters-and-overlays-on-the-website) - [Events for scripts](#events-for-scripts) - [Checklist](#checklist) - [Prepared for streaming](#prepared-for-streaming) - [Too large: tools for making a video smaller](#too-large-tools-for-making-a-video-smaller) - [What each video knows](#what-each-video-knows) - [Thumbnail](#thumbnail) - [Titles in several languages](#titles-in-several-languages) - [Tags](#tags) - [Finding pages by video properties](#finding-pages-by-video-properties) - [Where a video is placed](#where-a-video-is-placed) - [Reusing a video on other pages](#reusing-a-video-on-other-pages) - [The overview of all videos](#the-overview-of-all-videos) - [Videos uploaded more than once](#videos-uploaded-more-than-once) - [Several videos at once](#several-videos-at-once) - [Changing a file field to a video field](#changing-a-file-field-to-a-video-field) - [Translating the module](#translating-the-module) - [German](#german) - [With RockLanguage](#with-rocklanguage) - [Other languages, or changing a text](#other-languages-or-changing-a-text) - [For developers](#for-developers) ## Requirements - ProcessWire 3.0.227 or newer (tested on 3.0.227 and 3.0.259) - PHP 8.1 or newer - No ffmpeg and no PHP extensions beyond what ProcessWire needs ## Installation 1. Copy the `FieldtypeSelfHostedVideo` folder to `/site/modules/`. 2. In the admin go to Modules > Refresh, then install **Video Files**. The video input, the overview of all videos (Setup > Video Manager) and the text formatter "Videos in text" are installed along with it. 3. Add a field under Setup > Fields and choose **Single video** or **Multiple videos**. 4. Add the field to a template. New fields accept `mp4`, `webm` and `mov` files and have tags switched on. The overview is open to superusers. For other users, give one of their roles the permission `video-overview` (Access > Roles). It is optional: see "The overview of all videos". ### Coming from FieldtypeVideoFile (0.39.0 and earlier) Up to version 0.39.0 the module was called **FieldtypeVideoFile**. Since 0.40.0 it is **FieldtypeSelfHostedVideo**. The videos, the fields and the settings are taken over; nothing has to be entered again. 1. Do **not** uninstall the old module. That would only be possible after deleting the video fields, and with them the videos. 2. Delete the folder `/site/modules/FieldtypeVideoFile/`. 3. Copy the folder `FieldtypeSelfHostedVideo` to `/site/modules/`. 4. Go to Modules > Refresh and install **Video Files** (FieldtypeSelfHostedVideo). Messages about the missing FieldtypeVideoFile between steps 2 and 4 are expected. The installation finds what the old module left and moves it to the new names, in one go: - the type of the video fields, their input, and the text formatter "Videos in text" in text fields; - the button of TinyMCE and CKEditor, also where a template overrides the settings of a field; - the settings of the module and its parts; the Video Manager is under Setup again if it was there before, and left out if it was switched off (its permission and roles stay as they are); - the rules for embedding in the `.htaccess` files of pages; - the German translation (or any other), with no new import; - your own framework profiles: `/site/templates/videofile/` becomes `/site/templates/selfhostedvideo/`; - the log `videofile` becomes `selfhostedvideo`. - video fields that still allow only the old default `mp4 webm` also allow `mov`, as Modules > Refresh does since 0.34.0. As long as the old folder is still there, the new module refuses to install and says so. What you change yourself, in your own templates, stylesheets and scripts: | Before | Now | |---|---| | `$modules->get('FieldtypeVideoFile')` | `$modules->get('FieldtypeSelfHostedVideo')` | | `$modules->get('TextformatterVideoFile')` | `$modules->get('TextformatterSelfHostedVideo')` | | class names `fvf-video…` | `shv-video…` | | attributes `data-videofile-…` | `data-shv-…` | | events `videofile:play` and the others | `shv:play` … | | custom properties `--videofile-max-height` and the others | `--shv-max-height` … | | the script's name `window.FieldtypeVideoFile` | `window.FieldtypeSelfHostedVideo` | | `VideoFile.css`, `VideoFile.js` included by hand | `assets/SelfHostedVideo.css`, `assets/SelfHostedVideo.js` | | nginx variables `$videofile_refuse`, `$videofile_check` | `$shv_refuse`, `$shv_check` (only names; see "Embedding on other websites") | Unchanged: the tags in texts (`[[video intro.mp4]]`), the API of a video (`$page->videos`, `render()`, `Pagevideo`), the permission `video-overview`, the title "Video Files". ### Upgrading Replace the folder and go to Modules > Refresh. If you use the German translation, install it again afterwards (see "Translating the module"). Parts that are new since your version (the video input in 0.2.0, the overview of all videos in 0.9.0, the text formatter "Videos in text" in 0.10.0) are installed on the next page load. The notes below for older versions use the names of the time (`FieldtypeVideoFile`, `fvf-video` …). Changed in 0.16.0, so that nothing of the module can meet a name of another module or of your theme: - Every class name of a video on the website now begins with `fvf-video`: what was `videofile` is `fvf-video`, `videofile__overlay` is `fvf-video__overlay`, `videofile--portrait` is `fvf-video--portrait`, `videofile-text` is `fvf-video-text`, `videofile-plain` is `fvf-video-plain`, `videofile-host` is `fvf-video-host`. Rules of your own stylesheet and scripts that use the old names need the new ones. - The scripts add one name to a page, `FieldtypeVideoFile`. `VideoFile.init(element)` is now `FieldtypeVideoFile.player.init(element)`. - Unchanged: the attributes (`data-videofile-…`), the events (`videofile:play` …), the custom properties (`--videofile-max-height` …) and the tags in texts. New in 0.15.0: a module setting that shows video fields in tabs of their own in the page editor. Four new texts: install the German translation again. New in 0.14.1: in the editor for chapters and overlays a short note below the heading "Chapters" says what chapters are for. One new text: install the German translation again. New in 0.14.0: a profile for Bulma. Also fixed, with or without a profile: in a text area whose stylesheet numbers and indents every list (Bulma's `content`, and the like in many themes) the chapters of a video were numbered and indented too; and on websites with Bulma the title below a video was not bold. Fixed in 0.13.3: on websites with Pico CSS 2 the overlays lost their rounded corners, and, where Pico's stylesheet was loaded after the module's, their places on the picture; the buttons on the picture then looked like Pico's buttons. Fixed in 0.13.2: on websites whose stylesheet marks all links with a border (the "Default" site profile again), every chapter had a line below it, which made a double line between chapters with the UIkit 3 profile, and overlays that are links had a line at their lower edge. Fixed in 0.13.1: a video with a caption (`'caption' => true`) could not be seen on websites whose stylesheet gives all figures a width, as the "Default" site profile of ProcessWire does. New in 0.56.0: the stylesheets and scripts of the module are in a folder of their own, `assets/` (`assets/SelfHostedVideo.css`, `assets/SelfHostedVideo.js` and the files of the page editor, the Video Manager and the rich text editors). The module loads them from there by itself. **If your templates include `SelfHostedVideo.css` or `SelfHostedVideo.js` by hand** ("I add them to my templates myself"), change the address to `/site/modules/FieldtypeSelfHostedVideo/assets/…`. The profiles for CSS frameworks stay in `frameworks/`. New in 0.55.2: unit tests for the module (folder `tests/`, see `tests/README.md`). Nothing changes for visitors or editors. New in 0.55.1: the button with a link at the end of a video opens a page of this website in the same window, a page of another website in a new one (with a sign for it, and the words "opens in a new window" for screen readers). Two new texts: install the German translation again. New in 0.55.0, in the Video Manager: **videos uploaded more than once** are found (the same file on several pages) and can be merged into one that the others reuse, which frees their space ("Videos uploaded more than once"); **Replace video file** at each video, which leads to that button in the page editor; and **Plays in detail**, a page with the plays per day or week, how far viewers watch, and the numbers as a table ("Plays in detail"). A video that gets another file name (replaced by another format, or renamed) keeps its plays, and tags in texts that place it follow the new name. 68 new texts: install the German translation again. New in 0.54.1: in the upload area of the field, “drag and drop videos in here” is on the same line as the allowed file extensions. New in 0.54.0, in the Video Manager: sorted by plays (most or least watched in the last 30 days), the choices "Placed in a text", "Not watched in the last 30 days" and "Viewers stop early", and a list of the video tags in texts that show nothing. New texts: install the German translation again. New in 0.53.0: `render()` leaves out videos that a text of the same page shows with a tag, so that they are not on the page twice; `'includeall' => true` renders them all the same. Templates that relied on `render()` showing every video, also those of a text, need `includeall`. New in 0.52.0: a long video goes on where the visitor stopped (kept in their browser only), an end action per video (watch again, the next video, a link button), and anonymous counts of plays in the page editor and the Video Manager ("Last 30 days: 142 plays · 61% watched to the half · 38% to the end"). New texts: install the German translation again. New in 0.51.0: deleting a video that a text of its page places with a tag warns: in the page editor as soon as the video is marked for deletion, in the Video Manager when it asks before deleting, and after saving, naming the texts that show nothing now. New texts: install the German translation again. New in 0.50.0: the module keeps a list of where each video is placed (its own page, the pages that reuse it, texts with its tag) and shows it for each video in the page editor and in the Video Manager ("Placed on 2 pages: …"); `$video->usage()`, `$video->usedOnPages()`. The list is made for all pages after the upgrade. A notice in the admin says when the video sitemap was written again. New texts: install the German translation again. New in 0.49.0: the Open Graph tags of the first video are added to the `` of the page by `render()` (option `'opengraph' => false` to leave them out), and the video sitemap is the file `sitemap-videos.xml` in the root folder of the website, made by default (module setting "Do not create a video sitemap"). New texts: install the German translation again. New in 0.48.0, for search engines: the structured data names the same thumbnail as the player (before, it named the image at its stored size, which search engines take for another one), and the language of the page (`inLanguage`). Three new points on the checklist (thumbnail missing or too small, no description, the same title as another video), a video sitemap at `/sitemap-videos.xml` (module setting "Video sitemap", off by default) and Open Graph tags for sharing (`$page->videos->metaTags()`). See "Search engines". New texts: install the German translation again. New in 0.47.0: a handle to move each video in the page editor, by dragging, with the arrow keys or with a menu (to a position, also on another page of the list). Twelve new texts: install the German translation again. New in 0.46.0: **Per page** below a list of videos in the page editor (Show all, 5, 10, 15, 20, 30, 50), kept in the browser. Two new texts: install the German translation again. New in 0.45.0: pages also for video fields in the page editor, 10 videos per page by default (module setting "Videos per page in the page editor"). Two new texts: install the German translation again. New in 0.44.0: numbered pages in the Video Manager, 10 videos per page by default (module setting "Videos per page in the Video Manager"; before, the list had 24 per page). Six new texts: install the German translation again. New in 0.43.0: a new design of the actions on several videos in the Video Manager: one bar above the list, with the actions once videos are selected (see "Several videos at once"). Three new texts: install the German translation again. Changed in 0.42.1: the bar with **Save** at the bottom of the screen is gone; **Back to top** at the foot of each video leads to the save button of the page editor. New in 0.42.0: **Back to top** at the foot of each video instead of in the bar at the bottom of the screen, which keeps **Save**. One new text: install the German translation again. Fixed in 0.41.1: the move from FieldtypeVideoFile left video fields with the old default `mp4 webm` without `mov`. The move now adds it, and on sites already moved with 0.40.0 or 0.41.0, Modules > Refresh adds it once (the admin names each field it changed). New in 0.41.0: a video that is too large gets free tools for making it smaller in its checklist, and the button **Replace video file** right there (see "Too large: tools for making a video smaller"). Twelve new texts: install the German translation again. New in 0.40.0: the new name FieldtypeSelfHostedVideo (see "Coming from FieldtypeVideoFile"). New in 0.39.0: the Video Manager under Setup is optional (module settings). New in 0.38.0: texts entered for a video are limited in length and cleaned of control characters; a number that cannot be stored no longer loses the data of a video; bulk actions respect edit rights set for a field. New in 0.37.0: the question before leaving the page covers every step of an upload, also a file that is being checked, waits for its turn or for a decision, and the last step. New in 0.36.0: a bar with **Save** and **Back to top** at the bottom of the screen while a long list of videos is edited. New in 0.35.0: embedding on other websites can be blocked, for the whole site and for each video (see "Embedding on other websites"). New in 0.34.0: MOV files are allowed by default (video fields that still allowed only the old default "mp4 webm" get MOV at Modules > Refresh), and the button that chooses files opens the videos and the video camera on phones. New in 0.33.0: **Pause** and **Continue** for an upload, and a line for all files when several are uploaded at once. New in 0.32.0: an upload interrupted by a reload, a crash or a closed browser goes on where it stopped when the same file is chosen again (see "Continue after a reload or crash"). New in 0.31.0: uploads show the speed and the time left, wait for the connection when the computer is offline, and files are checked before they are sent (see "Upload" and "Check before uploading"). New in 0.30.0 (layout in 0.30.1): three numbered ways to the thumbnail: a frame from the video, six suggested pictures, an image of your own. New in 0.29.0: captions can be edited in the page editor ("Edit" next to each language). New in 0.28.0: actions on several videos at once in the Video Manager (prepare for streaming, add or remove a tag, delete), and the choices "Not prepared for streaming" and "Not on a published page" (see "Several videos at once"). New in 0.27.0: MP4 and MOV files are prepared for streaming (their index moved to the front of the file, nothing converted), by itself on upload and with a button in the checklist of videos that are already there (see "Prepared for streaming"). New in 0.26.0: a transcript of the captions below a video, shown by default in a box that opens; the time of each paragraph plays the video from there (see "Transcript"). New in 0.25.1: the German translation also comes in `RockLanguage/DE/`, for sites that use the module RockLanguage (see "Translating the module"). New in 0.25.0: a video field can be kept out of the tabs of the module (Setup > Fields > the field > Input > "Never in a tab"). New in 0.24.0: video fields can also be shown together in one tab "Videos" of the page editor (Modules > Video Files > "Video fields in the page editor"). New in 0.23.0, and a change to what `render()` shows by default: below a video come its title, its duration, its description, the box with what its custom fields say, and its chapters, in this order. Before, title and description (`caption`) and the box (`info`) were only shown when asked for. To keep the old output, leave them out: `render([ 'caption' => false, 'info' => false ])`. The same goes for videos in texts (`[[video intro.mp4 nocaption noinfo]]`). Without a CSS framework the title is larger, the duration is a smaller line with a clock, and the box is a light panel. With a framework profile the parts get its class names as before; the line with the duration is the new part `meta`, and the box is a panel of the framework (UIkit tile, Bootstrap card, Bulma box). New in 0.13.0: a profile for Bootstrap 5. New in 0.12.0: videos on the website can get the class names of a CSS framework (see "CSS frameworks"). Nothing changes until you choose one in the module settings. An overlay that is a link now keeps the text colour of its box while the pointer is on it, also where the website gives links another colour there. Coming from a version before 0.7.0: - The `