JSFiddle - React, Tailwind, and code Playground
HTML
Список функий для управления плеером VK
JavaScript
var functions = {
check: function(){
return document.getElementsByClassName('top_audio_player top_audio_player_enabled')[0];
},
next: function(){
getAudioPlayer().playNext();
},
prev: function(){
getAudioPlayer().playPrev();
},
pause: function(){
document.getElementsByClassName('top_audio_player_btn top_audio_player_play')[0].click()
},
stop: function(){
getAudioPlayer().pause();
},
mute: function(){
getAudioPlayer().setVolume(0);
},
vol: function(val){
if(typeof val != 'number') val = parseInt(val);
getAudioPlayer().setVolume(val/100);
},
info: function(){
var info = getAudioPlayer().getCurrentAudio();
return {
play: getAudioPlayer().isPlaying(),
vol: getAudioPlayer().getVolume(),
dur: info[5],
pos: getAudioPlayer().getCurrentProgress(),
title: info[3],
author: info[4],
};
},
isPlaying: function(val){
return getAudioPlayer().isPlaying();
}
};