danmuku
Version:
Display danmu (flying comments) on HTML5 video.
21 lines (20 loc) • 431 B
JavaScript
export default function(Danmuku) {
Object.defineProperty(Danmuku.prototype, 'speed', {
get: function() {
return this._speed;
},
set: function(s) {
if (typeof s !== 'number' ||
isNaN(s) ||
!isFinite(s) ||
s <= 0) {
return this._speed;
}
this._speed = s;
if (this.width) {
this.duration = this.width / s;
}
return s;
}
});
}