Your browser does not support the audio element.
+
@@ -94,7 +95,17 @@
Delete voice message from {{ caller.phone_no }}?
history.back()
});
-// Open the Messages page
+
+// Play the message
+$('#play-button').on('click', function (event) {
+ // It doesn't work with $("#audio").play() like you would expect. The official reason is that
+ // incorporating it into jQuery would add a play() to every element. So instead you have to refer
+ // to it by its position in the array of DOM elements
+ // https://stackoverflow.com/a/38547039/4797523
+ $("#audio")[0].play()
+});
+
+// Delete the messages
$('#delete-message').on('click', function (event) {
window.location.href = "/messages/delete/{{ caller.msg_no }}"
});