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