New API: play(time)

This commit is contained in:
DIYgod
2016-07-15 10:33:20 +08:00
parent 4ce9de0bd6
commit 1bc11bd62e
5 changed files with 15 additions and 11 deletions
+6 -4
View File
@@ -421,8 +421,7 @@ class DPlayer {
let item = this.dan[this.danIndex];
while (item && this.audio.currentTime >= parseFloat(item.time)) {
this.danmakuIn(item.text, item.color, item.type);
this.danIndex++;
item = this.dan[this.danIndex];
item = this.dan[++this.danIndex];
}
}, 0);
}
@@ -843,12 +842,12 @@ class DPlayer {
item.classList.add(`dplayer-danmaku-${type}`);
item.innerHTML = text;
item.style.opacity = this.danOpacity;
item.style.color = color;
// insert
danContainer.appendChild(item);
// adjust
item.style.color = color;
switch (type) {
case 'right':
item.style.top = itemHeight * getTunnel(item, type) + 'px';
@@ -1176,7 +1175,10 @@ class DPlayer {
/**
* Play music
*/
play() {
play(time) {
if (Object.prototype.toString.call(time) === '[object Number]') {
this.audio.currentTime = time;
}
if (this.audio.paused) {
this.shouldpause = false;