This commit is contained in:
Harvey Zack committed 2018-11-28 18:26:42 +08:00
1 parent bdb050f0a7
commit 970e7e3b89
20 files changed
+23 -9

No files matched your search

@@ -10,6 +10,7 @@ export default function fullscreen(controlOption) {
i18n,
player,
} = art;
const $fullscreen = append($control, icons.fullscreen);
tooltip($fullscreen, i18n.get('Fullscreen'));
@@ -10,6 +10,7 @@ export default function fullscreenWeb(controlOption) {
i18n,
player,
} = art;
const $fullscreenWeb = append($control, icons.fullscreenWeb);
tooltip($fullscreenWeb, i18n.get('Web fullscreen'));
@@ -10,6 +10,7 @@ export default function playAndPause(controlOption) {
player,
i18n,
} = art;
const $play = append($control, icons.play);
const $pause = append($control, icons.pause);
tooltip($play, i18n.get('Play'));
@@ -5,6 +5,7 @@ export function getPosFromEvent(art, event) {
template: { $progress },
player,
} = art;
const { left } = $progress.getBoundingClientRect();
const width = clamp(event.x - left, 0, $progress.clientWidth);
const second = (width / $progress.clientWidth) * player.duration;
@@ -9,6 +9,7 @@ export default function quality(controlOption) {
events: { proxy },
player,
} = art;
let playIndex = -1;
const defaultQuality = option.quality.find(item => item.default) || option.quality[0];
playIndex = option.quality.indexOf(defaultQuality);
@@ -10,6 +10,7 @@ export default function screenshot(controlOption) {
i18n,
player,
} = art;
const $screenshot = append($control, icons.screenshot);
tooltip($screenshot, i18n.get('Screenshot'));
proxy($screenshot, 'click', () => {
@@ -10,6 +10,7 @@ export default function setting(controlOption) {
i18n,
setting,
} = art;
const $setting = append($control, icons.setting);
tooltip($setting, i18n.get('Show setting'));
@@ -10,6 +10,7 @@ export default function subtitle(controlOption) {
i18n,
subtitle,
} = art;
const $subtitle = append($control, icons.subtitle);
tooltip($subtitle, i18n.get('Hide subtitle'));
@@ -9,6 +9,7 @@ export default function thumbnails(controlOption) {
template: { $progress },
events: { proxy, loadImg },
} = art;
let loading = false;
let isLoad = false;
@@ -10,6 +10,7 @@ export default function volume(controlOption) {
player,
i18n,
} = art;
let isDroging = false;
const $volume = append($control, icons.volume);
const $volumeClose = append($control, icons.volumeClose);
@@ -3,7 +3,7 @@ import { debounce } from '../utils';
export default function mousemoveInitInit(art, events) {
const {
template: { $player, $video },
player
player,
} = art;
const autoHide = debounce(() => {
@@ -5,6 +5,7 @@ export default function resizeInit(art, events) {
option,
template: { $player },
} = art;
const resizeObserver = new ResizeObserver(() => {
if (option.autoSize) {
if (!art.player.fullscreenState && !art.player.fullscreenWebState && !art.player.pipState) {
+1
View File
@@ -8,6 +8,7 @@ export default class Loading {
option,
template: { $loading },
} = art;
append($loading, option.icons.loading || icons.loading);
}
+1
View File
@@ -8,6 +8,7 @@ export default class Mask {
option,
template: { $mask },
} = art;
const $playBig = append($mask, '<div class="art-playBig"></div>');
append($playBig, option.icons.playBig || icons.playBig);
}
@@ -5,6 +5,7 @@ export default function attrInit(art, player) {
option,
template: { $video },
} = art;
Object.keys(option.moreVideoAttr).forEach(key => {
$video[key] = option.moreVideoAttr[key];
});
@@ -9,6 +9,7 @@ export default function eventInit(art, player) {
i18n,
notice,
} = art;
let firstCanplay = false;
let reconnectTime = 0;
const maxReconnectTime = 5;
+2 -4
View File
@@ -1,8 +1,6 @@
export default function seekMix(art, player) {
const { $video } = art.template;
Object.defineProperty(player, 'loaded', {
get: () =>
art.template.$video.buffered.length
? art.template.$video.buffered.end(art.template.$video.buffered.length - 1) / art.template.$video.duration
: 0,
get: () => ($video.buffered.length ? $video.buffered.end($video.buffered.length - 1) / $video.duration : 0),
});
}
+2 -1
View File
@@ -17,6 +17,7 @@ export default class Subtitle {
option: { subtitle },
template: { $video, $subtitle },
} = this.art;
setStyles($subtitle, subtitle.style || {});
const $track = document.createElement('track');
$track.default = true;
@@ -65,7 +66,6 @@ export default class Subtitle {
.catch(err => {
notice.show(err);
console.warn(err);
throw err;
});
}
@@ -87,6 +87,7 @@ export default class Subtitle {
i18n,
notice,
} = this.art;
setStyle($subtitle, 'display', 'none');
this.state = false;
notice.show(i18n.get('Hide subtitle'));