parent
3c60ad4f14
commit
a78659b206
43 changed files with 402 additions and 288 deletions
|
|
@ -115,71 +115,3 @@ export default {
|
|||
<style lang="scss">
|
||||
@import "@/assets/css/chat.scss";
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
function playPauseAudio() {
|
||||
if (player.src) {
|
||||
if (player.paused || player.ended) {
|
||||
// Change the button to a pause button
|
||||
changeButtonType(btnPlayPause, 'pause');
|
||||
player.play();
|
||||
}
|
||||
else {
|
||||
// Change the button to a play button
|
||||
changeButtonType(btnPlayPause, 'play');
|
||||
player.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the current media from playing, and return it to the start position
|
||||
function stopAudio() {
|
||||
if (player.src) {
|
||||
player.pause();
|
||||
if (player.currentTime) player.currentTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Toggles the media player's mute and unmute status
|
||||
function muteVolume() {
|
||||
if (player.src) {
|
||||
if (player.muted) {
|
||||
// Change the button to a mute button
|
||||
changeButtonType(btnMute, 'mute');
|
||||
player.muted = false;
|
||||
}
|
||||
else {
|
||||
// Change the button to an unmute button
|
||||
changeButtonType(btnMute, 'unmute');
|
||||
player.muted = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Replays the media currently loaded in the player
|
||||
function replayAudio() {
|
||||
if (player.src) {
|
||||
resetPlayer();
|
||||
player.play();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Updates a button's title, innerHTML and CSS class
|
||||
function changeButtonType(btn, value) {
|
||||
btn.title = value;
|
||||
btn.innerHTML = value;
|
||||
btn.className = value;
|
||||
}
|
||||
|
||||
function resetPlayer() {
|
||||
progressBar.value = 0;
|
||||
//clear the current song
|
||||
player.src = '';
|
||||
// Move the media back to the start
|
||||
player.currentTime = 0;
|
||||
// Set the play/pause button to 'play'
|
||||
changeButtonType(btnPlayPause, 'play');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue