mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
add autoPlayback clear function
This commit is contained in:
1 parent
e490c65f99
commit
c134be8c75
3 files changed
+28
-7
No files matched your search
@@ -1,7 +1,11 @@
|
||||
import { secondToTime } from '../utils';
|
||||
import { secondToTime, setStyle } from '../utils';
|
||||
|
||||
export default function autoPlayback(art) {
|
||||
const { storage, i18n } = art;
|
||||
const {
|
||||
i18n,
|
||||
storage,
|
||||
template: { $poster },
|
||||
} = art;
|
||||
|
||||
art.on('video:timeupdate', () => {
|
||||
const times = storage.get('times') || {};
|
||||
@@ -16,11 +20,18 @@ export default function autoPlayback(art) {
|
||||
const currentTime = times[art.option.url];
|
||||
if (currentTime) {
|
||||
art.seek = currentTime;
|
||||
setStyle($poster, 'display', 'none');
|
||||
art.notice.show = `${i18n.get('Auto playback at')} ${secondToTime(currentTime)}`;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
name: 'autoPlayback',
|
||||
get times() {
|
||||
return storage.get('times') || {};
|
||||
},
|
||||
clear() {
|
||||
return storage.del('times');
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user