audio player: handle audio option update; cosmetic changes
This commit is contained in:
parent
a4849859d6
commit
c7e59c1f5a
1 changed files with 14 additions and 5 deletions
|
@ -22,6 +22,15 @@ Ox.AudioPlayer = function(options, self) {
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.update({
|
.update({
|
||||||
|
audio: function() {
|
||||||
|
self.options.position = -1;
|
||||||
|
self.options.track = -1;
|
||||||
|
that.options({
|
||||||
|
paused: true,
|
||||||
|
position: 0,
|
||||||
|
track: 0
|
||||||
|
});
|
||||||
|
},
|
||||||
muted: function() {
|
muted: function() {
|
||||||
self.options.muted = !self.options.muted;
|
self.options.muted = !self.options.muted;
|
||||||
toggleMuted();
|
toggleMuted();
|
||||||
|
@ -250,14 +259,14 @@ Ox.AudioPlayer = function(options, self) {
|
||||||
|
|
||||||
function playing() {
|
function playing() {
|
||||||
self.options.position = self.$audio.currentTime();
|
self.options.position = self.$audio.currentTime();
|
||||||
setPosition(self.options.position, 'video')
|
setPosition(self.options.position, 'audio')
|
||||||
that.triggerEvent('playing', {position: self.options.position});
|
that.triggerEvent('playing', {position: self.options.position});
|
||||||
}
|
}
|
||||||
|
|
||||||
function playNext() {
|
function playNext() {
|
||||||
var track = getNextTrack();
|
var track = getNextTrack();
|
||||||
if (track === null) {
|
if (track === null) {
|
||||||
|
// ...
|
||||||
} else {
|
} else {
|
||||||
setTrack(track);
|
setTrack(track);
|
||||||
}
|
}
|
||||||
|
@ -265,7 +274,7 @@ Ox.AudioPlayer = function(options, self) {
|
||||||
|
|
||||||
function setPosition(position, from) {
|
function setPosition(position, from) {
|
||||||
self.options.position = position;
|
self.options.position = position;
|
||||||
if (from != 'video') {
|
if (from != 'audio') {
|
||||||
self.$audio.currentTime(position);
|
self.$audio.currentTime(position);
|
||||||
}
|
}
|
||||||
self.$positionSlider.options({
|
self.$positionSlider.options({
|
||||||
|
@ -303,8 +312,8 @@ Ox.AudioPlayer = function(options, self) {
|
||||||
self.options.track = track;
|
self.options.track = track;
|
||||||
self.$trackLabel.options({
|
self.$trackLabel.options({
|
||||||
title: [
|
title: [
|
||||||
data.title, data.artist, data.album, data.year
|
data.name, data.artist, data.album, data.year
|
||||||
].join(' — ')
|
].join(' · ')
|
||||||
});
|
});
|
||||||
self.$audio.options({src: self.options.audio[self.options.track].file});
|
self.$audio.options({src: self.options.audio[self.options.track].file});
|
||||||
!self.options.paused && self.$audio.play();
|
!self.options.paused && self.$audio.play();
|
||||||
|
|
Loading…
Reference in a new issue