Skip to content

Commit

Permalink
Change playing status indicator to "paused"
Browse files Browse the repository at this point in the history
  • Loading branch information
ClassicOldSong committed Jun 4, 2016
1 parent 52a5f22 commit 00b2281
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var bplayer = new bPlayer();
+ `bplayer.play() // 播放`
+ `bplayer.pause() // 暂停`
+ `bplayer.init() // 使绑定的元素成为bPlayer`
+ `bplayer.playing() // 获取播放状态`
+ `bplayer.paused() // 获取播放状态`

##### JSON传入法
~~~ javascript
Expand Down Expand Up @@ -122,7 +122,7 @@ var bplayer = new bPlayer({
+ `element.muted`
+ `element.autoplay`
+ `element.loop`
+ `element.playing`
+ `element.paused`

## TBD

Expand Down
17 changes: 7 additions & 10 deletions bplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
var status = {
volumedown: false,
progressdown: false,
playing: false,
slim: false,
cover: ''
};
Expand Down Expand Up @@ -198,7 +197,6 @@
songAudio.pause();
playBtn.classList.remove('hidden_bplayer');
pauseBtn.classList.add('hidden_bplayer');
status.playing = false;
return _this;
};
this.init = function() {
Expand All @@ -214,8 +212,8 @@
}
return _this;
};
this.playing = function() {
return status.playing;
this.paused = function() {
return songAudio.paused;
};

Object.defineProperties(bpElement, {
Expand Down Expand Up @@ -299,9 +297,9 @@
_this.autoplay(autoplay);
}
},
playing: {
paused: {
get: function() {
return status.playing;
return songAudio.paused;
}
}
});
Expand Down Expand Up @@ -390,10 +388,10 @@
_this.muted(!_this.muted());
});
playCtl.addEventListener('click', function() {
if (status.playing) {
_this.pause();
} else {
if (songAudio.paused) {
_this.play();
} else {
_this.pause();
}
});
loopBtn.addEventListener('click', function() {
Expand Down Expand Up @@ -421,7 +419,6 @@
playBtn.classList.add('hidden_bplayer');
pauseBtn.classList.remove('hidden_bplayer');
total.textContent = formatTime(this.duration);
status.playing = true;
});
songAudio.addEventListener('ended', function() {
if (!_this.loop()) {
Expand Down
5 changes: 1 addition & 4 deletions dist/bplayer.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 00b2281

Please sign in to comment.