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 05:01 AM.

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