@meuuhdia/video-player 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.fr.md +129 -0
- package/README.it.md +129 -0
- package/README.md +54 -51
- package/locale/en.js +47 -0
- package/locale/fr.js +1 -1
- package/locale/it.js +47 -0
- package/modules/controls.js +17 -7
- package/modules/disclosure.js +1 -1
- package/modules/player.js +26 -3
- package/package.json +1 -1
package/README.fr.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Meuuhdia
|
|
2
|
+
|
|
3
|
+
- [english documentation](/README.md)
|
|
4
|
+
- [documentazione in italiano](/README.it.md)
|
|
5
|
+
|
|
6
|
+
Lecteur video inclusif embarquant les options de contrôle classiques.
|
|
7
|
+
Vous pouvez renseigner des fichiers de traduction, sous-titrage et transcription textuelle.
|
|
8
|
+
|
|
9
|
+
Le lecteur permettra à l'utilisateur d'activer et configurer lui même l'affichage de ces fichiers.
|
|
10
|
+
Il pourra modifier les couleurs et taille des sous-titres à sa convenance.
|
|
11
|
+
|
|
12
|
+
Ce lecteur a été conçu en ayant à coeur de créer un outil inclusif.
|
|
13
|
+
Toutefois, il n'a fait l'objet d'aucun audit, il y a donc certainement des choses a améliorer. Tous les retours sont les bienvenus.
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
1. Installer le lecteur avec NPM : `npm install @meuuhdia/video-player`
|
|
17
|
+
2. Activer le lecteur en ajoutant le code suivant dans votre fichier javascript principal (ou bien à l'endroit précis ou vous en avez besoin) :
|
|
18
|
+
```js
|
|
19
|
+
// sans empaqueteur JS
|
|
20
|
+
import "/node_modules/@meuuhdia/video-player/meuuhdia.js";
|
|
21
|
+
|
|
22
|
+
// avec empaqueteur JS
|
|
23
|
+
import "@meuuhdia/video-player";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Personnalisation
|
|
27
|
+
Vous pouvez mettre à jour les variables CSS Meuuhdia pour adapter les couleurs à votre design.
|
|
28
|
+
|
|
29
|
+
### Couleurs et police du lecteur
|
|
30
|
+
```css
|
|
31
|
+
:root {
|
|
32
|
+
--meuuhdia-color-main: #000000;
|
|
33
|
+
--meuuhdia-color-secondary: #FFFFFF;
|
|
34
|
+
--meuuhdia-font-family: "Luciole", consolas;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Couleurs par défaut des sous-titres
|
|
39
|
+
```css
|
|
40
|
+
:root {
|
|
41
|
+
--meuuhdia-cue-color: #ffff00;
|
|
42
|
+
--meuuhdia-cue-bgcolor: #000000;
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Utilisation
|
|
47
|
+
Copiez le code suivant à l'endroit ou vous souhaitez afficher le lecteur vidéo, il s'agit du code minimal nécessaire au fonctionnement de Meuuhdia.
|
|
48
|
+
- L'attribut "controls" permet de s'assurer d'avoir les options de contrôle disponibles dans le cas ou le lecteur natif serait affiché (javascript désactivé).
|
|
49
|
+
- L'attribut `[preload='metadata']` permet au lecteur Meuuhdia de charger la vidéo
|
|
50
|
+
- Au moins une balise `<source>` doit être renseignée
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<div class="meuuhdia">
|
|
54
|
+
<div class="meuuhdia_wrapper">
|
|
55
|
+
<video preload="metadata" controls>
|
|
56
|
+
<source src="path/to/your/video.mp4" type="video/mp4">
|
|
57
|
+
</video>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Sous-titres et traductions
|
|
63
|
+
Les fichiers vtt renseignés ne doivent pas contenir de styles css, Meuuhdia applique deja des styles adaptés pour que tout le monde puisse les lire correctement et les adapter à ses besoins.
|
|
64
|
+
|
|
65
|
+
#### Traduction
|
|
66
|
+
Pour fournir une traduction de la video l'attribut kind doit avoir la valeur "subtitles".
|
|
67
|
+
|
|
68
|
+
Exemple:
|
|
69
|
+
```html
|
|
70
|
+
<track kind="subtitles" src="path/to/your/subtitles.en.vtt" srclang="en" lang="en" label="English" />
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Sous-titre
|
|
74
|
+
Pour fournir un sous-titrage de la video l'attribut kind doit avoir la valeur "captions".
|
|
75
|
+
Un sous-titrage correct doit permettre de comprendre tout ce qu'il se passe dans la vidéo avec le son coupé, par exemple si une personne réagit à un bruit, ce bruit doit être retranscrit dans les sous-titres.
|
|
76
|
+
|
|
77
|
+
Exemple:
|
|
78
|
+
```html
|
|
79
|
+
<track kind="captions" src="path/to/your/captions.fr.vtt" srclang="fr" label="Français" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Pour un sous-titrage de qualité, 3 règles de base:
|
|
83
|
+
- Maximum 2 lignes de 40 caractères par image
|
|
84
|
+
- Afficher pendant minimum 600ms
|
|
85
|
+
- Minimum 160 ms entre 2 sous-titrages
|
|
86
|
+
|
|
87
|
+
Pour bénéficier de l'ensemble des fonctionnalités du lecteur, voici les différentes options de balisage et propriétés disponibles pour vos fichiers VTT:
|
|
88
|
+
- <v Fanch> : locuteur à l'écran (blanc)
|
|
89
|
+
- <v.whisp Fanch> : chuchote ou aparté (parenthèses)
|
|
90
|
+
- <v.group> : phrase dite par plusieurs locuteurs (majuscule)
|
|
91
|
+
- <v.off> : locuteur hors champ ou voix off (jaune, italique)
|
|
92
|
+
- <c.sound> : effet sonore non induit par l'image (rouge)
|
|
93
|
+
- <c.numeric> : effet sonore provenant d'un téléphone, tv... (asterisque)
|
|
94
|
+
- <c.think Narrateur> : pensée du personnage ou narration (cyan)
|
|
95
|
+
- <c.music> : indication musicale, paroles de chanson (magenta)
|
|
96
|
+
- <lang Breton> : indication de langue étrangère (vert)
|
|
97
|
+
- 00:10.360 --> 00:13.900 align: start/end (droite/gauche)
|
|
98
|
+
- 00:10.360 --> 00:13.900 line: 1 (haut)
|
|
99
|
+
|
|
100
|
+
### Transcription textuelle
|
|
101
|
+
Pour fournir une transcription textuelle de la video l'attribut kind doit avoir la valeur "descriptions".
|
|
102
|
+
|
|
103
|
+
Le fichier fourni doit être un fichier JSON contenant une liste de clé/valeur permettant d'afficher la transcription sous forme de liste ordonnée (ex: {"00:10 Clara": "Salut Toto !", "00:13 Toto": "Hey Clara, comment vas-tu ?"})
|
|
104
|
+
|
|
105
|
+
Une transcription correcte doit permettre de comprendre tout ce qu'il se passe dans la vidéo uniquement à la lecture du texte.
|
|
106
|
+
|
|
107
|
+
Exemple:
|
|
108
|
+
```html
|
|
109
|
+
<track kind="descriptions" src="path/to/your/transcript.it.json" srclang="it" label="italiano" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Exemple complet
|
|
113
|
+
```html
|
|
114
|
+
<div class="meuuhdia">
|
|
115
|
+
<div class="meuuhdia_wrapper">
|
|
116
|
+
<video poster="assets/poster.png" preload="metadata" controls disablePictureInPicture>
|
|
117
|
+
<source src="assets/extrait.mp4" type="video/mp4">
|
|
118
|
+
|
|
119
|
+
<track kind="subtitles" src="assets/subtitles.en.vtt" srclang="en" lang="en" label="English" />
|
|
120
|
+
|
|
121
|
+
<track kind="captions" src="assets/captions.fr.vtt" srclang="fr" label="Français" />
|
|
122
|
+
<track kind="captions" src="assets/captions.it.vtt" srclang="it" label="Italiano" />
|
|
123
|
+
|
|
124
|
+
<track kind="descriptions" src="assets/transcript.fr.json" srclang="fr" label="français" />
|
|
125
|
+
<track kind="descriptions" src="assets/transcript.it.json" srclang="it" label="italiano" />
|
|
126
|
+
</video>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
```
|
package/README.it.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Meuuhdia
|
|
2
|
+
|
|
3
|
+
- [english documentation](/README.md)
|
|
4
|
+
- [documentation en français](/README.fr.md)
|
|
5
|
+
|
|
6
|
+
Lettore video inclusivo che integra le opzioni di controllo classiche.
|
|
7
|
+
È possibile fornire file di traduzione, sottotitoli e trascrizione testuale.
|
|
8
|
+
|
|
9
|
+
Il lettore consente all'utente di attivare e configurare autonomamente la visualizzazione di questi file.
|
|
10
|
+
Potrà modificare i colori e la dimensione dei sottotitoli secondo le sue esigenze.
|
|
11
|
+
|
|
12
|
+
Questo lettore è stato progettato con l'obiettivo di creare uno strumento inclusivo.
|
|
13
|
+
Tuttavia, non è stato sottoposto ad alcun audit, quindi ci sono sicuramente aspetti da migliorare. Tutti i feedback sono benvenuti.
|
|
14
|
+
|
|
15
|
+
## Installazione
|
|
16
|
+
1. Installare il lettore con NPM: `npm install @meuuhdia/video-player`
|
|
17
|
+
2. Attivare il lettore aggiungendo il seguente codice nel file JavaScript principale (o nel punto preciso in cui ne avete bisogno):
|
|
18
|
+
```js
|
|
19
|
+
// senza bundler JS
|
|
20
|
+
import "/node_modules/@meuuhdia/video-player/meuuhdia.js";
|
|
21
|
+
|
|
22
|
+
// con bundler JS
|
|
23
|
+
import "@meuuhdia/video-player";
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Personalizzazione
|
|
27
|
+
È possibile aggiornare le variabili CSS di Meuuhdia per adattare i colori al proprio design.
|
|
28
|
+
|
|
29
|
+
### Colori e font del lettore
|
|
30
|
+
```css
|
|
31
|
+
:root {
|
|
32
|
+
--meuuhdia-color-main: #000000;
|
|
33
|
+
--meuuhdia-color-secondary: #FFFFFF;
|
|
34
|
+
--meuuhdia-font-family: "Luciole", consolas;
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Colori predefiniti dei sottotitoli
|
|
39
|
+
```css
|
|
40
|
+
:root {
|
|
41
|
+
--meuuhdia-cue-color: #ffff00;
|
|
42
|
+
--meuuhdia-cue-bgcolor: #000000;
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Utilizzo
|
|
47
|
+
Copiare il seguente codice nel punto in cui si desidera visualizzare il lettore video. Si tratta del codice minimo necessario per il funzionamento di Meuuhdia.
|
|
48
|
+
- L'attributo "controls" assicura la disponibilità delle opzioni di controllo nel caso in cui venga visualizzato il lettore nativo (JavaScript disabilitato).
|
|
49
|
+
- L'attributo `[preload='metadata']` permette al lettore Meuuhdia di caricare il video
|
|
50
|
+
- Deve essere fornito almeno un tag `<source>`
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<div class="meuuhdia">
|
|
54
|
+
<div class="meuuhdia_wrapper">
|
|
55
|
+
<video preload="metadata" controls>
|
|
56
|
+
<source src="path/to/your/video.mp4" type="video/mp4">
|
|
57
|
+
</video>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Sottotitoli e traduzioni
|
|
63
|
+
I file VTT forniti non devono contenere stili CSS. Meuuhdia applica già stili appropriati affinché tutti possano leggerli correttamente e adattarli alle proprie esigenze.
|
|
64
|
+
|
|
65
|
+
#### Traduzione
|
|
66
|
+
Per fornire una traduzione del video, l'attributo kind deve avere il valore "subtitles".
|
|
67
|
+
|
|
68
|
+
Esempio:
|
|
69
|
+
```html
|
|
70
|
+
<track kind="subtitles" src="path/to/your/subtitles.en.vtt" srclang="en" lang="en" label="English" />
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Sottotitoli
|
|
74
|
+
Per fornire sottotitoli per il video, l'attributo kind deve avere il valore "captions".
|
|
75
|
+
Un sottotitolo corretto deve permettere di comprendere tutto ciò che accade nel video con il suono disattivato. Ad esempio, se una persona reagisce a un rumore, quel rumore deve essere trascritto nei sottotitoli.
|
|
76
|
+
|
|
77
|
+
Esempio:
|
|
78
|
+
```html
|
|
79
|
+
<track kind="captions" src="path/to/your/captions.fr.vtt" srclang="fr" label="Français" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Per sottotitoli di qualità, 3 regole base:
|
|
83
|
+
- Massimo 2 righe di 40 caratteri per fotogramma
|
|
84
|
+
- Visualizzare per un minimo di 600ms
|
|
85
|
+
- Minimo 160ms tra 2 sottotitoli
|
|
86
|
+
|
|
87
|
+
Per beneficiare di tutte le funzionalità del lettore, ecco le diverse opzioni di markup e proprietà disponibili per i file VTT:
|
|
88
|
+
- <v Baingio>: parlante a schermo (bianco)
|
|
89
|
+
- <v.whisp Baingio>: sussurro o a parte (parentesi)
|
|
90
|
+
- <v.group>: frase detta da più parlanti (maiuscolo)
|
|
91
|
+
- <v.off>: parlante fuori campo o voce fuori campo (giallo, corsivo)
|
|
92
|
+
- <c.sound>: effetto sonoro non indotto dall'immagine (rosso)
|
|
93
|
+
- <c.numeric>: effetto sonoro proveniente da telefono, TV... (asterisco)
|
|
94
|
+
- <c.think Narratore>: pensiero del personaggio o narrazione (ciano)
|
|
95
|
+
- <c.music>: indicazione musicale, testo di canzoni (magenta)
|
|
96
|
+
- <lang Sardo>: indicazione di lingua straniera (verde)
|
|
97
|
+
- 00:10.360 --> 00:13.900 align: start/end (destra/sinistra)
|
|
98
|
+
- 00:10.360 --> 00:13.900 line: 1 (alto)
|
|
99
|
+
|
|
100
|
+
### Trascrizione testuale
|
|
101
|
+
Per fornire una trascrizione testuale del video, l'attributo kind deve avere il valore "descriptions".
|
|
102
|
+
|
|
103
|
+
Il file fornito deve essere un file JSON contenente un elenco di coppie chiave/valore per visualizzare la trascrizione sotto forma di elenco ordinato (es: {"00:10 Clara": "Ciao Toto!", "00:13 Toto": "Ehi Clara, come stai?"})
|
|
104
|
+
|
|
105
|
+
Una trascrizione corretta deve permettere di comprendere tutto ciò che accade nel video solo dalla lettura del testo.
|
|
106
|
+
|
|
107
|
+
Esempio:
|
|
108
|
+
```html
|
|
109
|
+
<track kind="descriptions" src="path/to/your/transcript.it.json" srclang="it" label="italiano" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Esempio completo
|
|
113
|
+
```html
|
|
114
|
+
<div class="meuuhdia">
|
|
115
|
+
<div class="meuuhdia_wrapper">
|
|
116
|
+
<video poster="assets/poster.png" preload="metadata" controls disablePictureInPicture>
|
|
117
|
+
<source src="assets/extrait.mp4" type="video/mp4">
|
|
118
|
+
|
|
119
|
+
<track kind="subtitles" src="assets/subtitles.en.vtt" srclang="en" lang="en" label="English" />
|
|
120
|
+
|
|
121
|
+
<track kind="captions" src="assets/captions.fr.vtt" srclang="fr" label="Français" />
|
|
122
|
+
<track kind="captions" src="assets/captions.it.vtt" srclang="it" label="Italiano" />
|
|
123
|
+
|
|
124
|
+
<track kind="descriptions" src="assets/transcript.fr.json" srclang="fr" label="français" />
|
|
125
|
+
<track kind="descriptions" src="assets/transcript.it.json" srclang="it" label="italiano" />
|
|
126
|
+
</video>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
```
|
package/README.md
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
# Meuuhdia
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
- [documentation en français](/README.fr.md)
|
|
4
|
+
- [documentazione in italiano](/README.it.md)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
Inclusive video player with standard control options.
|
|
7
|
+
You can provide translation files, subtitles, and text transcription.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
The player allows users to enable and configure the display of these files themselves.
|
|
10
|
+
They can customize the colors and size of subtitles to their preferences.
|
|
11
|
+
|
|
12
|
+
This player was designed with a commitment to creating an inclusive tool.
|
|
13
|
+
However, it has not undergone any accessibility audit, so there are certainly areas for improvement. All feedback is welcome.
|
|
11
14
|
|
|
12
15
|
## Installation
|
|
13
|
-
1.
|
|
14
|
-
2.
|
|
16
|
+
1. Install the player with NPM: `npm install @meuuhdia/video-player`
|
|
17
|
+
2. Enable the player by adding the following code to your main JavaScript file (or wherever you need it):
|
|
15
18
|
```js
|
|
16
|
-
//
|
|
19
|
+
// without JS bundler
|
|
17
20
|
import "/node_modules/@meuuhdia/video-player/meuuhdia.js";
|
|
18
21
|
|
|
19
|
-
//
|
|
22
|
+
// with JS bundler
|
|
20
23
|
import "@meuuhdia/video-player";
|
|
21
24
|
```
|
|
22
25
|
|
|
23
|
-
##
|
|
24
|
-
|
|
26
|
+
## Customization
|
|
27
|
+
You can update Meuuhdia CSS variables to adapt the colors to your design.
|
|
25
28
|
|
|
26
|
-
###
|
|
29
|
+
### Player colors and font
|
|
27
30
|
```css
|
|
28
31
|
:root {
|
|
29
32
|
--meuuhdia-color-main: #000000;
|
|
@@ -32,7 +35,7 @@ Vous pouvez mettre à jour les variables CSS Meuuhdia pour adapter les couleurs
|
|
|
32
35
|
}
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
###
|
|
38
|
+
### Default subtitle colors
|
|
36
39
|
```css
|
|
37
40
|
:root {
|
|
38
41
|
--meuuhdia-cue-color: #ffff00;
|
|
@@ -40,11 +43,11 @@ Vous pouvez mettre à jour les variables CSS Meuuhdia pour adapter les couleurs
|
|
|
40
43
|
}
|
|
41
44
|
```
|
|
42
45
|
|
|
43
|
-
##
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
46
|
+
## Usage
|
|
47
|
+
Copy the following code where you want to display the video player. This is the minimum code required for Meuuhdia to work.
|
|
48
|
+
- The "controls" attribute ensures control options are available if the native player is displayed (JavaScript disabled).
|
|
49
|
+
- The `[preload='metadata']` attribute allows the Meuuhdia player to load the video
|
|
50
|
+
- At least one `<source>` tag must be provided
|
|
48
51
|
|
|
49
52
|
```html
|
|
50
53
|
<div class="meuuhdia">
|
|
@@ -56,57 +59,57 @@ Copiez le code suivant à l'endroit ou vous souhaitez afficher le lecteur vidéo
|
|
|
56
59
|
</div>
|
|
57
60
|
```
|
|
58
61
|
|
|
59
|
-
###
|
|
60
|
-
|
|
62
|
+
### Subtitles and translations
|
|
63
|
+
VTT files provided should not contain CSS styles. Meuuhdia already applies appropriate styles so everyone can read them correctly and adapt them to their needs.
|
|
61
64
|
|
|
62
|
-
####
|
|
63
|
-
|
|
65
|
+
#### Translation
|
|
66
|
+
To provide a translation of the video, the kind attribute must have the value "subtitles".
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
Example:
|
|
66
69
|
```html
|
|
67
70
|
<track kind="subtitles" src="path/to/your/subtitles.en.vtt" srclang="en" lang="en" label="English" />
|
|
68
71
|
```
|
|
69
72
|
|
|
70
|
-
####
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
#### Captions
|
|
74
|
+
To provide captions for the video, the kind attribute must have the value "captions".
|
|
75
|
+
Proper captions should allow understanding everything happening in the video with the sound off. For example, if a person reacts to a noise, that noise should be transcribed in the captions.
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
Example:
|
|
75
78
|
```html
|
|
76
79
|
<track kind="captions" src="path/to/your/captions.fr.vtt" srclang="fr" label="Français" />
|
|
77
80
|
```
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
- Maximum 2
|
|
81
|
-
-
|
|
82
|
-
- Minimum
|
|
82
|
+
For quality captions, 3 basic rules:
|
|
83
|
+
- Maximum 2 lines of 40 characters per frame
|
|
84
|
+
- Display for a minimum of 600ms
|
|
85
|
+
- Minimum 160ms between 2 captions
|
|
83
86
|
|
|
84
|
-
|
|
85
|
-
- <v
|
|
86
|
-
- <v.whisp
|
|
87
|
-
- <v.group
|
|
88
|
-
- <v.off
|
|
89
|
-
- <c.sound
|
|
90
|
-
- <c.numeric
|
|
91
|
-
- <c.think
|
|
92
|
-
- <c.music
|
|
93
|
-
- <lang
|
|
94
|
-
- 00:10.360 --> 00:13.900 align: start/end (
|
|
95
|
-
- 00:10.360 --> 00:13.900 line: 1 (
|
|
87
|
+
To benefit from all player features, here are the different markup options and properties available for your VTT files:
|
|
88
|
+
- <v John>: on-screen speaker (white)
|
|
89
|
+
- <v.whisp John>: whisper or aside (parentheses)
|
|
90
|
+
- <v.group>: sentence spoken by multiple speakers (uppercase)
|
|
91
|
+
- <v.off>: off-screen speaker or voiceover (yellow, italic)
|
|
92
|
+
- <c.sound>: sound effect not induced by the image (red)
|
|
93
|
+
- <c.numeric>: sound effect from a phone, TV... (asterisk)
|
|
94
|
+
- <c.think Narrator>: character's thought or narration (cyan)
|
|
95
|
+
- <c.music>: musical indication, song lyrics (magenta)
|
|
96
|
+
- <lang Danish>: foreign language indication (green)
|
|
97
|
+
- 00:10.360 --> 00:13.900 align: start/end (right/left)
|
|
98
|
+
- 00:10.360 --> 00:13.900 line: 1 (top)
|
|
96
99
|
|
|
97
|
-
###
|
|
98
|
-
|
|
100
|
+
### Text transcription
|
|
101
|
+
To provide a text transcription of the video, the kind attribute must have the value "descriptions".
|
|
99
102
|
|
|
100
|
-
|
|
103
|
+
The provided file must be a JSON file containing a list of key/value pairs to display the transcription as an ordered list (e.g., {"00:10 Clara": "Hi Toto!", "00:13 Toto": "Hey Clara, how are you?"})
|
|
101
104
|
|
|
102
|
-
|
|
105
|
+
A proper transcription should allow understanding everything happening in the video from reading the text alone.
|
|
103
106
|
|
|
104
|
-
|
|
107
|
+
Example:
|
|
105
108
|
```html
|
|
106
109
|
<track kind="descriptions" src="path/to/your/transcript.it.json" srclang="it" label="italiano" />
|
|
107
110
|
```
|
|
108
111
|
|
|
109
|
-
###
|
|
112
|
+
### Complete example
|
|
110
113
|
```html
|
|
111
114
|
<div class="meuuhdia">
|
|
112
115
|
<div class="meuuhdia_wrapper">
|
|
@@ -123,4 +126,4 @@ Exemple:
|
|
|
123
126
|
</video>
|
|
124
127
|
</div>
|
|
125
128
|
</div>
|
|
126
|
-
```
|
|
129
|
+
```
|
package/locale/en.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const locale = {
|
|
2
|
+
code: "en",
|
|
3
|
+
controls: {
|
|
4
|
+
play: "play",
|
|
5
|
+
pause: "pause",
|
|
6
|
+
mute: "mute",
|
|
7
|
+
progress: "Duration",
|
|
8
|
+
volume: "volume",
|
|
9
|
+
voldec: "Decrease volume",
|
|
10
|
+
volinc: "Increase volume",
|
|
11
|
+
caption: "Captions and subtitles",
|
|
12
|
+
fullscreen: "Full screen"
|
|
13
|
+
},
|
|
14
|
+
datetime: {
|
|
15
|
+
hour: {sing: "hour", plur: "hours"},
|
|
16
|
+
minute: {sing: "minute", plur: "minutes"},
|
|
17
|
+
second: {sing: "second", plur: "seconds"}
|
|
18
|
+
},
|
|
19
|
+
cc: {
|
|
20
|
+
caption: "Captions",
|
|
21
|
+
subtitles: "Subtitles",
|
|
22
|
+
descriptions: "Descriptions",
|
|
23
|
+
selection: "Select a track",
|
|
24
|
+
customize: "Customize",
|
|
25
|
+
textColor: "Text color",
|
|
26
|
+
bgColor: "Background color",
|
|
27
|
+
textSize: "Size",
|
|
28
|
+
defaultColorOption: "default (SME)",
|
|
29
|
+
customColorOption: "custom",
|
|
30
|
+
bgStyleStroke: "text outline",
|
|
31
|
+
bgStyleFill: "background box",
|
|
32
|
+
textSectionLegend: "Text",
|
|
33
|
+
bgSectionLegend: "Background",
|
|
34
|
+
transcriptionLabel: "Text transcription",
|
|
35
|
+
transcriptionBottom: "transcription below video",
|
|
36
|
+
transcriptionRight: "transcription to the right of video"
|
|
37
|
+
},
|
|
38
|
+
words: {
|
|
39
|
+
enabled: "enabled",
|
|
40
|
+
disabled: "disabled",
|
|
41
|
+
disable: "disable",
|
|
42
|
+
color: "color",
|
|
43
|
+
size: "size",
|
|
44
|
+
style: "style",
|
|
45
|
+
theme: "theme"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/locale/fr.js
CHANGED
package/locale/it.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const locale = {
|
|
2
|
+
code: "it",
|
|
3
|
+
controls: {
|
|
4
|
+
play: "riproduci",
|
|
5
|
+
pause: "pausa",
|
|
6
|
+
mute: "silenzia",
|
|
7
|
+
progress: "Durata",
|
|
8
|
+
volume: "volume",
|
|
9
|
+
voldec: "Diminuisci volume",
|
|
10
|
+
volinc: "Aumenta volume",
|
|
11
|
+
caption: "Sottotitoli e traduzioni",
|
|
12
|
+
fullscreen: "Schermo intero"
|
|
13
|
+
},
|
|
14
|
+
datetime: {
|
|
15
|
+
hour: {sing: "ora", plur: "ore"},
|
|
16
|
+
minute: {sing: "minuto", plur: "minuti"},
|
|
17
|
+
second: {sing: "secondo", plur: "secondi"}
|
|
18
|
+
},
|
|
19
|
+
cc: {
|
|
20
|
+
caption: "Sottotitoli",
|
|
21
|
+
subtitles: "Traduzioni",
|
|
22
|
+
descriptions: "Descrizioni",
|
|
23
|
+
selection: "Seleziona una traccia",
|
|
24
|
+
customize: "Personalizza",
|
|
25
|
+
textColor: "Colore del testo",
|
|
26
|
+
bgColor: "Colore di sfondo",
|
|
27
|
+
textSize: "Dimensione",
|
|
28
|
+
defaultColorOption: "predefinito (SME)",
|
|
29
|
+
customColorOption: "personalizzato",
|
|
30
|
+
bgStyleStroke: "contorno del testo",
|
|
31
|
+
bgStyleFill: "riquadro",
|
|
32
|
+
textSectionLegend: "Il testo",
|
|
33
|
+
bgSectionLegend: "Lo sfondo",
|
|
34
|
+
transcriptionLabel: "Trascrizione testuale",
|
|
35
|
+
transcriptionBottom: "trascrizione sotto il video",
|
|
36
|
+
transcriptionRight: "trascrizione a destra del video"
|
|
37
|
+
},
|
|
38
|
+
words: {
|
|
39
|
+
enabled: "attivato",
|
|
40
|
+
disabled: "disattivato",
|
|
41
|
+
disable: "disattiva",
|
|
42
|
+
color: "colore",
|
|
43
|
+
size: "dimensione",
|
|
44
|
+
style: "stile",
|
|
45
|
+
theme: "tema"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/modules/controls.js
CHANGED
|
@@ -66,6 +66,8 @@ class MeuuhdiaControls {
|
|
|
66
66
|
|
|
67
67
|
this.controls.appendChild(fullscreen);
|
|
68
68
|
this.#actionAddEventListeners();
|
|
69
|
+
this.#setVolumeIcon();
|
|
70
|
+
if(this.video.hasAttribute("autoplay")) this.#setIconPlayPause(true);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
#actionAddEventListeners() {
|
|
@@ -102,20 +104,28 @@ class MeuuhdiaControls {
|
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
#actionPlayPause() {
|
|
105
|
-
let play = this.controls.querySelector(".meuuhdia_playpause");
|
|
106
|
-
let icon = play.querySelector("svg");
|
|
107
|
-
let label = play.querySelector(".sr-only");
|
|
108
|
-
|
|
109
107
|
if (this.video.paused || this.video.ended) {
|
|
110
108
|
this.video.play();
|
|
111
|
-
play.replaceChild(MeuuhdiaIcon.createIcon("pause"), icon);
|
|
112
|
-
label.textContent = "pause";
|
|
113
109
|
this.#toggleControls();
|
|
114
110
|
} else {
|
|
115
111
|
clearTimeout(this.controlsTimeout);
|
|
116
112
|
this.video.pause();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
this.#setIconPlayPause();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#setIconPlayPause($autoplay = false) {
|
|
119
|
+
let play = this.controls.querySelector(".meuuhdia_playpause");
|
|
120
|
+
let icon = play.querySelector("svg");
|
|
121
|
+
let label = play.querySelector(".sr-only");
|
|
122
|
+
|
|
123
|
+
if (!$autoplay & (this.video.paused || this.video.ended)) {
|
|
117
124
|
play.replaceChild(MeuuhdiaIcon.createIcon("play"), icon);
|
|
118
|
-
label.textContent = "lecture";
|
|
125
|
+
label.textContent = "lecture";
|
|
126
|
+
} else {
|
|
127
|
+
play.replaceChild(MeuuhdiaIcon.createIcon("pause"), icon);
|
|
128
|
+
label.textContent = "pause";
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
|
package/modules/disclosure.js
CHANGED
|
@@ -21,7 +21,7 @@ export let meuuhdiaDisclosure = {
|
|
|
21
21
|
* @returns {Node} <li> element
|
|
22
22
|
*/
|
|
23
23
|
createDisclosure: function(actionName, actionIconName, actionLabel, contentNodes, iconLabel = null) {
|
|
24
|
-
let index = document.querySelectorAll("meuuhdia_disclosure").length + 1;
|
|
24
|
+
let index = document.querySelectorAll(".meuuhdia_disclosure").length + 1;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* ? Action
|
package/modules/player.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MeuuhdiaControls } from "./controls.js";
|
|
2
|
-
import { locale } from "../locale/
|
|
2
|
+
import { locale as locale_en } from "../locale/en.js";
|
|
3
|
+
import { locale as locale_fr } from "../locale/fr.js";
|
|
4
|
+
import { locale as locale_it } from "../locale/it.js";
|
|
3
5
|
|
|
4
6
|
class MeuuhdiaPlayer {
|
|
5
7
|
/**
|
|
@@ -43,8 +45,21 @@ class MeuuhdiaPlayer {
|
|
|
43
45
|
* @param {Node} meuuhdia
|
|
44
46
|
*/
|
|
45
47
|
constructor(meuuhdia) {
|
|
48
|
+
let inherit_locale = meuuhdia.closest("[lang]") ? meuuhdia.closest("[lang]").getAttribute("lang").split("-")[0] : "en";
|
|
49
|
+
let current_locale = meuuhdia.dataset.locale ?? inherit_locale;
|
|
50
|
+
|
|
51
|
+
switch(current_locale) {
|
|
52
|
+
case "fr":
|
|
53
|
+
this.locale = locale_fr;
|
|
54
|
+
break;
|
|
55
|
+
case "it":
|
|
56
|
+
this.locale = locale_it;
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
this.locale = locale_en;
|
|
60
|
+
}
|
|
61
|
+
|
|
46
62
|
this.meuuhdia = meuuhdia;
|
|
47
|
-
this.locale = locale;
|
|
48
63
|
}
|
|
49
64
|
|
|
50
65
|
/**
|
|
@@ -72,7 +87,15 @@ class MeuuhdiaPlayer {
|
|
|
72
87
|
this.wrapper.setAttribute("lang", this.locale.code);
|
|
73
88
|
|
|
74
89
|
this.video = this.meuuhdia.querySelector("video");
|
|
75
|
-
this.video.querySelectorAll("track").forEach(track =>
|
|
90
|
+
this.video.querySelectorAll("track").forEach(track => {
|
|
91
|
+
const allowed_types = ["captions", "subtitles", "descriptions"];
|
|
92
|
+
var current_type = track.getAttribute("kind");
|
|
93
|
+
var extension = track.getAttribute("src")?.split(".").pop();
|
|
94
|
+
|
|
95
|
+
if(allowed_types.includes(current_type) && ("descriptions" != current_type || "json" == extension)) {
|
|
96
|
+
track.id = current_type + "_" + track.getAttribute("srclang");
|
|
97
|
+
} else track.remove();
|
|
98
|
+
});
|
|
76
99
|
|
|
77
100
|
let Controls = new MeuuhdiaControls(this.locale, this.wrapper, this.video);
|
|
78
101
|
this.controls = Controls.controls;
|