Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 03-18-2004, 10:51 AM   #1 (permalink)
Addict
 
[HTML/Java] Converting hyperlinks to media files so they open in the background

I'm trying to get hyperlinks to open media files without media player. Closest I've gotten to is the bgsound tag but that only plays background music; no link.
__________________
Slowly but surely getting over the loss of TFP v. 3.0.
Where the hell am I?....
Showering once a month does not make you a better person.

"The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."
Martin Luther King, Jr.
oldtimer is offline  
Old 03-18-2004, 10:53 AM   #2 (permalink)
Psycho
 
So the media files are going to be sounds ? mp3s ?
And you want them played in the browser ? One at a time ? Or a stream ?

I'd think that the easiest way to implement something like this is to use a popup window "player" with an embed tag that plays whatever sound/song the user clicks on ?
Mephex is offline  
Old 03-18-2004, 11:16 AM   #3 (permalink)
Addict
 
Namely wavs. I would assume that the coding would still be the same towards midi and mp3s; if not, slighty modified.

Also, I'm not trying to embed anything.

Picture as you may, you have a few media links:
(Links are fake so don't bother clicking on them... even though some of you will anyway )
Chariots Of Fire
Please Stand Up
Dirt Off Your Shoulder

Upon clicking those links, I would like to have the music loaded and played in the background. I know it's possible.
__________________
Slowly but surely getting over the loss of TFP v. 3.0.
Where the hell am I?....
Showering once a month does not make you a better person.

"The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."
Martin Luther King, Jr.
oldtimer is offline  
Old 03-18-2004, 11:48 AM   #4 (permalink)
Devoted
 
Redlemon's Avatar
 
Donor
Location: New England
This may be overkill (I don't know, 'cause I don't code), but the first link on this page: Dee Speaks uses Flash as an interface to play streaming MP3 files.
__________________
I can't read your signature. Sorry.
Redlemon is offline  
Old 03-18-2004, 11:51 AM   #5 (permalink)
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
It wouldn't be a sweat with php but I'm guessing you want it plain HTML huh?

A little googling turned this up: http://www.smartwebby.com/web_site_d...play_sound.asp

Hope that helps.

Although I would like to note that almost everyone hates background sounds on the web and they only sound cool by the owner of the website. I think it's a good thing that you are giving the user the control to decided wether or not to play it though.

Oh an no MIDIs too... that's good.... MIDIs are evil....
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein
RelaX is offline  
Old 03-18-2004, 12:12 PM   #6 (permalink)
Addict
 
WHOO-HOO!

Looks like we have a winner:
Quote:
Originally posted by RelaX
http://www.smartwebby.com/web_site_d...play_sound.asp
But I can't seem to get this code to work properly:

<a href="#" onClick="MM_controlSound('play','document.CS1022563046202','sound.wav')">Click Here to Play Sound</a>

Edit: Funny. Upon entering the code in a separate HTML file, it appears. But on the TFP the code doesn't work? Odd.
Though I found this out, I am still stuck. How do I correctly enter the path of my sound file?

Edit edit: D'oh! I had forgotten HTML coding (and I can assume the same for Javascript) has been disabled in this part of the forum.
__________________
Slowly but surely getting over the loss of TFP v. 3.0.
Where the hell am I?....
Showering once a month does not make you a better person.

"The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."
Martin Luther King, Jr.

Last edited by oldtimer; 03-21-2004 at 08:13 PM..
oldtimer is offline  
Old 03-18-2004, 01:09 PM   #7 (permalink)
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
Glad to have helped
Remember that the sound has to be in the location of the web document... I don't know if it will work with a URL...
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein
RelaX is offline  
Old 03-18-2004, 07:54 PM   #8 (permalink)
Addict
 
Forgot to address this:
Quote:
Originally posted by RelaX
I think it's a good thing that you are giving the user the control to decided wether or not to play it though.
Thanks.

Quote:
Originally posted by RelaX
Glad to have helped
Remember that the sound has to be in the location of the web document... I don't know if it will work with a URL...
Sorry, I still do not understand the code. I tried various, various methods both with url's and the sound file in the same folder but I all I get is the hyperlink, which when clicked does nothing. I think I'm missing an important step. Should anything be inserted where the # is located?
__________________
Slowly but surely getting over the loss of TFP v. 3.0.
Where the hell am I?....
Showering once a month does not make you a better person.

"The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."
Martin Luther King, Jr.
oldtimer is offline  
Old 03-18-2004, 11:21 PM   #9 (permalink)
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
Check your browser if you have Javascript off, also check if you put the javascript between the header tags...
There shouldn't be anything in the link, it's just a dummy for javascript...

It seems to me that you simply have a javascript problem, then again most of the code IS javascript so that would pretty much be expected...

If the solutions above didn't do anything at least add an
alert("HELLO!");
To the first line of the javascript function, to see if it is executed at all and let me know.
I'll try it myself tonite if you're still having probs...
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein

Last edited by RelaX; 03-18-2004 at 11:24 PM..
RelaX is offline  
Old 03-19-2004, 10:38 AM   #10 (permalink)
Addict
 
Works perfectly!

You see () I didn't use all the code provided on the page. I thought, simply, since I'm using html and they have the sections spread out like this; the feature I was looking for would work regardless of which section I chose or, at least, in three separate, very different ways. Big mistake. I cost myself a couple hours of headaches.

Thanks for the help, RelaX.

Now, all I have left to complain about is the non restarting of the song if you want to listen to it again. Any javascript we could add to that to make it work?

Again, thanks RelaX. You've been a big help.
__________________
Slowly but surely getting over the loss of TFP v. 3.0.
Where the hell am I?....
Showering once a month does not make you a better person.

"The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."
Martin Luther King, Jr.
oldtimer is offline  
Old 03-19-2004, 11:59 AM   #11 (permalink)
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
Tell me, why do javascript developers feel a need to bunch their code together? I mean a few newlines aren't goanna make much of a difference for download time....

Anyway, I'm not a javascript person (only had some formal education in Java) but the code below should work.
Haven't tested it though, so no guarantees.

What it now does is simply performes a stop function on the sound object before playing it, this should ensure it always starts from the beginning.

I don't know if this will work on files you're not already playing though... let me know...

And copy and paste that URL of the site.

Code:
 <script language="JavaScript">
<!--
//v3.0
function MM_controlSound(x, _sndObj, sndFile) 
{ 
  var i;
  var method = ""; 
  var sndObj = eval(_sndObj);
  
  if (sndObj != null) 
  {
    if (navigator.appName == 'Netscape') 
    {
      method = "play";
    }
    else 
    
      if (window.MM_WMP == null) 
      {
        window.MM_WMP = false;
	for(i in sndObj)
	{
	  if (i == "ActiveMovie") 
	  {
	    window.MM_WMP = true; 
	    break;
	  }
	}
      }
      if (window.MM_WMP){
      {
	method = "play";
      }
      else if (sndObj.FileName)
      {
	method = "run";
      }
    } 
  }
  if (method)
  {
    eval(_sndObj+".stop()");
    eval(_sndObj+"."+method+"()");
  }
  else
  {
    window.location = sndFile;
  }
}
//-->
</script>
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein
RelaX is offline  
Old 03-20-2004, 09:20 AM   #12 (permalink)
Addict
 
No go. I'm getting a javascript error.
Quote:
Line: 57
Char: 1
Error: Object Expected
Code: 0
__________________
Slowly but surely getting over the loss of TFP v. 3.0.
Where the hell am I?....
Showering once a month does not make you a better person.

"The ultimate measure of a man is not where he stands in moments of comfort, but where he stands at times of challenge and controversy."
Martin Luther King, Jr.
oldtimer is offline  
Old 03-21-2004, 02:12 PM   #13 (permalink)
Follower of Ner'Zhul
 
RelaX's Avatar
 
Location: Netherlands
I thought that might happen, should've done it right the first time around. Now it first checks if the sound object is actually instantiated yet. I even tested it this time, this works fine for me.
I also changed it to alert a Netscape (or Mozilla) user that it will not work for his/her browser.

Code:
<script language="JavaScript">
<!--
//v3.0
function MM_controlSound(x, _sndObj, sndFile)
{
	var i;
	var method = "";
	var sndObj = eval(_sndObj);
	
	if (sndObj != null)
	{
		if (navigator.appName == 'Netscape')
		{
                         alert("My appologies, this functionality is reserved for Internet Explorer users only");
			method = "play";
		}
		else
		{
			if (window.MM_WMP == null)
			{
				window.MM_WMP = false;
				for(i in sndObj)
				{
					if (i == "ActiveMovie")
					{
						window.MM_WMP = true;
						break;
					}
				}
			}
			if (window.MM_WMP)
			{
				method = "play";
			}
			else if(sndObj.FileName)
			{
				method = "run";
			}
		}
	}
	
	if (method)
	{
		if (sndObj != null)
		{
			eval(_sndObj+".stop()");
		}
		eval(_sndObj+"."+method+"()");
	}
	
	else
	{
		window.location = sndFile;
	}
}
//-->
</script>
__________________
The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
- Nathaniel Borenstein

Last edited by RelaX; 03-21-2004 at 02:22 PM..
RelaX is offline  
 

Tags
background, converting, files, html or java, hyperlinks, media, open


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 04:49 PM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360