Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     _drawPlaytime: function (cx, cy) {
  2.       if(this.audio != null){
  3.         var currentTime = this.audio.currentTime || 0
  4.         var duration    = this.audio.duration || 1
  5.         const m = Math.floor(currentTime / 60)
  6.         const sec = Math.floor(currentTime) % 60
  7.         const s = sec < 10 ? `0${sec}` : `${sec}`
  8.         const text = `${m}:${s}`
  9.         const tsizew = Math.ceil(this.ctx.measureText(text).width)
  10.         this.ctx.font = this.playtimeFont
  11.         this.ctx.fillStyle = this.playtimeColor
  12.         this.ctx.fillText(text, cx - Math.round(tsizew / 2), cy + 0.25 * parseInt(this.playtimeFont))
  13.       }
  14.  
  15.     },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement