mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
add i18n
This commit is contained in:
1 parent
1b3b2de8d4
commit
0c6a297ee7
12 files changed
+374
-308
No files matched your search
+18
-3
@@ -1,3 +1,4 @@
|
||||
import { secondToTime, clamp } from '../utils';
|
||||
import validControl from '../verification/control';
|
||||
import Danmu from './danmu';
|
||||
import Fullscreen from './fullscreen';
|
||||
@@ -8,6 +9,7 @@ import Subtitle from './subtitle';
|
||||
import Time from './time';
|
||||
import Volume from './volume';
|
||||
import Setting from './setting';
|
||||
import Thumbnails from './thumbnails';
|
||||
|
||||
let id = 0;
|
||||
export default class Controls {
|
||||
@@ -30,6 +32,13 @@ export default class Controls {
|
||||
index: 10
|
||||
});
|
||||
|
||||
this.add({
|
||||
control: Thumbnails,
|
||||
disable: !this.art.option.thumbnails.url,
|
||||
position: 'top',
|
||||
index: 20
|
||||
});
|
||||
|
||||
this.add({
|
||||
control: PlayAndPause,
|
||||
disable: false,
|
||||
@@ -155,9 +164,15 @@ export default class Controls {
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(option.control.prototype, 'addMenu', {
|
||||
value: menus => {
|
||||
console.log(menus);
|
||||
Object.defineProperty(option.control.prototype, 'getPosFromEvent', {
|
||||
value: event => {
|
||||
const { $video, $progress } = this.art.refs;
|
||||
const { left } = $progress.getBoundingClientRect();
|
||||
const width = clamp(event.x - left, 0, $progress.clientWidth);
|
||||
const second = width / $progress.clientWidth * $video.duration;
|
||||
const time = secondToTime(second);
|
||||
const percentage = clamp(width / $progress.clientWidth, 0, 1);
|
||||
return { second, time, width, percentage };
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user