diff --git a/README.md b/README.md index 71521bd..641d70e 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,11 @@ Triggio Web app that connects events send from trusted sources to sounds that are played. +Meteorite is used instead of meteor (https://github.com/oortcloud/meteorite) + + +## Audio files +Please provide audio clips in mp3 format. Since Triggio uses [audio.js](http://kolber.github.com/audiojs/) it support most browser with flash used as fallback ### Useful Commands diff --git a/client/triggio.coffee b/client/triggio.coffee index a2ce2ac..b17d602 100644 --- a/client/triggio.coffee +++ b/client/triggio.coffee @@ -2,6 +2,7 @@ Events = new Meteor.Collection "events" if Meteor.isClient + # For testing window.play_sound ||= play_sound Meteor.startup -> @@ -38,6 +39,17 @@ if Meteor.isClient play_sound = (sound_id) -> - player = $('#clip_player').attr - 'src': "/clips/#{sound_id}.mp3" - player[0].play() + # Remove any existing audio players + $('#clip_player').remove() + $('.audiojs').remove() + + # Create a new audio player that autoplays + # This is done so audiojs can do its flash initialization if browser does not support mp3 + audio = $('