ts-video-player 0.1.6 → 0.1.8
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/dist/cdn.min.js +70 -50
- package/dist/{chunk-fvz33zn4.js → chunk-hvjcmbfn.js} +765 -114
- package/dist/core/i18n.d.ts +24 -0
- package/dist/elements/index.js +2 -2
- package/dist/elements/utils.d.ts +16 -2
- package/dist/index.js +28 -419
- package/dist/player.d.ts +12 -0
- package/dist/providers/vimeo.d.ts +6 -0
- package/dist/providers/youtube.d.ts +6 -0
- package/package.json +1 -1
- package/src/core/i18n.ts +173 -1
- package/src/elements/media-airplay-button.ts +2 -2
- package/src/elements/media-fullscreen-button.ts +3 -3
- package/src/elements/media-live-button.ts +2 -2
- package/src/elements/media-mute-button.ts +3 -3
- package/src/elements/media-pip-button.ts +3 -2
- package/src/elements/media-play-button.ts +3 -3
- package/src/elements/media-playback-rate-button.ts +3 -3
- package/src/elements/media-progress-bar.ts +3 -3
- package/src/elements/media-remote-playback-button.ts +2 -2
- package/src/elements/media-seek-button.ts +2 -3
- package/src/elements/media-settings-menu.ts +14 -14
- package/src/elements/media-time-display.ts +2 -2
- package/src/elements/media-volume-slider.ts +2 -2
- package/src/elements/utils.ts +40 -6
- package/src/elements/video-skin.ts +21 -1
- package/src/player.ts +76 -18
- package/src/providers/vimeo.ts +15 -3
- package/src/providers/youtube.ts +27 -5
package/dist/core/i18n.d.ts
CHANGED
|
@@ -55,6 +55,30 @@ export interface TranslationStrings {
|
|
|
55
55
|
close: string;
|
|
56
56
|
menu: string;
|
|
57
57
|
back: string;
|
|
58
|
+
seek: string;
|
|
59
|
+
playbackRate: string;
|
|
60
|
+
airPlayPlay: string;
|
|
61
|
+
remotePlayback: string;
|
|
62
|
+
videoPlayer: string;
|
|
63
|
+
videoRole: string;
|
|
64
|
+
playTitle: string;
|
|
65
|
+
audio: string;
|
|
66
|
+
defaultTrack: string;
|
|
67
|
+
playing: string;
|
|
68
|
+
paused: string;
|
|
69
|
+
muted: string;
|
|
70
|
+
volumeLevel: string;
|
|
71
|
+
ended: string;
|
|
72
|
+
enteredFullscreen: string;
|
|
73
|
+
exitedFullscreen: string;
|
|
74
|
+
errorMessage: string;
|
|
75
|
+
timeOf: string;
|
|
76
|
+
hourOne: string;
|
|
77
|
+
hourOther: string;
|
|
78
|
+
minuteOne: string;
|
|
79
|
+
minuteOther: string;
|
|
80
|
+
secondOne: string;
|
|
81
|
+
secondOther: string;
|
|
58
82
|
}
|
|
59
83
|
export type TranslationKey = keyof TranslationStrings;
|
|
60
84
|
export interface I18nConfig {
|
package/dist/elements/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
VideoPlayerElement2,
|
|
3
2
|
formatTime2,
|
|
4
3
|
formatTimePhrase2,
|
|
5
4
|
toISODuration2,
|
|
6
5
|
resolvePlayer2,
|
|
6
|
+
VideoPlayerElement2,
|
|
7
7
|
VideoSkin2,
|
|
8
8
|
MediaPlayButton2,
|
|
9
9
|
MediaMuteButton2,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
MediaErrorDisplay2,
|
|
24
24
|
MediaRemotePlaybackButton2,
|
|
25
25
|
registerElements2
|
|
26
|
-
} from "../chunk-
|
|
26
|
+
} from "../chunk-hvjcmbfn.js";
|
|
27
27
|
export {
|
|
28
28
|
MediaAirplayButton2 as MediaAirplayButton,
|
|
29
29
|
MediaErrorDisplay2 as MediaErrorDisplay,
|
package/dist/elements/utils.d.ts
CHANGED
|
@@ -5,15 +5,29 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module elements/utils
|
|
7
7
|
*/
|
|
8
|
+
import type { TranslationKey } from '../core/i18n';
|
|
9
|
+
/**
|
|
10
|
+
* The language a control speaks: the nearest `lang` attribute above it,
|
|
11
|
+
* through shadow roots (`<html lang="de">`, or `lang` on the `<video-player>`
|
|
12
|
+
* itself), then the browser's. A German page gets German button names and
|
|
13
|
+
* screen-reader announcements without configuring the player.
|
|
14
|
+
*/
|
|
15
|
+
export declare function languageOf(el: Node | null | undefined): string;
|
|
16
|
+
/**
|
|
17
|
+
* A control's words in its language (languageOf): the built-in translations
|
|
18
|
+
* plus any an app added with getI18n().addTranslations(), English for a
|
|
19
|
+
* language or key that has none.
|
|
20
|
+
*/
|
|
21
|
+
export declare function label(el: Node | null | undefined, key: TranslationKey, params?: Record<string, string | number>): string;
|
|
8
22
|
/**
|
|
9
23
|
* Format time in seconds to MM:SS or HH:MM:SS
|
|
10
24
|
*/
|
|
11
25
|
export declare function formatTime(seconds: number, guide?: number): string;
|
|
12
26
|
/**
|
|
13
27
|
* Format time as a human-readable phrase for screen readers.
|
|
14
|
-
* e.g., "1 minute, 30 seconds"
|
|
28
|
+
* e.g., "1 minute, 30 seconds", in the language of `el` when one is given.
|
|
15
29
|
*/
|
|
16
|
-
export declare function formatTimePhrase(seconds: number): string;
|
|
30
|
+
export declare function formatTimePhrase(seconds: number, el?: Node | null): string;
|
|
17
31
|
/**
|
|
18
32
|
* Convert seconds to ISO 8601 duration string.
|
|
19
33
|
* e.g., 90 -> "PT1M30S"
|
package/dist/index.js
CHANGED
|
@@ -29,13 +29,25 @@ import {
|
|
|
29
29
|
findLoader2,
|
|
30
30
|
detectMediaType2,
|
|
31
31
|
getPreconnectHints2,
|
|
32
|
+
englishStrings2,
|
|
33
|
+
spanishStrings2,
|
|
34
|
+
frenchStrings2,
|
|
35
|
+
germanStrings2,
|
|
36
|
+
japaneseStrings2,
|
|
37
|
+
chineseStrings2,
|
|
38
|
+
defaultTranslations2,
|
|
39
|
+
I18n2,
|
|
40
|
+
createI18n2,
|
|
41
|
+
getI18n2,
|
|
42
|
+
setI18n2,
|
|
43
|
+
t2,
|
|
44
|
+
formatTime2,
|
|
45
|
+
formatTimePhrase2,
|
|
46
|
+
toISODuration2,
|
|
32
47
|
Player2,
|
|
33
48
|
createPlayer2,
|
|
34
49
|
getPlayer2,
|
|
35
50
|
VideoPlayerElement2,
|
|
36
|
-
formatTime2,
|
|
37
|
-
formatTimePhrase2,
|
|
38
|
-
toISODuration2,
|
|
39
51
|
VideoSkin2,
|
|
40
52
|
MediaPlayButton2,
|
|
41
53
|
MediaMuteButton2,
|
|
@@ -51,7 +63,7 @@ import {
|
|
|
51
63
|
applyPosition2,
|
|
52
64
|
MediaSettingsMenu2,
|
|
53
65
|
registerElements2
|
|
54
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-hvjcmbfn.js";
|
|
55
67
|
import {
|
|
56
68
|
playback2,
|
|
57
69
|
volume2,
|
|
@@ -1116,409 +1128,6 @@ function formatTime(seconds) {
|
|
|
1116
1128
|
}
|
|
1117
1129
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
1118
1130
|
}
|
|
1119
|
-
// src/core/i18n.ts
|
|
1120
|
-
var englishStrings = {
|
|
1121
|
-
play: "Play",
|
|
1122
|
-
pause: "Pause",
|
|
1123
|
-
replay: "Replay",
|
|
1124
|
-
mute: "Mute",
|
|
1125
|
-
unmute: "Unmute",
|
|
1126
|
-
volume: "Volume",
|
|
1127
|
-
seekBackward: "Seek backward {seconds} seconds",
|
|
1128
|
-
seekForward: "Seek forward {seconds} seconds",
|
|
1129
|
-
seekTo: "Seek to {time}",
|
|
1130
|
-
duration: "Duration",
|
|
1131
|
-
currentTime: "Current time",
|
|
1132
|
-
played: "Played",
|
|
1133
|
-
buffered: "Buffered",
|
|
1134
|
-
enterFullscreen: "Enter fullscreen",
|
|
1135
|
-
exitFullscreen: "Exit fullscreen",
|
|
1136
|
-
enterPiP: "Enter picture-in-picture",
|
|
1137
|
-
exitPiP: "Exit picture-in-picture",
|
|
1138
|
-
enableCaptions: "Enable captions",
|
|
1139
|
-
disableCaptions: "Disable captions",
|
|
1140
|
-
captions: "Captions",
|
|
1141
|
-
captionsOff: "Off",
|
|
1142
|
-
settings: "Settings",
|
|
1143
|
-
quality: "Quality",
|
|
1144
|
-
auto: "Auto",
|
|
1145
|
-
speed: "Speed",
|
|
1146
|
-
normal: "Normal",
|
|
1147
|
-
loop: "Loop",
|
|
1148
|
-
loopEnabled: "Loop enabled",
|
|
1149
|
-
loopDisabled: "Loop disabled",
|
|
1150
|
-
audioBoost: "Audio boost",
|
|
1151
|
-
audioTrack: "Audio track",
|
|
1152
|
-
live: "LIVE",
|
|
1153
|
-
liveEdge: "At live edge",
|
|
1154
|
-
seekToLive: "Seek to live edge",
|
|
1155
|
-
behindLive: "{seconds}s behind",
|
|
1156
|
-
networkError: "A network error occurred",
|
|
1157
|
-
mediaError: "The media could not be loaded",
|
|
1158
|
-
unknownError: "An unknown error occurred",
|
|
1159
|
-
loading: "Loading",
|
|
1160
|
-
buffering: "Buffering",
|
|
1161
|
-
chapters: "Chapters",
|
|
1162
|
-
airPlay: "AirPlay",
|
|
1163
|
-
googleCast: "Cast",
|
|
1164
|
-
casting: "Casting to {device}",
|
|
1165
|
-
download: "Download",
|
|
1166
|
-
share: "Share",
|
|
1167
|
-
close: "Close",
|
|
1168
|
-
menu: "Menu",
|
|
1169
|
-
back: "Back"
|
|
1170
|
-
};
|
|
1171
|
-
var spanishStrings = {
|
|
1172
|
-
play: "Reproducir",
|
|
1173
|
-
pause: "Pausar",
|
|
1174
|
-
replay: "Repetir",
|
|
1175
|
-
mute: "Silenciar",
|
|
1176
|
-
unmute: "Activar sonido",
|
|
1177
|
-
volume: "Volumen",
|
|
1178
|
-
seekBackward: "Retroceder {seconds} segundos",
|
|
1179
|
-
seekForward: "Avanzar {seconds} segundos",
|
|
1180
|
-
seekTo: "Ir a {time}",
|
|
1181
|
-
duration: "Duración",
|
|
1182
|
-
currentTime: "Tiempo actual",
|
|
1183
|
-
played: "Reproducido",
|
|
1184
|
-
buffered: "Almacenado",
|
|
1185
|
-
enterFullscreen: "Pantalla completa",
|
|
1186
|
-
exitFullscreen: "Salir de pantalla completa",
|
|
1187
|
-
enterPiP: "Imagen en imagen",
|
|
1188
|
-
exitPiP: "Salir de imagen en imagen",
|
|
1189
|
-
enableCaptions: "Activar subtítulos",
|
|
1190
|
-
disableCaptions: "Desactivar subtítulos",
|
|
1191
|
-
captions: "Subtítulos",
|
|
1192
|
-
captionsOff: "Desactivados",
|
|
1193
|
-
settings: "Ajustes",
|
|
1194
|
-
quality: "Calidad",
|
|
1195
|
-
auto: "Automático",
|
|
1196
|
-
speed: "Velocidad",
|
|
1197
|
-
normal: "Normal",
|
|
1198
|
-
loop: "Bucle",
|
|
1199
|
-
loopEnabled: "Bucle activado",
|
|
1200
|
-
loopDisabled: "Bucle desactivado",
|
|
1201
|
-
audioBoost: "Aumento de audio",
|
|
1202
|
-
audioTrack: "Pista de audio",
|
|
1203
|
-
live: "EN VIVO",
|
|
1204
|
-
liveEdge: "En vivo",
|
|
1205
|
-
seekToLive: "Ir al directo",
|
|
1206
|
-
behindLive: "{seconds}s de retraso",
|
|
1207
|
-
networkError: "Error de red",
|
|
1208
|
-
mediaError: "No se pudo cargar el medio",
|
|
1209
|
-
unknownError: "Error desconocido",
|
|
1210
|
-
loading: "Cargando",
|
|
1211
|
-
buffering: "Almacenando",
|
|
1212
|
-
chapters: "Capítulos",
|
|
1213
|
-
airPlay: "AirPlay",
|
|
1214
|
-
googleCast: "Enviar",
|
|
1215
|
-
casting: "Enviando a {device}",
|
|
1216
|
-
download: "Descargar",
|
|
1217
|
-
share: "Compartir",
|
|
1218
|
-
close: "Cerrar",
|
|
1219
|
-
menu: "Menú",
|
|
1220
|
-
back: "Volver"
|
|
1221
|
-
};
|
|
1222
|
-
var frenchStrings = {
|
|
1223
|
-
play: "Lecture",
|
|
1224
|
-
pause: "Pause",
|
|
1225
|
-
replay: "Relire",
|
|
1226
|
-
mute: "Muet",
|
|
1227
|
-
unmute: "Son activé",
|
|
1228
|
-
volume: "Volume",
|
|
1229
|
-
seekBackward: "Reculer de {seconds} secondes",
|
|
1230
|
-
seekForward: "Avancer de {seconds} secondes",
|
|
1231
|
-
seekTo: "Aller à {time}",
|
|
1232
|
-
duration: "Durée",
|
|
1233
|
-
currentTime: "Temps actuel",
|
|
1234
|
-
played: "Joué",
|
|
1235
|
-
buffered: "Mis en mémoire tampon",
|
|
1236
|
-
enterFullscreen: "Plein écran",
|
|
1237
|
-
exitFullscreen: "Quitter le plein écran",
|
|
1238
|
-
enterPiP: "Image dans l'image",
|
|
1239
|
-
exitPiP: "Quitter l'image dans l'image",
|
|
1240
|
-
enableCaptions: "Activer les sous-titres",
|
|
1241
|
-
disableCaptions: "Désactiver les sous-titres",
|
|
1242
|
-
captions: "Sous-titres",
|
|
1243
|
-
captionsOff: "Désactivés",
|
|
1244
|
-
settings: "Paramètres",
|
|
1245
|
-
quality: "Qualité",
|
|
1246
|
-
auto: "Auto",
|
|
1247
|
-
speed: "Vitesse",
|
|
1248
|
-
normal: "Normal",
|
|
1249
|
-
loop: "Boucle",
|
|
1250
|
-
loopEnabled: "Boucle activée",
|
|
1251
|
-
loopDisabled: "Boucle désactivée",
|
|
1252
|
-
audioBoost: "Amplification audio",
|
|
1253
|
-
audioTrack: "Piste audio",
|
|
1254
|
-
live: "EN DIRECT",
|
|
1255
|
-
liveEdge: "En direct",
|
|
1256
|
-
seekToLive: "Aller au direct",
|
|
1257
|
-
behindLive: "{seconds}s de retard",
|
|
1258
|
-
networkError: "Erreur réseau",
|
|
1259
|
-
mediaError: "Le média n'a pas pu être chargé",
|
|
1260
|
-
unknownError: "Erreur inconnue",
|
|
1261
|
-
loading: "Chargement",
|
|
1262
|
-
buffering: "Mise en mémoire tampon",
|
|
1263
|
-
chapters: "Chapitres",
|
|
1264
|
-
airPlay: "AirPlay",
|
|
1265
|
-
googleCast: "Caster",
|
|
1266
|
-
casting: "Diffusion sur {device}",
|
|
1267
|
-
download: "Télécharger",
|
|
1268
|
-
share: "Partager",
|
|
1269
|
-
close: "Fermer",
|
|
1270
|
-
menu: "Menu",
|
|
1271
|
-
back: "Retour"
|
|
1272
|
-
};
|
|
1273
|
-
var germanStrings = {
|
|
1274
|
-
play: "Abspielen",
|
|
1275
|
-
pause: "Pause",
|
|
1276
|
-
replay: "Wiederholen",
|
|
1277
|
-
mute: "Stumm",
|
|
1278
|
-
unmute: "Ton an",
|
|
1279
|
-
volume: "Lautstärke",
|
|
1280
|
-
seekBackward: "{seconds} Sekunden zurück",
|
|
1281
|
-
seekForward: "{seconds} Sekunden vor",
|
|
1282
|
-
seekTo: "Zu {time} springen",
|
|
1283
|
-
duration: "Dauer",
|
|
1284
|
-
currentTime: "Aktuelle Zeit",
|
|
1285
|
-
played: "Abgespielt",
|
|
1286
|
-
buffered: "Gepuffert",
|
|
1287
|
-
enterFullscreen: "Vollbild",
|
|
1288
|
-
exitFullscreen: "Vollbild beenden",
|
|
1289
|
-
enterPiP: "Bild-in-Bild",
|
|
1290
|
-
exitPiP: "Bild-in-Bild beenden",
|
|
1291
|
-
enableCaptions: "Untertitel aktivieren",
|
|
1292
|
-
disableCaptions: "Untertitel deaktivieren",
|
|
1293
|
-
captions: "Untertitel",
|
|
1294
|
-
captionsOff: "Aus",
|
|
1295
|
-
settings: "Einstellungen",
|
|
1296
|
-
quality: "Qualität",
|
|
1297
|
-
auto: "Auto",
|
|
1298
|
-
speed: "Geschwindigkeit",
|
|
1299
|
-
normal: "Normal",
|
|
1300
|
-
loop: "Schleife",
|
|
1301
|
-
loopEnabled: "Schleife aktiviert",
|
|
1302
|
-
loopDisabled: "Schleife deaktiviert",
|
|
1303
|
-
audioBoost: "Audio-Verstärkung",
|
|
1304
|
-
audioTrack: "Audiospur",
|
|
1305
|
-
live: "LIVE",
|
|
1306
|
-
liveEdge: "Am Live-Punkt",
|
|
1307
|
-
seekToLive: "Zum Live-Punkt",
|
|
1308
|
-
behindLive: "{seconds}s hinter Live",
|
|
1309
|
-
networkError: "Netzwerkfehler",
|
|
1310
|
-
mediaError: "Medium konnte nicht geladen werden",
|
|
1311
|
-
unknownError: "Unbekannter Fehler",
|
|
1312
|
-
loading: "Wird geladen",
|
|
1313
|
-
buffering: "Puffern",
|
|
1314
|
-
chapters: "Kapitel",
|
|
1315
|
-
airPlay: "AirPlay",
|
|
1316
|
-
googleCast: "Streamen",
|
|
1317
|
-
casting: "Streame zu {device}",
|
|
1318
|
-
download: "Herunterladen",
|
|
1319
|
-
share: "Teilen",
|
|
1320
|
-
close: "Schließen",
|
|
1321
|
-
menu: "Menü",
|
|
1322
|
-
back: "Zurück"
|
|
1323
|
-
};
|
|
1324
|
-
var japaneseStrings = {
|
|
1325
|
-
play: "再生",
|
|
1326
|
-
pause: "一時停止",
|
|
1327
|
-
replay: "リプレイ",
|
|
1328
|
-
mute: "ミュート",
|
|
1329
|
-
unmute: "ミュート解除",
|
|
1330
|
-
volume: "音量",
|
|
1331
|
-
seekBackward: "{seconds}秒戻る",
|
|
1332
|
-
seekForward: "{seconds}秒進む",
|
|
1333
|
-
seekTo: "{time}にシーク",
|
|
1334
|
-
duration: "長さ",
|
|
1335
|
-
currentTime: "現在の時間",
|
|
1336
|
-
played: "再生済み",
|
|
1337
|
-
buffered: "バッファ済み",
|
|
1338
|
-
enterFullscreen: "フルスクリーン",
|
|
1339
|
-
exitFullscreen: "フルスクリーン終了",
|
|
1340
|
-
enterPiP: "ピクチャーインピクチャー",
|
|
1341
|
-
exitPiP: "ピクチャーインピクチャー終了",
|
|
1342
|
-
enableCaptions: "字幕を有効化",
|
|
1343
|
-
disableCaptions: "字幕を無効化",
|
|
1344
|
-
captions: "字幕",
|
|
1345
|
-
captionsOff: "オフ",
|
|
1346
|
-
settings: "設定",
|
|
1347
|
-
quality: "画質",
|
|
1348
|
-
auto: "自動",
|
|
1349
|
-
speed: "再生速度",
|
|
1350
|
-
normal: "通常",
|
|
1351
|
-
loop: "ループ",
|
|
1352
|
-
loopEnabled: "ループ有効",
|
|
1353
|
-
loopDisabled: "ループ無効",
|
|
1354
|
-
audioBoost: "オーディオブースト",
|
|
1355
|
-
audioTrack: "オーディオトラック",
|
|
1356
|
-
live: "ライブ",
|
|
1357
|
-
liveEdge: "ライブ中",
|
|
1358
|
-
seekToLive: "ライブに移動",
|
|
1359
|
-
behindLive: "{seconds}秒遅れ",
|
|
1360
|
-
networkError: "ネットワークエラー",
|
|
1361
|
-
mediaError: "メディアを読み込めません",
|
|
1362
|
-
unknownError: "不明なエラー",
|
|
1363
|
-
loading: "読み込み中",
|
|
1364
|
-
buffering: "バッファリング",
|
|
1365
|
-
chapters: "チャプター",
|
|
1366
|
-
airPlay: "AirPlay",
|
|
1367
|
-
googleCast: "キャスト",
|
|
1368
|
-
casting: "{device}にキャスト中",
|
|
1369
|
-
download: "ダウンロード",
|
|
1370
|
-
share: "共有",
|
|
1371
|
-
close: "閉じる",
|
|
1372
|
-
menu: "メニュー",
|
|
1373
|
-
back: "戻る"
|
|
1374
|
-
};
|
|
1375
|
-
var chineseStrings = {
|
|
1376
|
-
play: "播放",
|
|
1377
|
-
pause: "暂停",
|
|
1378
|
-
replay: "重播",
|
|
1379
|
-
mute: "静音",
|
|
1380
|
-
unmute: "取消静音",
|
|
1381
|
-
volume: "音量",
|
|
1382
|
-
seekBackward: "后退{seconds}秒",
|
|
1383
|
-
seekForward: "前进{seconds}秒",
|
|
1384
|
-
seekTo: "跳转到{time}",
|
|
1385
|
-
duration: "时长",
|
|
1386
|
-
currentTime: "当前时间",
|
|
1387
|
-
played: "已播放",
|
|
1388
|
-
buffered: "已缓冲",
|
|
1389
|
-
enterFullscreen: "全屏",
|
|
1390
|
-
exitFullscreen: "退出全屏",
|
|
1391
|
-
enterPiP: "画中画",
|
|
1392
|
-
exitPiP: "退出画中画",
|
|
1393
|
-
enableCaptions: "开启字幕",
|
|
1394
|
-
disableCaptions: "关闭字幕",
|
|
1395
|
-
captions: "字幕",
|
|
1396
|
-
captionsOff: "关闭",
|
|
1397
|
-
settings: "设置",
|
|
1398
|
-
quality: "画质",
|
|
1399
|
-
auto: "自动",
|
|
1400
|
-
speed: "播放速度",
|
|
1401
|
-
normal: "正常",
|
|
1402
|
-
loop: "循环",
|
|
1403
|
-
loopEnabled: "循环已开启",
|
|
1404
|
-
loopDisabled: "循环已关闭",
|
|
1405
|
-
audioBoost: "音频增强",
|
|
1406
|
-
audioTrack: "音轨",
|
|
1407
|
-
live: "直播",
|
|
1408
|
-
liveEdge: "直播中",
|
|
1409
|
-
seekToLive: "跳转到直播",
|
|
1410
|
-
behindLive: "落后{seconds}秒",
|
|
1411
|
-
networkError: "网络错误",
|
|
1412
|
-
mediaError: "无法加载媒体",
|
|
1413
|
-
unknownError: "未知错误",
|
|
1414
|
-
loading: "加载中",
|
|
1415
|
-
buffering: "缓冲中",
|
|
1416
|
-
chapters: "章节",
|
|
1417
|
-
airPlay: "AirPlay",
|
|
1418
|
-
googleCast: "投射",
|
|
1419
|
-
casting: "正在投射到{device}",
|
|
1420
|
-
download: "下载",
|
|
1421
|
-
share: "分享",
|
|
1422
|
-
close: "关闭",
|
|
1423
|
-
menu: "菜单",
|
|
1424
|
-
back: "返回"
|
|
1425
|
-
};
|
|
1426
|
-
var defaultTranslations = {
|
|
1427
|
-
en: englishStrings,
|
|
1428
|
-
es: spanishStrings,
|
|
1429
|
-
fr: frenchStrings,
|
|
1430
|
-
de: germanStrings,
|
|
1431
|
-
ja: japaneseStrings,
|
|
1432
|
-
zh: chineseStrings
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
class I18n {
|
|
1436
|
-
language;
|
|
1437
|
-
fallbackLanguage;
|
|
1438
|
-
translations;
|
|
1439
|
-
interpolationPattern;
|
|
1440
|
-
constructor(config = {}) {
|
|
1441
|
-
this.language = config.language || this.detectLanguage() || "en";
|
|
1442
|
-
this.fallbackLanguage = config.fallbackLanguage || "en";
|
|
1443
|
-
this.translations = { ...defaultTranslations };
|
|
1444
|
-
if (config.translations) {
|
|
1445
|
-
for (const [lang, strings] of Object.entries(config.translations)) {
|
|
1446
|
-
if (strings) {
|
|
1447
|
-
this.translations[lang] = { ...this.translations[lang], ...strings };
|
|
1448
|
-
}
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
this.interpolationPattern = config.interpolationPattern || /\{(\w+)\}/g;
|
|
1452
|
-
}
|
|
1453
|
-
detectLanguage() {
|
|
1454
|
-
if (typeof navigator === "undefined")
|
|
1455
|
-
return null;
|
|
1456
|
-
const lang = navigator.language || navigator.userLanguage;
|
|
1457
|
-
if (!lang)
|
|
1458
|
-
return null;
|
|
1459
|
-
if (this.translations[lang]) {
|
|
1460
|
-
return lang;
|
|
1461
|
-
}
|
|
1462
|
-
const baseLang = lang.split("-")[0];
|
|
1463
|
-
if (this.translations[baseLang]) {
|
|
1464
|
-
return baseLang;
|
|
1465
|
-
}
|
|
1466
|
-
return null;
|
|
1467
|
-
}
|
|
1468
|
-
getLanguage() {
|
|
1469
|
-
return this.language;
|
|
1470
|
-
}
|
|
1471
|
-
setLanguage(language) {
|
|
1472
|
-
this.language = language;
|
|
1473
|
-
}
|
|
1474
|
-
t(key, params) {
|
|
1475
|
-
let str = this.translations[this.language]?.[key];
|
|
1476
|
-
if (!str) {
|
|
1477
|
-
str = this.translations[this.fallbackLanguage]?.[key];
|
|
1478
|
-
}
|
|
1479
|
-
if (!str) {
|
|
1480
|
-
return key;
|
|
1481
|
-
}
|
|
1482
|
-
if (params) {
|
|
1483
|
-
str = str.replace(this.interpolationPattern, (match, paramKey) => {
|
|
1484
|
-
const value = params[paramKey];
|
|
1485
|
-
return value !== undefined ? String(value) : match;
|
|
1486
|
-
});
|
|
1487
|
-
}
|
|
1488
|
-
return str;
|
|
1489
|
-
}
|
|
1490
|
-
addTranslations(language, strings) {
|
|
1491
|
-
this.translations[language] = {
|
|
1492
|
-
...this.translations[language],
|
|
1493
|
-
...strings
|
|
1494
|
-
};
|
|
1495
|
-
}
|
|
1496
|
-
getTranslations(language) {
|
|
1497
|
-
return this.translations[language];
|
|
1498
|
-
}
|
|
1499
|
-
getAvailableLanguages() {
|
|
1500
|
-
return Object.keys(this.translations);
|
|
1501
|
-
}
|
|
1502
|
-
hasLanguage(language) {
|
|
1503
|
-
return language in this.translations;
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
var globalI18n = null;
|
|
1507
|
-
function createI18n(config) {
|
|
1508
|
-
return new I18n(config);
|
|
1509
|
-
}
|
|
1510
|
-
function getI18n(config) {
|
|
1511
|
-
if (!globalI18n) {
|
|
1512
|
-
globalI18n = createI18n(config);
|
|
1513
|
-
}
|
|
1514
|
-
return globalI18n;
|
|
1515
|
-
}
|
|
1516
|
-
function setI18n(i18n) {
|
|
1517
|
-
globalI18n = i18n;
|
|
1518
|
-
}
|
|
1519
|
-
function t(key, params) {
|
|
1520
|
-
return getI18n().t(key, params);
|
|
1521
|
-
}
|
|
1522
1131
|
// src/core/live.ts
|
|
1523
1132
|
class LiveIndicator {
|
|
1524
1133
|
container;
|
|
@@ -7932,7 +7541,7 @@ export {
|
|
|
7932
7541
|
GoogleCastButton,
|
|
7933
7542
|
HLSProvider2 as HLSProvider,
|
|
7934
7543
|
HTML5Provider2 as HTML5Provider,
|
|
7935
|
-
I18n,
|
|
7544
|
+
I18n2 as I18n,
|
|
7936
7545
|
LayoutManager,
|
|
7937
7546
|
LiveController,
|
|
7938
7547
|
LiveIndicator,
|
|
@@ -7987,7 +7596,7 @@ export {
|
|
|
7987
7596
|
captionPresets,
|
|
7988
7597
|
captions2 as captionsFeature,
|
|
7989
7598
|
castMedia,
|
|
7990
|
-
chineseStrings,
|
|
7599
|
+
chineseStrings2 as chineseStrings,
|
|
7991
7600
|
cinemaLayout,
|
|
7992
7601
|
computePosition2 as computePosition,
|
|
7993
7602
|
computed2 as computed,
|
|
@@ -8006,7 +7615,7 @@ export {
|
|
|
8006
7615
|
createErrorOverlay,
|
|
8007
7616
|
createGestureDetector2 as createGestureDetector,
|
|
8008
7617
|
createGoogleCastButton,
|
|
8009
|
-
createI18n,
|
|
7618
|
+
createI18n2 as createI18n,
|
|
8010
7619
|
createKeyboardHandler2 as createKeyboardHandler,
|
|
8011
7620
|
createLayoutManager,
|
|
8012
7621
|
createLiveController,
|
|
@@ -8035,7 +7644,7 @@ export {
|
|
|
8035
7644
|
defaultLayout,
|
|
8036
7645
|
defaultLoaders2 as defaultLoaders,
|
|
8037
7646
|
defaultTheme,
|
|
8038
|
-
defaultTranslations,
|
|
7647
|
+
defaultTranslations2 as defaultTranslations,
|
|
8039
7648
|
detectAllFeatures2 as detectAllFeatures,
|
|
8040
7649
|
detectFullscreenAvailability2 as detectFullscreenAvailability,
|
|
8041
7650
|
detectMediaType2 as detectMediaType,
|
|
@@ -8043,7 +7652,7 @@ export {
|
|
|
8043
7652
|
detectVolumeAvailability2 as detectVolumeAvailability,
|
|
8044
7653
|
endCastSession,
|
|
8045
7654
|
endScreenPlugin,
|
|
8046
|
-
englishStrings,
|
|
7655
|
+
englishStrings2 as englishStrings,
|
|
8047
7656
|
enterFullscreen2 as enterFullscreen,
|
|
8048
7657
|
enterPiP2 as enterPiP,
|
|
8049
7658
|
exitFullscreen2 as exitFullscreen,
|
|
@@ -8055,14 +7664,14 @@ export {
|
|
|
8055
7664
|
formatTime2 as formatElementTime,
|
|
8056
7665
|
formatTime4 as formatTime,
|
|
8057
7666
|
formatTimePhrase2 as formatTimePhrase,
|
|
8058
|
-
frenchStrings,
|
|
7667
|
+
frenchStrings2 as frenchStrings,
|
|
8059
7668
|
fullscreen2 as fullscreenFeature,
|
|
8060
7669
|
generateSpriteCues,
|
|
8061
7670
|
generateThemeCSS,
|
|
8062
|
-
germanStrings,
|
|
7671
|
+
germanStrings2 as germanStrings,
|
|
8063
7672
|
gestures2 as gesturesFeature,
|
|
8064
7673
|
getCastSession,
|
|
8065
|
-
getI18n,
|
|
7674
|
+
getI18n2 as getI18n,
|
|
8066
7675
|
getLayout,
|
|
8067
7676
|
getPlayer2 as getPlayer,
|
|
8068
7677
|
getPreconnectHints2 as getPreconnectHints,
|
|
@@ -8087,7 +7696,7 @@ export {
|
|
|
8087
7696
|
isVideoOnlyFullscreen2 as isVideoOnlyFullscreen,
|
|
8088
7697
|
isVimeoSource2 as isVimeoSource,
|
|
8089
7698
|
isYouTubeSource2 as isYouTubeSource,
|
|
8090
|
-
japaneseStrings,
|
|
7699
|
+
japaneseStrings2 as japaneseStrings,
|
|
8091
7700
|
keyboard2 as keyboardFeature,
|
|
8092
7701
|
layouts,
|
|
8093
7702
|
lightTheme,
|
|
@@ -8125,12 +7734,12 @@ export {
|
|
|
8125
7734
|
selectIsLoading2 as selectIsLoading,
|
|
8126
7735
|
selectProgress2 as selectProgress,
|
|
8127
7736
|
selectRemainingTime2 as selectRemainingTime,
|
|
8128
|
-
setI18n,
|
|
7737
|
+
setI18n2 as setI18n,
|
|
8129
7738
|
shallowEqual2 as shallowEqual,
|
|
8130
7739
|
showAirPlayPicker,
|
|
8131
7740
|
skipSegmentsPlugin,
|
|
8132
|
-
spanishStrings,
|
|
8133
|
-
t,
|
|
7741
|
+
spanishStrings2 as spanishStrings,
|
|
7742
|
+
t2 as t,
|
|
8134
7743
|
toISODuration2 as toISODuration,
|
|
8135
7744
|
unlockOrientation2 as unlockOrientation,
|
|
8136
7745
|
updateMetadata2 as updateMetadata,
|
package/dist/player.d.ts
CHANGED
|
@@ -23,6 +23,12 @@ export declare class Player implements IPlayer {
|
|
|
23
23
|
private _cover;
|
|
24
24
|
private _coverDismissed;
|
|
25
25
|
private _coverTimer;
|
|
26
|
+
/**
|
|
27
|
+
* A play asked for before there was a provider to ask: a tap on the cover
|
|
28
|
+
* while the source was still loading. Kept and honoured once the source has
|
|
29
|
+
* loaded, so one tap plays the video rather than one tap per loading step.
|
|
30
|
+
*/
|
|
31
|
+
private _playRequested;
|
|
26
32
|
/**
|
|
27
33
|
* Create a new player instance
|
|
28
34
|
*/
|
|
@@ -61,6 +67,12 @@ export declare class Player implements IPlayer {
|
|
|
61
67
|
setPoster(url: string): void;
|
|
62
68
|
getSrc(): Src | null;
|
|
63
69
|
private attachProviderEvents;
|
|
70
|
+
/**
|
|
71
|
+
* Play what was asked for before the source was ready. A browser that
|
|
72
|
+
* refuses sound without a tap (code 1) gets it muted instead, as autoplay
|
|
73
|
+
* is everywhere, and the mute button turns it up.
|
|
74
|
+
*/
|
|
75
|
+
private startRequestedPlay;
|
|
64
76
|
play(): Promise<void>;
|
|
65
77
|
pause(): void;
|
|
66
78
|
togglePlay(): void;
|
|
@@ -48,6 +48,10 @@ interface VimeoPlayer {
|
|
|
48
48
|
pause(): Promise<void>;
|
|
49
49
|
unload(): Promise<void>;
|
|
50
50
|
destroy(): Promise<void>;
|
|
51
|
+
loadVideo(id: number | string | {
|
|
52
|
+
id: number;
|
|
53
|
+
h?: string;
|
|
54
|
+
}): Promise<number>;
|
|
51
55
|
getCurrentTime(): Promise<number>;
|
|
52
56
|
setCurrentTime(seconds: number): Promise<number>;
|
|
53
57
|
getDuration(): Promise<number>;
|
|
@@ -118,6 +122,8 @@ export declare class VimeoProvider extends BaseProvider {
|
|
|
118
122
|
protected cleanup(): void;
|
|
119
123
|
canPlay(src: Src): boolean;
|
|
120
124
|
load(src: Src): Promise<void>;
|
|
125
|
+
/** What a loaded video tells the player: ready, its length, qualities and shape. */
|
|
126
|
+
private announceLoaded;
|
|
121
127
|
private attachVimeoEvents;
|
|
122
128
|
private updateQualities;
|
|
123
129
|
play(): Promise<void>;
|
|
@@ -96,6 +96,12 @@ export declare class YouTubeProvider extends BaseProvider {
|
|
|
96
96
|
private endTime?;
|
|
97
97
|
private timeUpdateInterval;
|
|
98
98
|
private lastState;
|
|
99
|
+
/**
|
|
100
|
+
* A play asked for before YouTube's player could take it. Its methods only
|
|
101
|
+
* exist after its ready event, and the video may still be pending then, so
|
|
102
|
+
* the play waits for both and the video loads playing.
|
|
103
|
+
*/
|
|
104
|
+
private pendingPlay;
|
|
99
105
|
get mediaElement(): HTMLIFrameElement | null;
|
|
100
106
|
protected initialize(): Promise<void>;
|
|
101
107
|
private loadYouTubeAPI;
|