add Artplayer.LOG_VERSION

This commit is contained in:
Harvey Zack committed 2023-08-22 20:51:39 +08:00
1 parent 3179d1241e
commit 894a9db1d7
34 files changed
+182 -136

No files matched your search

@@ -11,7 +11,7 @@ export default function autoOrientation(art) {
const { videoWidth, videoHeight } = $video;
const { clientWidth: viewWidth, clientHeight: viewHeight } = document.documentElement;
if (
(videoWidth > videoHeight && viewWidth < viewHeight) ||
(videoWidth > videoHeight && viewWidth < viewHeight) ??
(videoWidth < videoHeight && viewWidth > viewHeight)
) {
// There is a conflict with the fullscreen event, and it is changed to asynchronous execution
@@ -40,7 +40,7 @@ export default function autoOrientation(art) {
const { videoWidth, videoHeight } = $video;
const { clientWidth: viewWidth, clientHeight: viewHeight } = document.documentElement;
if (
(videoWidth > videoHeight && viewWidth < viewHeight) ||
(videoWidth > videoHeight && viewWidth < viewHeight) ??
(videoWidth < videoHeight && viewWidth > viewHeight)
) {
const oppositeOrientation = lastOrientation.startsWith('portrait') ? 'landscape' : 'portrait';
@@ -25,19 +25,19 @@ export default function autoPlayback(art) {
art.on('video:timeupdate', () => {
if (art.playing) {
const times = storage.get('times') || {};
const times = storage.get('times') ?? {};
const keys = Object.keys(times);
if (keys.length > constructor.AUTO_PLAYBACK_MAX) {
delete times[keys[0]];
}
times[art.option.id || art.option.url] = art.currentTime;
times[art.option.id ?? art.option.url] = art.currentTime;
storage.set('times', times);
}
});
art.on('ready', () => {
const times = storage.get('times') || {};
const currentTime = times[art.option.id || art.option.url];
const times = storage.get('times') ?? {};
const currentTime = times[art.option.id ?? art.option.url];
if (currentTime && currentTime >= constructor.AUTO_PLAYBACK_MIN) {
append($close, icons.close);
setStyle($autoPlayback, 'display', 'flex');
@@ -67,13 +67,13 @@ export default function autoPlayback(art) {
return {
name: 'auto-playback',
get times() {
return storage.get('times') || {};
return storage.get('times') ?? {};
},
clear() {
return storage.del('times');
},
delete(id) {
const times = storage.get('times') || {};
const times = storage.get('times') ?? {};
delete times[id];
storage.set('times', times);
return times;
+1 -1
View File
@@ -40,7 +40,7 @@ export default class Plugins {
add(plugin) {
this.id += 1;
const result = plugin.call(this.art, this.art);
const pluginName = (result && result.name) || plugin.name || `plugin${this.id}`;
const pluginName = (result && result.name) ?? plugin.name ?? `plugin${this.id}`;
errorHandle(!has(this, pluginName), `Cannot add a plugin that already has the same name: ${pluginName}`);
def(this, pluginName, {
value: result,