un audio per volta
This commit is contained in:
parent
f1e914293e
commit
af60069515
1 changed files with 7 additions and 14 deletions
|
@ -48,24 +48,17 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
play (url) {
|
play (url) {
|
||||||
var urls;
|
let newPlayer = new Howl({
|
||||||
if (url === undefined) {
|
|
||||||
const rnd = Math.random()
|
|
||||||
urls = [
|
|
||||||
'https://stream.radioblackout.org/blackout.ogg?rnd=' + rnd,
|
|
||||||
'https://stream.radioblackout.org/blackout.mp3'
|
|
||||||
]
|
|
||||||
} else {
|
|
||||||
urls = [url]
|
|
||||||
}
|
|
||||||
this.player = new Howl({
|
|
||||||
autoSuspend: false,
|
autoSuspend: false,
|
||||||
html5: true,
|
html5: true,
|
||||||
preload: true,
|
preload: true,
|
||||||
src: urls,
|
src: [url],
|
||||||
})
|
})
|
||||||
console.log(this.player)
|
newPlayer.play()
|
||||||
this.player.play()
|
if(this.player) {
|
||||||
|
this.player.stop()
|
||||||
|
}
|
||||||
|
this.player = newPlayer
|
||||||
},
|
},
|
||||||
stop () {
|
stop () {
|
||||||
if (this.player) {
|
if (this.player) {
|
||||||
|
|
Loading…
Reference in a new issue