2016-08-23 12:34:32 -07:00
|
|
|
"use strict";
|
|
|
|
|
2015-06-08 11:30:12 -07:00
|
|
|
//
|
|
|
|
// dialTone.js
|
|
|
|
// examples
|
|
|
|
//
|
|
|
|
// Created by Stephen Birarda on 06/08/15.
|
2015-06-11 20:33:30 -07:00
|
|
|
// Added disconnect HRS 6/11/15.
|
2015-06-08 11:30:12 -07:00
|
|
|
// Copyright 2015 High Fidelity, Inc.
|
|
|
|
//
|
|
|
|
// Distributed under the Apache License, Version 2.0.
|
|
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
//
|
|
|
|
|
2016-08-23 12:34:32 -07:00
|
|
|
(function() { // BEGIN LOCAL_SCOPE
|
2016-04-26 11:21:11 -07:00
|
|
|
|
2016-08-23 12:34:32 -07:00
|
|
|
// setup the local sound we're going to use
|
2016-04-26 11:21:11 -07:00
|
|
|
var connectSound = SoundCache.getSound(Script.resolvePath("assets/sounds/hello.wav"));
|
|
|
|
var disconnectSound = SoundCache.getSound(Script.resolvePath("assets/sounds/goodbye.wav"));
|
|
|
|
var micMutedSound = SoundCache.getSound(Script.resolvePath("assets/sounds/goodbye.wav"));
|
2015-06-08 11:30:12 -07:00
|
|
|
|
|
|
|
// setup the options needed for that sound
|
2015-06-12 12:33:17 -07:00
|
|
|
var soundOptions = {
|
2015-06-08 11:31:24 -07:00
|
|
|
localOnly: true
|
2015-06-11 20:33:30 -07:00
|
|
|
};
|
2015-06-08 11:30:12 -07:00
|
|
|
|
|
|
|
// play the sound locally once we get the first audio packet from a mixer
|
|
|
|
Audio.receivedFirstPacket.connect(function(){
|
2015-06-12 12:33:17 -07:00
|
|
|
Audio.playSound(connectSound, soundOptions);
|
2015-06-08 11:30:12 -07:00
|
|
|
});
|
2015-06-11 20:33:30 -07:00
|
|
|
|
|
|
|
Audio.disconnected.connect(function(){
|
2015-06-12 12:33:17 -07:00
|
|
|
Audio.playSound(disconnectSound, soundOptions);
|
|
|
|
});
|
|
|
|
|
2016-08-23 12:34:32 -07:00
|
|
|
}()); // END LOCAL_SCOPE
|