Adding Preview Audio & Video files
Introduction
jDownloads supports adding either an audio file or a video file, which may have embedded audio, to a Download. Typically these are shown in the Downloads and the Download Details views as controlled by the relevant layout.
Further you may add a preview file, which is generally a short version of the downloadable file. If you do not add a preview file then jDownloads will use the main downloadable file as the preview. If you require visitors to be registered, to pay for the file or similar to Download please note that most browsers will be able download the preview and that there is no reliable way of inhibiting that ability. So we would always recommend that you create a short preview as a separate file. There is a note at the bottom of this article on a simple ways to make a preview file using web based services.
Further you may add a preview file, which is generally a short version of the downloadable file. If you do not add a preview file then jDownloads will use the main downloadable file as the preview. If you require visitors to be registered, to pay for the file or similar to Download please note that most browsers will be able download the preview and that there is no reliable way of inhibiting that ability. So we would always recommend that you create a short preview as a separate file. There is a note at the bottom of this article on a simple ways to make a preview file using web based services.
Typical examples of audio and video preview files are show opposite.
The Audio preview file may be shown as a simple control bar, or if an mp3 file optionally also with additional details.
Either type of preview is shown by including the place holder variable {preview_player} in the layout- it has no effect if the preview file is not an mp3 type.


Most of the standard layouts already have the {preview_player} in place. Despite its name this just shows the location and name of the preview file, it is not a link.
Options Settings
In both the front-end and the back-end there are settings required in the Options - Mediaplayer tab.
The first thing is to decide if the audio and video support is to be through HTML5 elements or by using the Flowplayer addon. HTML5 is recommended.
The settings for both options are the same. The width and height are set as maximum values so that the aspect ratio is maintained.
As usual if the first option is set to No then the other four options are hidden.

The first thing is to decide if the audio and video support is to be through HTML5 elements or by using the Flowplayer addon. HTML5 is recommended.
The settings for both options are the same. The width and height are set as maximum values so that the aspect ratio is maintained.
As usual if the first option is set to No then the other four options are hidden.


The other part that may need setting is the MP3 details mini layout.
This is also in the Options - Mediaplayer tab. In most cases no change is required.

User Groups settings
In the front-end it is also neccessary to set up the appropriate setting in those User Groups allowed to create and edit Downloads.
In the "Group Creation/Editing Settings" tab set the Allowed File types and the allowed Preview File Types.
jDownloads supports mp3, wav, wma and oga audio files and mp4, webm and ogv video files.
Also in the 'files' section tick boxes ensure you set the preview tick box.

jDownloads supports mp3, wav, wma and oga audio files and mp4, webm and ogv video files.
Also in the 'files' section tick boxes ensure you set the preview tick box.


Here we show adding in the Front End, adding in the backend is very similar.
The Files tab in the Create/Edit form is the place where the preview is added as illustrated opposite.
The types of preview file and the permitted maximum upoload size in kB are set for each User Group that has permission to create or edit a Download.
One could also allow ogg types which are assumed as video but this is not recommended as they could be audio.

Note: According to Wikipedia, https://en.wikipedia.org/wiki/HTML5_video, MP4 in the regular H264 version seems to be supported in all browsers.
Making a Preview
There are numerous applications for audio and video editting that you can download to you device. These generally comprehensive features so there could be a 'learning curve' challenge. So if you are just wanting to make a short preview clip for a few file files or to only make previews occaisionally then perhaps a web based service might be a solution. The limiting factor here is the upload time for the original file, particularly videos as they tend to be large!
For audio previews a simple effective and free service is at https://audiotrimmer.com/
Similarly for videos https://online-video-cutter.com/
For audio previews a simple effective and free service is at https://audiotrimmer.com/
Similarly for videos https://online-video-cutter.com/
ColinM July 2019
Tags: index