Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
interfect
funkwhale
Commits
6b8dc1b5
Commit
6b8dc1b5
authored
Mar 31, 2018
by
Bat
Browse files
Reset player position before playing previous track
parent
876aee19
Changes
4
Hide whitespace changes
Inline
Side-by-side
front/src/components/audio/Player.vue
View file @
6b8dc1b5
...
...
@@ -58,9 +58,8 @@
<div
class=
"two wide column controls ui grid"
>
<div
title=
"Previous track"
class=
"two wide column control"
:disabled=
"!hasPrevious"
>
<i
@
click=
"previous"
:class=
"['ui',
{'disabled': !hasPrevious}, 'step', 'backward', 'big', 'icon']" >
</i>
class=
"two wide column control"
>
<i
@
click=
"previous"
class=
"ui step backward big icon"
></i>
</div>
<div
v-if=
"!playing"
...
...
@@ -205,7 +204,6 @@ export default {
...
mapGetters
({
currentTrack
:
'
queue/currentTrack
'
,
hasNext
:
'
queue/hasNext
'
,
hasPrevious
:
'
queue/hasPrevious
'
,
durationFormatted
:
'
player/durationFormatted
'
,
currentTimeFormatted
:
'
player/currentTimeFormatted
'
,
progress
:
'
player/progress
'
...
...
front/src/components/audio/Track.vue
View file @
6b8dc1b5
...
...
@@ -31,7 +31,8 @@ export default {
},
data
()
{
return
{
sourceErrors
:
0
sourceErrors
:
0
,
isUpdatingTime
:
false
}
},
computed
:
{
...
...
@@ -99,6 +100,7 @@ export default {
}
},
updateProgress
:
_
.
throttle
(
function
()
{
this
.
isUpdatingTime
=
true
if
(
this
.
$refs
.
audio
)
{
this
.
$store
.
dispatch
(
'
player/updateProgress
'
,
this
.
$refs
.
audio
.
currentTime
)
}
...
...
@@ -130,6 +132,12 @@ export default {
},
volume
:
function
(
newValue
)
{
this
.
$refs
.
audio
.
volume
=
newValue
},
currentTime
(
newValue
)
{
if
(
!
this
.
isUpdatingTime
)
{
this
.
setCurrentTime
(
newValue
)
}
this
.
isUpdatingTime
=
false
}
}
}
...
...
front/src/store/queue.js
View file @
6b8dc1b5
...
...
@@ -48,9 +48,6 @@ export default {
},
hasNext
:
state
=>
{
return
state
.
currentIndex
<
state
.
tracks
.
length
-
1
},
hasPrevious
:
state
=>
{
return
state
.
currentIndex
>
0
}
},
actions
:
{
...
...
@@ -103,9 +100,11 @@ export default {
dispatch
(
'
next
'
)
}
},
previous
({
state
,
dispatch
})
{
if
(
state
.
currentIndex
>
0
)
{
previous
({
state
,
dispatch
,
rootState
})
{
if
(
state
.
currentIndex
>
0
&&
rootState
.
player
.
currentTime
<
3
)
{
dispatch
(
'
currentIndex
'
,
state
.
currentIndex
-
1
)
}
else
{
dispatch
(
'
currentIndex
'
,
state
.
currentIndex
)
}
},
next
({
state
,
dispatch
,
commit
,
rootState
})
{
...
...
front/test/unit/specs/store/queue.spec.js
View file @
6b8dc1b5
...
...
@@ -81,14 +81,6 @@ describe('store/queue', () => {
const
state
=
{
tracks
:
[
1
,
2
,
3
],
currentIndex
:
2
}
expect
(
store
.
getters
[
'
hasNext
'
](
state
)).
to
.
equal
(
false
)
})
it
(
'
hasPrevious true
'
,
()
=>
{
const
state
=
{
currentIndex
:
1
}
expect
(
store
.
getters
[
'
hasPrevious
'
](
state
)).
to
.
equal
(
true
)
})
it
(
'
hasPrevious false
'
,
()
=>
{
const
state
=
{
currentIndex
:
0
}
expect
(
store
.
getters
[
'
hasPrevious
'
](
state
)).
to
.
equal
(
false
)
})
})
describe
(
'
actions
'
,
()
=>
{
it
(
'
append at end
'
,
(
done
)
=>
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment