Skip to content

Commit

Permalink
feat(xgplayer): add progressDot duration
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxin92 committed Nov 13, 2019
1 parent ba55841 commit 3002144
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/xgplayer/browser/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/browser/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/xgplayer/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/xgplayer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xgplayer",
"version": "2.3.3",
"version": "2.3.4",
"description": "video player",
"main": "./dist/index.js",
"typings": "./types/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/skin/controls/memoryPlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let smemoryPlay = function () {
let player = this
let util = Player.util
let lastPlayTime = player.config.lastPlayTime || 0
let lastPlayTimeHideDelay = player.config.lastPlayTimeHideDelay || 0
let lastPlayTimeHideDelay = player.config.lastPlayTimeHideDelay || 3
let dom = null
if (lastPlayTime <= 0) {
return
Expand Down
8 changes: 7 additions & 1 deletion packages/xgplayer/src/skin/controls/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ let s_progress = function () {
if (item.time >= 0 && item.time <= player.duration) {
let dot = util.createDom('xg-progress-dot', item.text ? `<span class="xgplayer-progress-tip">${item.text}</span>` : '', {}, 'xgplayer-progress-dot')
dot.style.left = (item.time / player.duration) * 100 + '%'
if(item.duration >= 0) {
dot.style.width = (Math.min(item.duration, player.duration - item.time) / player.duration) * 100 + '%'
}
outer.appendChild(dot)
player.dotArr[item.time] = dot
dotEvent(dot, item.text)
Expand All @@ -63,13 +66,16 @@ let s_progress = function () {
}
}
player.once('canplay', onCanplay)
player.addProgressDot = function (time, text) {
player.addProgressDot = function (time, text, duration) {
if (player.dotArr[time]) {
return
}
if (time >= 0 && time <= player.duration) {
let dot = util.createDom('xg-progress-dot', '', {}, 'xgplayer-progress-dot')
dot.style.left = (time / player.duration) * 100 + '%'
if(duration >= 0) {
dot.style.width = (Math.min(duration, player.duration - time) / player.duration) * 100 + '%'
}
outer.appendChild(dot)
player.dotArr[time] = dot
dotEvent(dot, text)
Expand Down

0 comments on commit 3002144

Please sign in to comment.