SevenOutman / vue-aplayer

:cake: Easy-to-use music player for Vue 2.x
https://vue-aplayer.js.org
MIT License
1.32k stars 200 forks source link

How to control playbackRate? #166

Closed govidat closed 5 years ago

govidat commented 5 years ago

How to control playbackRate? I am able to control volume by simply adding "volume = 0.3" inside . Is there a way to control playbackRate in player. Pls help.

govidat commented 5 years ago

Aplayer provides volume as an attribute and hence we are able to pass this directly. However playbackRate is not provided as an attribute. Hence used a event like "play" to initiate a method. Also passed a ref. Then in the method, set the audio.playbackRate to the desired value. <aplayer v-on:play="zeventplay" ref="zapl" :music= "{ .... }"/> ... then .. methods: { zeventplay() { // This is to set the playbackRate this.$refs.zapl.audio.playbackRate = 0.5; } }