fix: handle started action
This commit is contained in:
parent
9ebd96cec1
commit
1d65481be8
@ -25,6 +25,7 @@ export const player = {
|
||||
paused: null,
|
||||
podcastUrl: null,
|
||||
volume: 1,
|
||||
started: 0,
|
||||
rate: 1,
|
||||
},
|
||||
mutations: {
|
||||
@ -33,6 +34,7 @@ export const player = {
|
||||
|
||||
if (action && action.position && action.position < action.total) {
|
||||
audio.currentTime = action.position
|
||||
state.started = audio.currentTime
|
||||
}
|
||||
},
|
||||
currentTime: (state, currentTime) => {
|
||||
@ -84,7 +86,10 @@ export const player = {
|
||||
audio.pause()
|
||||
context.dispatch('time')
|
||||
},
|
||||
play: () => audio.play(),
|
||||
play: (context) => {
|
||||
audio.play()
|
||||
context.commit('started', audio.currentTime)
|
||||
},
|
||||
seek: (context, currentTime) => {
|
||||
audio.currentTime = currentTime
|
||||
context.dispatch('time')
|
||||
@ -99,7 +104,7 @@ export const player = {
|
||||
guid: context.state.episode.guid,
|
||||
action: 'play',
|
||||
timestamp: moment().format('YYYY-MM-DD[T]HH:mm:ss'),
|
||||
started: Math.round(context.state.action ? context.state.action.started : 0),
|
||||
started: Math.round(context.state.started),
|
||||
position: Math.round(audio.currentTime),
|
||||
total: Math.round(audio.duration),
|
||||
}]),
|
||||
|
Loading…
Reference in New Issue
Block a user