mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-29 02:51:20 -08:00
fix: correct typos in player modules (#969)
This commit is contained in:
1 parent
169c6a318a
commit
078b595819
12 files changed
+39
-39
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
export default {
|
export default {
|
||||||
propertys: [
|
properties: [
|
||||||
'audioTracks',
|
'audioTracks',
|
||||||
'autoplay',
|
'autoplay',
|
||||||
'buffered',
|
'buffered',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { append } from '../utils';
|
import { append } from '../utils';
|
||||||
|
|
||||||
export default function pip(option) {
|
export default function airplay(option) {
|
||||||
return (art) => ({
|
return (art) => ({
|
||||||
...option,
|
...option,
|
||||||
tooltip: art.i18n.get('AirPlay'),
|
tooltip: art.i18n.get('AirPlay'),
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export default function progress(options) {
|
|||||||
`,
|
`,
|
||||||
mounted: ($control) => {
|
mounted: ($control) => {
|
||||||
let tipTimer = null;
|
let tipTimer = null;
|
||||||
let isDroging = false;
|
let isDragging = false;
|
||||||
|
|
||||||
const $hover = query('.art-progress-hover', $control);
|
const $hover = query('.art-progress-hover', $control);
|
||||||
const $loaded = query('.art-progress-loaded', $control);
|
const $loaded = query('.art-progress-loaded', $control);
|
||||||
@@ -95,7 +95,7 @@ export default function progress(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setBar(type, percentage, event) {
|
function setBar(type, percentage, event) {
|
||||||
const isMobileDroging = type === 'played' && event && isMobile;
|
const isMobileDragging = type === 'played' && event && isMobile;
|
||||||
|
|
||||||
if (type === 'loaded') {
|
if (type === 'loaded') {
|
||||||
setStyle($loaded, 'width', `${percentage * 100}%`);
|
setStyle($loaded, 'width', `${percentage * 100}%`);
|
||||||
@@ -110,7 +110,7 @@ export default function progress(options) {
|
|||||||
setStyle($indicator, 'left', `${percentage * 100}%`);
|
setStyle($indicator, 'left', `${percentage * 100}%`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMobileDroging) {
|
if (isMobileDragging) {
|
||||||
setStyle($tip, 'display', 'flex');
|
setStyle($tip, 'display', 'flex');
|
||||||
const width = $control.clientWidth * percentage;
|
const width = $control.clientWidth * percentage;
|
||||||
const time = secondToTime(percentage * art.duration);
|
const time = secondToTime(percentage * art.duration);
|
||||||
@@ -170,11 +170,11 @@ export default function progress(options) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
proxy($control, 'mousedown', (event) => {
|
proxy($control, 'mousedown', (event) => {
|
||||||
isDroging = event.button === 0;
|
isDragging = event.button === 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
art.on('document:mousemove', (event) => {
|
art.on('document:mousemove', (event) => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
const { second, percentage } = getPosFromEvent(art, event);
|
const { second, percentage } = getPosFromEvent(art, event);
|
||||||
art.emit('setBar', 'played', percentage, event);
|
art.emit('setBar', 'played', percentage, event);
|
||||||
art.seek = second;
|
art.seek = second;
|
||||||
@@ -182,8 +182,8 @@ export default function progress(options) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
art.on('document:mouseup', () => {
|
art.on('document:mouseup', () => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
isDroging = false;
|
isDragging = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,23 +52,23 @@ export default function volume(option) {
|
|||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
setStyle($panel, 'display', 'none');
|
setStyle($panel, 'display', 'none');
|
||||||
} else {
|
} else {
|
||||||
let isDroging = false;
|
let isDragging = false;
|
||||||
|
|
||||||
proxy($slider, 'mousedown', (event) => {
|
proxy($slider, 'mousedown', (event) => {
|
||||||
isDroging = event.button === 0;
|
isDragging = event.button === 0;
|
||||||
art.volume = getVolumeFromEvent(event);
|
art.volume = getVolumeFromEvent(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
art.on('document:mousemove', (event) => {
|
art.on('document:mousemove', (event) => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
art.muted = false;
|
art.muted = false;
|
||||||
art.volume = getVolumeFromEvent(event);
|
art.volume = getVolumeFromEvent(event);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
art.on('document:mouseup', () => {
|
art.on('document:mouseup', () => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
isDroging = false;
|
isDragging = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export default function gestureInit(art, events) {
|
|||||||
const { $video, $progress } = art.template;
|
const { $video, $progress } = art.template;
|
||||||
|
|
||||||
let touchTarget = null;
|
let touchTarget = null;
|
||||||
let isDroging = false;
|
let isDragging = false;
|
||||||
let startX = 0;
|
let startX = 0;
|
||||||
let startY = 0;
|
let startY = 0;
|
||||||
let startTime = 0;
|
let startTime = 0;
|
||||||
@@ -44,7 +44,7 @@ export default function gestureInit(art, events) {
|
|||||||
setCurrentTime(art, event);
|
setCurrentTime(art, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
isDroging = true;
|
isDragging = true;
|
||||||
const { pageX, pageY } = event.touches[0];
|
const { pageX, pageY } = event.touches[0];
|
||||||
startX = pageX;
|
startX = pageX;
|
||||||
startY = pageY;
|
startY = pageY;
|
||||||
@@ -53,7 +53,7 @@ export default function gestureInit(art, events) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onTouchMove = (event) => {
|
const onTouchMove = (event) => {
|
||||||
if (event.touches.length === 1 && isDroging && art.duration) {
|
if (event.touches.length === 1 && isDragging && art.duration) {
|
||||||
const { pageX, pageY } = event.touches[0];
|
const { pageX, pageY } = event.touches[0];
|
||||||
const direction = GetSlideDirection(startX, startY, pageX, pageY);
|
const direction = GetSlideDirection(startX, startY, pageX, pageY);
|
||||||
const isHorizontal = [3, 4].includes(direction);
|
const isHorizontal = [3, 4].includes(direction);
|
||||||
@@ -73,11 +73,11 @@ export default function gestureInit(art, events) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onTouchEnd = () => {
|
const onTouchEnd = () => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
startX = 0;
|
startX = 0;
|
||||||
startY = 0;
|
startY = 0;
|
||||||
startTime = 0;
|
startTime = 0;
|
||||||
isDroging = false;
|
isDragging = false;
|
||||||
touchTarget = null;
|
touchTarget = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { setStyle, def, getRect } from '../utils';
|
import { setStyle, def, getRect } from '../utils';
|
||||||
|
|
||||||
export default function resizeMix(art) {
|
export default function autoSizeMix(art) {
|
||||||
const { $container, $player, $video } = art.template;
|
const { $container, $player, $video } = art.template;
|
||||||
|
|
||||||
def(art, 'autoSize', {
|
def(art, 'autoSize', {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { def } from '../utils';
|
import { def } from '../utils';
|
||||||
|
|
||||||
export default function seekMix(art) {
|
export default function loadedMix(art) {
|
||||||
const { $video } = art.template;
|
const { $video } = art.template;
|
||||||
|
|
||||||
def(art, 'loaded', {
|
def(art, 'loaded', {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default function miniMix(art) {
|
|||||||
template: { $player, $video },
|
template: { $player, $video },
|
||||||
} = art;
|
} = art;
|
||||||
|
|
||||||
let isDroging = false;
|
let isDragging = false;
|
||||||
let lastPageX = 0;
|
let lastPageX = 0;
|
||||||
let lastPageY = 0;
|
let lastPageY = 0;
|
||||||
|
|
||||||
@@ -59,14 +59,14 @@ export default function miniMix(art) {
|
|||||||
art.on('video:timeupdate', () => initState($play, $pause));
|
art.on('video:timeupdate', () => initState($play, $pause));
|
||||||
|
|
||||||
proxy($mini, 'mousedown', (event) => {
|
proxy($mini, 'mousedown', (event) => {
|
||||||
isDroging = event.button === 0;
|
isDragging = event.button === 0;
|
||||||
lastPageX = event.pageX;
|
lastPageX = event.pageX;
|
||||||
lastPageY = event.pageY;
|
lastPageY = event.pageY;
|
||||||
});
|
});
|
||||||
|
|
||||||
art.on('document:mousemove', (event) => {
|
art.on('document:mousemove', (event) => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
addClass($mini, 'art-mini-droging');
|
addClass($mini, 'art-mini-dragging');
|
||||||
const x = event.pageX - lastPageX;
|
const x = event.pageX - lastPageX;
|
||||||
const y = event.pageY - lastPageY;
|
const y = event.pageY - lastPageY;
|
||||||
setStyle($mini, 'transform', `translate(${x}px, ${y}px)`);
|
setStyle($mini, 'transform', `translate(${x}px, ${y}px)`);
|
||||||
@@ -74,9 +74,9 @@ export default function miniMix(art) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
art.on('document:mouseup', () => {
|
art.on('document:mouseup', () => {
|
||||||
if (isDroging) {
|
if (isDragging) {
|
||||||
isDroging = false;
|
isDragging = false;
|
||||||
removeClass($mini, 'art-mini-droging');
|
removeClass($mini, 'art-mini-dragging');
|
||||||
const rect = getRect($mini);
|
const rect = getRect($mini);
|
||||||
storage.set('left', rect.left);
|
storage.set('left', rect.left);
|
||||||
storage.set('top', rect.top);
|
storage.set('top', rect.top);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { clamp, setStyle } from '../utils';
|
import { clamp, setStyle } from '../utils';
|
||||||
|
|
||||||
export default function attrInit(art) {
|
export default function optionInit(art) {
|
||||||
const {
|
const {
|
||||||
option,
|
option,
|
||||||
storage,
|
storage,
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ export default function thumbnailsMix(art) {
|
|||||||
const { url, scale } = option.thumbnails;
|
const { url, scale } = option.thumbnails;
|
||||||
if (!$thumbnails || !url) return;
|
if (!$thumbnails || !url) return;
|
||||||
|
|
||||||
const isMobileDroging = type === 'played' && event && isMobile;
|
const isMobileDragging = type === 'played' && event && isMobile;
|
||||||
|
|
||||||
if (type === 'hover' || isMobileDroging) {
|
if (type === 'hover' || isMobileDragging) {
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
loading = true;
|
loading = true;
|
||||||
image = await loadImg(url, scale);
|
image = await loadImg(url, scale);
|
||||||
@@ -82,7 +82,7 @@ export default function thumbnailsMix(art) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMobileDroging) {
|
if (isMobileDragging) {
|
||||||
clearTimeout(timer);
|
clearTimeout(timer);
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
setStyle($thumbnails, 'display', 'none');
|
setStyle($thumbnails, 'display', 'none');
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ export default class Setting extends Component {
|
|||||||
this.inactivate(item);
|
this.inactivate(item);
|
||||||
Object.assign(item, target);
|
Object.assign(item, target);
|
||||||
this.format();
|
this.format();
|
||||||
this.creatItem(item, true);
|
this.createItem(item, true);
|
||||||
this.render();
|
this.render();
|
||||||
return item;
|
return item;
|
||||||
} else {
|
} else {
|
||||||
@@ -223,12 +223,12 @@ export default class Setting extends Component {
|
|||||||
add(item, option = this.option) {
|
add(item, option = this.option) {
|
||||||
option.push(item);
|
option.push(item);
|
||||||
this.format();
|
this.format();
|
||||||
this.creatItem(item);
|
this.createItem(item);
|
||||||
this.render();
|
this.render();
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
creatHeader(item) {
|
createHeader(item) {
|
||||||
if (!this.cache.has(item.$option)) return;
|
if (!this.cache.has(item.$option)) return;
|
||||||
const $panel = this.cache.get(item.$option);
|
const $panel = this.cache.get(item.$option);
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ export default class Setting extends Component {
|
|||||||
append($panel, $item);
|
append($panel, $item);
|
||||||
}
|
}
|
||||||
|
|
||||||
creatItem(item, isUpdate = false) {
|
createItem(item, isUpdate = false) {
|
||||||
if (!this.cache.has(item.$option)) return;
|
if (!this.cache.has(item.$option)) return;
|
||||||
const $panel = this.cache.get(item.$option);
|
const $panel = this.cache.get(item.$option);
|
||||||
const oldItem = item.$item;
|
const oldItem = item.$item;
|
||||||
@@ -531,11 +531,11 @@ export default class Setting extends Component {
|
|||||||
inverseClass($panel, 'art-current');
|
inverseClass($panel, 'art-current');
|
||||||
|
|
||||||
if (option[0]?.$parent) {
|
if (option[0]?.$parent) {
|
||||||
this.creatHeader(option[0]);
|
this.createHeader(option[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let index = 0; index < option.length; index++) {
|
for (let index = 0; index < option.length; index++) {
|
||||||
this.creatItem(option[index]);
|
this.createItem(option[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.resize();
|
this.resize();
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.art-mini-droging {
|
&.art-mini-dragging {
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user