Fix #86: skip to next track properly on 40X errors
This commit is contained in:
parent
9b0d5541e0
commit
dac8d6e05e
|
@ -0,0 +1 @@
|
||||||
|
skip to next track properly on 40X errors (#86)
|
|
@ -7,7 +7,11 @@
|
||||||
@timeupdate="updateProgress"
|
@timeupdate="updateProgress"
|
||||||
@ended="ended"
|
@ended="ended"
|
||||||
preload>
|
preload>
|
||||||
<source v-for="src in srcs" :src="src.url" :type="src.type">
|
<source
|
||||||
|
@error="sourceErrored"
|
||||||
|
v-for="src in srcs"
|
||||||
|
src="src.url"
|
||||||
|
:type="src.type">
|
||||||
</audio>
|
</audio>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -25,6 +29,11 @@ export default {
|
||||||
startTime: {type: Number, default: 0},
|
startTime: {type: Number, default: 0},
|
||||||
autoplay: {type: Boolean, default: false}
|
autoplay: {type: Boolean, default: false}
|
||||||
},
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
sourceErrors: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
playing: state => state.player.playing,
|
playing: state => state.player.playing,
|
||||||
|
@ -65,6 +74,13 @@ export default {
|
||||||
errored: function () {
|
errored: function () {
|
||||||
this.$store.dispatch('player/trackErrored')
|
this.$store.dispatch('player/trackErrored')
|
||||||
},
|
},
|
||||||
|
sourceErrored: function () {
|
||||||
|
this.sourceErrors += 1
|
||||||
|
if (this.sourceErrors >= this.srcs.length) {
|
||||||
|
// all sources failed
|
||||||
|
this.errored()
|
||||||
|
}
|
||||||
|
},
|
||||||
updateDuration: function (e) {
|
updateDuration: function (e) {
|
||||||
this.$store.commit('player/duration', this.$refs.audio.duration)
|
this.$store.commit('player/duration', this.$refs.audio.duration)
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue