fix autoplay check
This commit is contained in:
@@ -87,6 +87,7 @@
|
|||||||
function update(step) {
|
function update(step) {
|
||||||
let { currentTime, meta, isPlaying, speed } = self.get();
|
let { currentTime, meta, isPlaying, speed } = self.get();
|
||||||
if (!isPlaying) {
|
if (!isPlaying) {
|
||||||
|
self.timer = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,11 +101,12 @@
|
|||||||
if (currentTime < meta.totalTime) {
|
if (currentTime < meta.totalTime) {
|
||||||
requestAnimationFrame(update);
|
requestAnimationFrame(update);
|
||||||
} else {
|
} else {
|
||||||
|
self.timer = null;
|
||||||
self.set({ isPlaying: false, currentTime: 0 });
|
self.set({ isPlaying: false, currentTime: 0 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
requestAnimationFrame(update);
|
this.timer = requestAnimationFrame(update);
|
||||||
},
|
},
|
||||||
play() {
|
play() {
|
||||||
const { replayer, currentTime } = this.get();
|
const { replayer, currentTime } = this.get();
|
||||||
@@ -148,7 +150,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (changed.isPlaying) {
|
if (changed.isPlaying) {
|
||||||
if (current.isPlaying) {
|
if (current.isPlaying && !this.timer) {
|
||||||
this.loopTimer();
|
this.loopTimer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user