Skip to content

Commit

Permalink
fix(xgplayer): add return and catch for play method; fix volume overf…
Browse files Browse the repository at this point in the history
…low style
  • Loading branch information
zhangxin92 committed Nov 4, 2019
1 parent d864e83 commit 442c030
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 25 deletions.
8 changes: 4 additions & 4 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.

8 changes: 4 additions & 4 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.2.0",
"version": "2.2.1",
"description": "video player",
"main": "./dist/index.js",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/controls/localPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let localPreview = function () {
player.start()
} else {
player.src = url
player.play()
player.play().catch(err => {})
}
}
player.on('upload', onUpload)
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/controls/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let mobile = function () {
return false
} else if (!player.ended) {
if (player.paused) {
player.play()
player.play().catch(err => {})
} else {
player.pause()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/controls/pc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let pc = function () {
return false
} else if (!player.ended) {
if (player.paused) {
player.play()
player.play().catch(err => {})
} else {
player.pause()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/controls/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let play = function () {
return
}
if (player.paused) {
player.play()
player.play().catch(err => {})
} else {
player.pause()
}
Expand Down
4 changes: 2 additions & 2 deletions packages/xgplayer/src/controls/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ let start = function () {
if (!root.querySelector('video')) {
player.start()
}
player.play()
player.play().catch(err => {})
} else {
if (player.paused) {
util.removeClass(root, 'xgplayer-nostart xgplayer-isloading')
setTimeout(() => {
player.play()
player.play().catch(err => {})
}, 10)
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/xgplayer/src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class Player extends Proxy {
reload () {
this.video.load()
this.reloadFunc = function () {
this.play()
this.play().catch(err => {})
}
this.once('loadeddata', this.reloadFunc)
}
Expand Down Expand Up @@ -338,7 +338,7 @@ class Player extends Proxy {
_replay()
} else {
this.currentTime = 0
this.play()
this.play().catch(err => {})
}
}

Expand Down Expand Up @@ -688,7 +688,7 @@ class Player extends Proxy {
}
} else if (e && e.keyCode === 32) { // 按 spacebar
if (player.paused) {
player.play()
player.play().catch(err => {})
} else {
player.pause()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class Proxy {
}
}
play () {
this.video.play()
return this.video.play()
}
pause () {
this.video.pause()
Expand Down
2 changes: 1 addition & 1 deletion packages/xgplayer/src/skin/assets/volumeLarge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/xgplayer/src/skin/assets/volumeMuted.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/xgplayer/src/skin/assets/volumeSmall.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/xgplayer/src/skin/controls/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let s_definition = function () {
function onCanplayChangeDefinition () {
player.currentTime = player.curTime
if (!paused) {
player.play()
player.play().catch(err => {})
}
};
['touchend', 'click'].forEach(item => {
Expand Down
1 change: 1 addition & 0 deletions packages/xgplayer/src/skin/style/controls/volume.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
display: block;
position: relative;
margin-top: -100px;
overflow: hidden;
z-index: 18;
.xgplayer-icon {
margin-top: 8px;
Expand Down

0 comments on commit 442c030

Please sign in to comment.