+
+
+
+
+
+
+
+
+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');
+}
+
diff --git a/src/components/messages/MessageIncomingAudio.vue b/src/components/messages/MessageIncomingAudio.vue
index 1c0106b..a37f2b9 100644
--- a/src/components/messages/MessageIncomingAudio.vue
+++ b/src/components/messages/MessageIncomingAudio.vue
@@ -1,7 +1,7 @@
-