Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Any code for adding streaming audio?


  • Please log in to reply

#1
TheRelief

TheRelief

    Member

  • Member
  • PipPip
  • 37 posts
Hey y'all. Does anyone know where I can find a simple cut and paste script for adding streaming audio.

You know how it's popular right now to have the little PLAY, PAUSE & STOP buttons where visitors to your site can hear a personal message from you?

Yeah, that's what I wanna do, but I think it's insane that people are paying monthly fees of like $20 a month to do it!

I did find a free javascript site that looked like it had something like I'm looking for, but I couldn't get it to work at all. I kept getting that error message about there being something wrong with the code. Here's the site in case you see anything that might help make it work:

http://javaboutique....m/AudioCentric/

TIA!!!

Edited by TheRelief, 24 September 2005 - 09:50 PM.

  • 0

Advertisements


#2
Rockett

Rockett

    Member

  • Member
  • PipPip
  • 78 posts
What file extension are you trying to use for this??

Rockett
  • 0

#3
TheRelief

TheRelief

    Member

  • Topic Starter
  • Member
  • PipPip
  • 37 posts
Do you mean the audio file? I did follow the instructions where it says to use Sound Recorder to convert it that a "g" something or other. I did do that, if that's what you mean, although it does still show as a .wav file even after converting it.
  • 0

#4
lil_cat_luver

lil_cat_luver

    Member

  • Member
  • PipPipPip
  • 296 posts
Try this one http://javascript.in.../midi-menu.html seems much easier
  • 0

#5
TheRelief

TheRelief

    Member

  • Topic Starter
  • Member
  • PipPip
  • 37 posts
Thanks for the input, but I'm looking for something with buttons. Since it's for a biz site, I want it to look a little more on the professional/polished side. Here's an example: http://www.conniecoach.com/.

If I could find a script that works like these buttons, but no flash, that's what I want to do.
  • 0

#6
lil_cat_luver

lil_cat_luver

    Member

  • Member
  • PipPipPip
  • 296 posts
OK, try http://www.eborcom.c...ipts.html#sound it's a really simple javascript and only features the "play" function, but I'm sure it'll be easy to add a pause and stop function.

You can use your own play/pause/stop buttons, since the audio is controlled by a link on an image.
  • 0

#7
TheRelief

TheRelief

    Member

  • Topic Starter
  • Member
  • PipPip
  • 37 posts
I was all excited about that one at first , except I don't understand how it plays. I added the script to a new page, changed the image and sound files to my own, but it doesn't play.

Doesn't there have to be some kind of embedded player of some kind? My sound file is a .wav and not .au, if that matters at all.

I should mention that I'm not a programmer at all so I need guidance in very literal terms.
  • 0

#8
lil_cat_luver

lil_cat_luver

    Member

  • Member
  • PipPipPip
  • 296 posts
It doesn't matter what the file format is, I think. I'm not familiar with javascript, but since play is written as: function play() I suppose pause and stop would be: function pause() and function stop()

And the html coding would probably be <a href="ex5_:pause()"><img src="pause.jpg" border=0></a> or something like that.

From what I understand (which is not a lot...) the javascript opens up windows media player, but you can do some searching to change it to play in the background
  • 0

#9
Rockett

Rockett

    Member

  • Member
  • PipPip
  • 78 posts
I think "bgsound" is the code that puts it in the background Lil.
  • 0

#10
lil_cat_luver

lil_cat_luver

    Member

  • Member
  • PipPipPip
  • 296 posts
Rockett, would you use it like: function bgsound play ()?

I couldn't find any javascript tutorials that talked about pausing and stopping but I did find this one. It has a stop and start button, but of course you can also use your own.

It's a little weird looking, I think you need to have a silent file for jsilent.mid for it to work in IE4

<script language="JavaScript">
<!--
ver=parseInt(navigator.appVersion)
ie4=(ver>3 && navigator.appName!="Netscape")?1:0
ns4=(ver>3 && navigator.appName=="Netscape")?1:0
ns3=(ver==3 && navigator.appName=="Netscape")?1:0

function playSound() {
if (ie4) document.all['BGSOUND_ID'].src='yourmusic.mid';
if ((ns4||ns3)
&& navigator.javaEnabled()
&& navigator.mimeTypes['audio/x-midi']
&& self.document.yourmusic.IsReady()
)
{
self.document.yourmusic.play()
}
}

function stopSound() {
if (ie4) document.all['BGSOUND_ID'].src='jsilence.mid';
if ((ns4||ns3)
&& navigator.javaEnabled()
&& navigator.mimeTypes['audio/x-midi']
)
{
self.document.yourmusic.stop()
}
}
//-->
</script>

<form name=myform>
<input type=button value="Play Sound" onClick="playSound()">
<input type=button value="Stop Sound" onClick="stopSound()">
</form>
  • 0

#11
Rockett

Rockett

    Member

  • Member
  • PipPip
  • 78 posts
IE 4?? are you living in the stone age, dear?????

:tazz:

Rockett
  • 0

#12
lil_cat_luver

lil_cat_luver

    Member

  • Member
  • PipPipPip
  • 296 posts
No, but I'm guessing IE 4, NS 3, and NS4 work differently than the more current browsers, so they need to have some special coding to fix it? Maybe it's just a really old javascript :)

And, *points to firefox button below* *kicks IE* :tazz:
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP