Hi, I have this script here:
Enter Chat and press enter
<div><input id=input placeholder=you-chat-here /></div>
Chat Output
<div id=box></div>
<div id=pubnub pub-key=demo sub-key=demo></div>
<script src=http://cdn.pubnub.com/pubnub-3.1.min.js></script>
<script>(function(){
var box = PUBNUB.$('box'), input = PUBNUB.$('input'), channel = 'chatlllll';
PUBNUB.subscribe({
channel : channel,
callback : function(text) { box.innerHTML = (''+text).replace( /[<>]/g, '' ) + '<br>' + box.innerHTML; }
});
PUBNUB.bind( 'keyup', input, function(e) {
(e.keyCode || e.charCode) === 13 && PUBNUB.publish({
playsound('http://www.aphpsite.comuv.com/sound/chat.wav')
channel : channel, message : input.value, x : (input.value='')
});
} );
})();</script>
I am having trouble because I want it to play a sound to the other person when I chat.......With this code, it does nothing. I would be glad if you helped. Info: This uses the PubNub API to send chats, all I want it to do is to play a sound to the user, and the other user. Thanks.