myetv-player 1.0.10 → 1.1.0
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.md +76 -2
- package/css/myetv-player.css +69 -0
- package/css/myetv-player.min.css +1 -1
- package/dist/myetv-player.js +54 -7
- package/dist/myetv-player.min.js +54 -7
- package/package.json +2 -1
- package/plugins/cloudflare/README.md +26 -4
- package/plugins/cloudflare/myetv-player-cloudflare-stream-plugin.js +1273 -217
- package/plugins/facebook/myetv-player-facebook-plugin.js +1340 -164
- package/plugins/twitch/myetv-player-twitch-plugin.js +428 -167
- package/plugins/vimeo/README.md +1 -1
- package/plugins/vimeo/myetv-player-vimeo.js +560 -247
- package/plugins/youtube/README.md +5 -2
- package/plugins/youtube/myetv-player-youtube-plugin.js +391 -105
- package/scss/_controls.scss +53 -0
- package/scss/_title-overlay.scss +27 -0
- package/src/core.js +34 -1
- package/src/utils.js +20 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ A modern and complete HTML5 + JavaScript + css video player with custom controls
|
|
|
15
15
|
- [Api Events](#api-events)
|
|
16
16
|
- [Keyboard Controls](#keyboard-controls)
|
|
17
17
|
- [CSS Customization](#css-customization)
|
|
18
|
-
- [
|
|
18
|
+
- [Multi-Language i18n](#internationalization-i18n)
|
|
19
19
|
- [Plugins Feature](#plugins-feature)
|
|
20
20
|
- [Chapters Feature](#chapters-feature)
|
|
21
21
|
- [Playlist Feature](#playlist-feature)
|
|
@@ -113,6 +113,7 @@ const player = new MYETVvideoplayer('my-video', {
|
|
|
113
113
|
| `defaultQuality` | string | `'auto'` | Default video quality |
|
|
114
114
|
| `showTitleOverlay` | boolean | `false` | Show video title overlay |
|
|
115
115
|
| `videoTitle` | string | `''` | Title to show in overlay |
|
|
116
|
+
| `videoSubtitle` | string | `''` | Sub-Title to show in overlay |
|
|
116
117
|
| `persistentTitle` | boolean | `false` | Keep title always visible |
|
|
117
118
|
| `language` | string | `en` | Interface language code |
|
|
118
119
|
| `brandLogoEnabled` | boolean | `false` | Show/hide the brand logo in the controlbar |
|
|
@@ -185,7 +186,7 @@ player.getSelectedQuality(); // Selected quality
|
|
|
185
186
|
player.getCurrentPlayingQuality(); // Actual playing quality
|
|
186
187
|
player.enableAutoQuality(); // Enable automatic selection
|
|
187
188
|
```
|
|
188
|
-
###
|
|
189
|
+
### Subtitles Controls
|
|
189
190
|
```
|
|
190
191
|
// Subtitles
|
|
191
192
|
player.toggleSubtitles(); // Toggle subtitles
|
|
@@ -746,6 +747,79 @@ Minimal DOM manipulation thanks to CSS-based theming
|
|
|
746
747
|
|
|
747
748
|
Hardware-accelerated transitions for smooth playback
|
|
748
749
|
|
|
750
|
+
## Internationalization (i18n)
|
|
751
|
+
|
|
752
|
+
The MYETV player includes a comprehensive internationalization system that allows the user interface to be displayed in multiple languages. The system automatically translates all controls, buttons, tooltips, and player messages into the selected language.
|
|
753
|
+
|
|
754
|
+
### Automatic Language Detection
|
|
755
|
+
|
|
756
|
+
If no language is specified in the initialization options, the player **automatically detects the language from the user's browser** using `navigator.language`. The system extracts the language code (e.g., `en` from `en-US`) and if a translation is available, applies it automatically. Otherwise, it defaults to English.
|
|
757
|
+
|
|
758
|
+
### Available Languages
|
|
759
|
+
|
|
760
|
+
The player currently supports the following languages:
|
|
761
|
+
|
|
762
|
+
| Code | Language | Native Name |
|
|
763
|
+
|------|----------|-------------|
|
|
764
|
+
| `it` | Italian | Italiano |
|
|
765
|
+
| `en` | English | English |
|
|
766
|
+
| `es` | Spanish | Español |
|
|
767
|
+
| `fr` | French | Français |
|
|
768
|
+
| `de` | German | Deutsch |
|
|
769
|
+
| `pt` | Portuguese | Português |
|
|
770
|
+
| `zh` | Chinese | 中文 |
|
|
771
|
+
| `ja` | Japanese | 日本語 |
|
|
772
|
+
| `ru` | Russian | Русский |
|
|
773
|
+
| `ar` | Arabic | العربية |
|
|
774
|
+
|
|
775
|
+
### Setting Language at Initialization
|
|
776
|
+
|
|
777
|
+
To specify a language during player initialization, use the `language` option:
|
|
778
|
+
```
|
|
779
|
+
const player = new VideoPlayer('myVideo', {
|
|
780
|
+
language: 'en', // Set to English
|
|
781
|
+
// other options...
|
|
782
|
+
});
|
|
783
|
+
```
|
|
784
|
+
### Changing Language Dynamically
|
|
785
|
+
|
|
786
|
+
You can change the player language at any time using the `setLanguage()` method:
|
|
787
|
+
```
|
|
788
|
+
// Change language to Spanish
|
|
789
|
+
player.setLanguage('es');
|
|
790
|
+
|
|
791
|
+
// Change language to French
|
|
792
|
+
player.setLanguage('fr');
|
|
793
|
+
```
|
|
794
|
+
The method returns `true` if the language was successfully changed, `false` if the specified language is not available.
|
|
795
|
+
|
|
796
|
+
### Getting Language Information
|
|
797
|
+
|
|
798
|
+
The player provides several methods to retrieve language information:
|
|
799
|
+
|
|
800
|
+
#### Get current language:
|
|
801
|
+
```
|
|
802
|
+
const currentLang = player.getCurrentLanguage();
|
|
803
|
+
console.log(currentLang); // e.g., 'en'
|
|
804
|
+
```
|
|
805
|
+
#### Get list of supported languages:
|
|
806
|
+
```
|
|
807
|
+
const languages = player.getSupportedLanguages();
|
|
808
|
+
console.log(languages); // ['it', 'en', 'es', 'fr', 'de', 'pt', 'zh', 'ja', 'ru', 'ar']
|
|
809
|
+
```
|
|
810
|
+
### Translated Elements
|
|
811
|
+
|
|
812
|
+
The i18n system automatically translates the following interface elements:
|
|
813
|
+
|
|
814
|
+
- Control buttons (play/pause, mute, fullscreen, etc.)
|
|
815
|
+
- Settings menus
|
|
816
|
+
- Video quality options
|
|
817
|
+
- Subtitle controls
|
|
818
|
+
- Playback speed controls
|
|
819
|
+
- Playlist controls
|
|
820
|
+
- Tooltips and help messages
|
|
821
|
+
- Brand logo
|
|
822
|
+
|
|
749
823
|
## Plugins feature
|
|
750
824
|
The player supports custom plugins to extend its functionality. Every plugins must have its own documentation to clearly known how to use it. Plugins are modular so you can add or remove any plugins whenever you want. This is just an example based on two plugins.
|
|
751
825
|
|
package/css/myetv-player.css
CHANGED
|
@@ -2433,6 +2433,31 @@ video::-webkit-media-text-track-display {
|
|
|
2433
2433
|
-moz-osx-font-smoothing: grayscale;
|
|
2434
2434
|
}
|
|
2435
2435
|
|
|
2436
|
+
.subtitle-text {
|
|
2437
|
+
color: var(--player-text-color);
|
|
2438
|
+
font-size: 14px;
|
|
2439
|
+
font-weight: 400;
|
|
2440
|
+
line-height: 1.3;
|
|
2441
|
+
margin: 5px 0 0 0;
|
|
2442
|
+
white-space: nowrap;
|
|
2443
|
+
overflow: hidden;
|
|
2444
|
+
text-overflow: ellipsis;
|
|
2445
|
+
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
|
|
2446
|
+
opacity: 0.9;
|
|
2447
|
+
-webkit-font-smoothing: antialiased;
|
|
2448
|
+
-moz-osx-font-smoothing: grayscale;
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
@media (max-width: 768px) {
|
|
2452
|
+
.subtitle-text {
|
|
2453
|
+
font-size: 12px;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
@media (max-width: 480px) {
|
|
2457
|
+
.subtitle-text {
|
|
2458
|
+
font-size: 11px;
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2436
2461
|
/* CONTROLS - IMPROVED RESPONSIVE DESIGN */
|
|
2437
2462
|
.controls {
|
|
2438
2463
|
position: absolute;
|
|
@@ -4744,6 +4769,50 @@ video::-webkit-media-text-track-display {
|
|
|
4744
4769
|
-webkit-touch-callout: none;
|
|
4745
4770
|
}
|
|
4746
4771
|
|
|
4772
|
+
/* Badge for video in encoding (duration Infinity/NaN) */
|
|
4773
|
+
.encoding-badge {
|
|
4774
|
+
display: inline-block;
|
|
4775
|
+
background: rgba(128, 128, 128, 0.8);
|
|
4776
|
+
color: white;
|
|
4777
|
+
padding: 2px 8px;
|
|
4778
|
+
border-radius: 4px;
|
|
4779
|
+
font-size: 11px;
|
|
4780
|
+
font-weight: 500;
|
|
4781
|
+
text-transform: uppercase;
|
|
4782
|
+
letter-spacing: 0.5px;
|
|
4783
|
+
white-space: nowrap;
|
|
4784
|
+
backdrop-filter: blur(4px);
|
|
4785
|
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
4786
|
+
animation: encoding-pulse 2s ease-in-out infinite;
|
|
4787
|
+
}
|
|
4788
|
+
|
|
4789
|
+
/* Class for the container when shows the badge */
|
|
4790
|
+
.time-display .encoding-state {
|
|
4791
|
+
display: flex;
|
|
4792
|
+
align-items: center;
|
|
4793
|
+
}
|
|
4794
|
+
|
|
4795
|
+
/* animation for the badge */
|
|
4796
|
+
@keyframes encoding-pulse {
|
|
4797
|
+
0%, 100% {
|
|
4798
|
+
opacity: 0.8;
|
|
4799
|
+
}
|
|
4800
|
+
50% {
|
|
4801
|
+
opacity: 1;
|
|
4802
|
+
}
|
|
4803
|
+
}
|
|
4804
|
+
@media (max-width: 480px) {
|
|
4805
|
+
.encoding-badge {
|
|
4806
|
+
font-size: 9px;
|
|
4807
|
+
padding: 1px 6px;
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
@media (max-width: 350px) {
|
|
4811
|
+
.encoding-badge {
|
|
4812
|
+
font-size: 8px;
|
|
4813
|
+
padding: 1px 4px;
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4747
4816
|
/* PROGRESS BAR */
|
|
4748
4817
|
.progress-container {
|
|
4749
4818
|
width: 100%;
|