Update Play Sound module
This commit is contained in:
@@ -5,32 +5,14 @@
|
||||
//
|
||||
|
||||
beef.execute(function() {
|
||||
|
||||
function playSound(url) {
|
||||
function createSound(which) {
|
||||
window.soundEmbed = document.createElement("audio");
|
||||
window.soundEmbed.setAttribute("src", which);
|
||||
|
||||
window.soundEmbed.setAttribute("style", "display: none;");
|
||||
window.soundEmbed.setAttribute("autoplay", true);
|
||||
|
||||
}
|
||||
if (!window.soundEmbed) {
|
||||
createSound(url);
|
||||
}
|
||||
else {
|
||||
document.body.removeChild(window.soundEmbed);
|
||||
window.soundEmbed.removed = true;
|
||||
window.soundEmbed = null;
|
||||
createSound(url);
|
||||
}
|
||||
window.soundEmbed.removed = false;
|
||||
document.body.appendChild(window.soundEmbed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
playSound("<%== @sound_file_uri %>");
|
||||
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "Sound Played");
|
||||
var url = "<%== @sound_file_uri %>";
|
||||
try {
|
||||
var sound = new Audio(url);
|
||||
sound.play();
|
||||
beef.debug("[Play Sound] Played sound successfully: " + url);
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=Sound Played", beef.are.status_success());
|
||||
} catch (e) {
|
||||
beef.debug("[Play Sound] HTML5 audio unsupported. Could not play: " + url);
|
||||
beef.net.send("<%= @command_url %>", <%= @command_id %>, "fail=audio not supported", beef.are.status_error());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -11,5 +11,16 @@ beef:
|
||||
name: "Play Sound"
|
||||
description: "Play a sound on the hooked browser."
|
||||
authors: ["Saafan"]
|
||||
# http://caniuse.com/audio
|
||||
target:
|
||||
working: ["All"]
|
||||
not_working:
|
||||
IE:
|
||||
min_ver: 1
|
||||
max_ver: 8
|
||||
FF:
|
||||
min_ver: 1
|
||||
max_ver: 2
|
||||
S:
|
||||
min_ver: 1
|
||||
max_ver: 3
|
||||
|
||||
Reference in New Issue
Block a user