mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
add autoPlayback
This commit is contained in:
1 parent
07edda2e22
commit
59d19b67c7
4 files changed
+53
-1
No files matched your search
@@ -0,0 +1,22 @@
|
||||
export default function autoPlayback(art) {
|
||||
const { storage } = art;
|
||||
|
||||
art.on('video:timeupdate', () => {
|
||||
const times = storage.get('times') || {};
|
||||
times[art.option.url] = art.currentTime;
|
||||
storage.set('times', times);
|
||||
});
|
||||
|
||||
art.on('ready', () => {
|
||||
const times = storage.get('times') || {};
|
||||
const currentTime = times[art.option.url];
|
||||
if (currentTime) {
|
||||
art.seek = currentTime;
|
||||
art.notice.show = '';
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
name: 'autoPlayback',
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { errorHandle, isMobile, has, def } from '../utils';
|
||||
import miniProgressBar from './miniProgressBar';
|
||||
import lock from './lock';
|
||||
import autoPlayback from './autoPlayback';
|
||||
|
||||
export default class Plugins {
|
||||
constructor(art) {
|
||||
@@ -17,6 +18,10 @@ export default class Plugins {
|
||||
this.add(lock);
|
||||
}
|
||||
|
||||
if (option.autoPlayback) {
|
||||
this.add(autoPlayback);
|
||||
}
|
||||
|
||||
for (let index = 0; index < option.plugins.length; index++) {
|
||||
this.add(option.plugins[index]);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user