gfsd
This commit is contained in:
@@ -195,6 +195,7 @@ class Danmaku {
|
||||
const mapped = comments
|
||||
.filter(c => !c.is_deleted && c.content)
|
||||
.map(c => ({
|
||||
id: c.id || null,
|
||||
text: this._prepareText(c.content),
|
||||
username: c.display_name || c.username || '?',
|
||||
color: c.username_color || null,
|
||||
@@ -288,6 +289,7 @@ class Danmaku {
|
||||
*/
|
||||
addItem(comment) {
|
||||
if (!comment || !comment.content) return;
|
||||
if (comment.id && this.items && this.items.some(i => i.id === comment.id)) return;
|
||||
|
||||
const duration = this.media.duration;
|
||||
const hasDuration = isFinite(duration) && duration > 0;
|
||||
@@ -307,6 +309,7 @@ class Danmaku {
|
||||
}
|
||||
|
||||
const item = {
|
||||
id: comment.id || null,
|
||||
video_time: t,
|
||||
text: this._prepareText(comment.content),
|
||||
username: comment.display_name || comment.username || '?',
|
||||
@@ -314,6 +317,13 @@ class Danmaku {
|
||||
fired: true // mark as already fired — caller handles any immediate one-shot
|
||||
};
|
||||
|
||||
if (this._synthClock && this._flashPool) {
|
||||
if (!this._flashPool.some(i => (comment.id && i.id === comment.id) || (i.text === item.text && i.username === item.username))) {
|
||||
this._flashPool.push(item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert in sorted order
|
||||
const idx = this.items.findIndex(i => i.video_time > t);
|
||||
if (idx === -1) this.items.push(item);
|
||||
|
||||
Reference in New Issue
Block a user