Skip to content

Commit 7a8e293

Browse files
committed
1.1.4
1 parent b43ad2e commit 7a8e293

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

dist/danmaku.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ function createCommentCanvas(cmt) {
229229
ctx[key] = cmt.canvasStyle[key];
230230
}
231231
}
232-
ctx.textBaseline = 'hanging';
232+
ctx.textBaseline = 'top';
233233
if (cmt.canvasStyle && cmt.canvasStyle.strokeStyle) {
234234
ctx.strokeText(cmt.text, 0, 0);
235235
}
@@ -299,13 +299,13 @@ function play() {
299299
if (!this.visible || !this.paused) {
300300
return this;
301301
}
302+
this.paused = false;
302303
var that = this;
303304
var engine = this._useCanvas ? canvasEngine : domEngine;
304305
function frame() {
305306
engine.call(that);
306307
that._requestID = raf(frame);
307308
}
308-
this.paused = false;
309309
this._requestID = raf(frame);
310310
return this;
311311
}
@@ -448,6 +448,10 @@ function initMixin(Danmaku) {
448448

449449
function emitMixin(Danmaku) {
450450
Danmaku.prototype.emit = function(cmt) {
451+
if (!cmt || Object.prototype.toString.call(cmt) !== '[object Object]') {
452+
return this;
453+
}
454+
cmt.text = (cmt.text || '').toString();
451455
cmt.mode = formatMode(cmt.mode);
452456
cmt._utc = Date.now() / 1000;
453457
if (this._hasMedia) {
@@ -469,6 +473,9 @@ function showMixin(Danmaku) {
469473
return this;
470474
}
471475
this.visible = true;
476+
if (this._hasMedia && this.media.paused) {
477+
return this;
478+
}
472479
seek.call(this);
473480
play.call(this);
474481
return this;
@@ -516,7 +523,10 @@ function speedMixin(Danmaku) {
516523
return this._speed;
517524
},
518525
set: function(s) {
519-
if (s <= 0) {
526+
if (typeof s !== 'number' ||
527+
isNaN(s) ||
528+
!isFinite(s) ||
529+
s <= 0) {
520530
return this._speed;
521531
}
522532
this._speed = s;

dist/danmaku.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "danmaku",
3-
"version": "1.1.3",
3+
"version": "1.1.4",
44
"description": "Display danmaku (flying comments) on HTML5 video.",
55
"main": "./dist/danmaku.js",
66
"scripts": {

0 commit comments

Comments
 (0)