View previous topic :: View next topic |
Author |
Message |
Jeffrey Kafer Assistant Zookeeper
Joined: 09 Dec 2006 Posts: 4931 Location: Location, Location!
|
Posted: Wed Apr 18, 2007 12:59 pm Post subject: |
|
|
alrighty then.
1) Create a file called myplayer.js and put it with all of your html files on your site. Open that file and paste the following:
function commercial()
{
document.write('<script language="JavaScript" src="http://JeffreyKafer.com/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://JeffreyKafer.com/player.swf" id="audioplayer1" height="24" width="290"><param name="movie" value="http://JeffreyKafer.com/player.swf"><param name="FlashVars" value="playerID=1&soundFile=http://JeffreyKafer.com/Jeffrey_Kafer_commercials.mp3"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>');
}
be sure to change your domains and filenames above to match yours.
2) In your main HTML file were you want to display the player, put the following after the <title> tags
<script src="http://JeffreyKafer.com/myplayer.js" type="text/javascript"></script>
Again, change the domain names to match yours.
3) In the exact spot where you want the player to be, insert the following:
<script type="text/javascript">commercial();</script>
And that's it. So to teach a man to fish, here's what's happening
The browser loads your file. It sees the reference to myplayer.js under the Title tag. This basically says "hey browser, remember this file cause you're gonna need it later."
Then when it gets to the commercial(); line, it says "hey browser, go over to myplayer.js and look for this function."
In myplayer.js, the function Commercial is called and everything between the {} brackets is "written" to the main page, displaying the player.
If you have multiple players, just copy and paste the commercial function right below it, rename it and change the files. Then in your main page, just call it again with the new name.
Still not understanding? PM or email me and I can go through this with you. Once you understand what's happening, It kind of makes sense. _________________ Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com |
|
Back to top |
|
|
bobsouer Frequent Flyer
Joined: 15 Jul 2006 Posts: 9883 Location: Pittsburgh, PA
|
Posted: Wed Apr 18, 2007 1:04 pm Post subject: |
|
|
Jeffrey,
Thank you. That's very helpful. If I have any questions, I'll get back to you. _________________ Be well,
Bob Souer (just think of lemons)
The second nicest guy in voiceover.
+1-724-613-2749
Source Connect, phone patch, pony express |
|
Back to top |
|
|
Jeffrey Kafer Assistant Zookeeper
Joined: 09 Dec 2006 Posts: 4931 Location: Location, Location!
|
Posted: Wed Apr 18, 2007 2:45 pm Post subject: |
|
|
Keep in mind, the code in mplayer.js is specific to the wordpress player. Basically any <embed> code in your main html should be moved to the .js file. I'm happy to help with any custom scripting for the low low price of a donation to the VO-BB fund! _________________ Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com |
|
Back to top |
|
|
bobsouer Frequent Flyer
Joined: 15 Jul 2006 Posts: 9883 Location: Pittsburgh, PA
|
Posted: Wed Apr 18, 2007 9:04 pm Post subject: |
|
|
JeffreyKafer wrote: | If you have multiple players, just copy and paste the commercial function right below it, rename it and change the files. Then in your main page, just call it again with the new name. |
Jeffrey,
This is the spot where I'm struggling to understand your description; mainly because I can't quite parse what "it" is that is being renamed.
Am I creating a second file called, for example, myplayer2.js, with references to the specific location of the second audio file in the included code for that script? And so forth and so on?
Thanks in advance for your help. _________________ Be well,
Bob Souer (just think of lemons)
The second nicest guy in voiceover.
+1-724-613-2749
Source Connect, phone patch, pony express |
|
Back to top |
|
|
louzucaro The Gates of Troy
Joined: 13 Jul 2006 Posts: 1915 Location: Chicago area
|
Posted: Wed Apr 18, 2007 10:11 pm Post subject: |
|
|
Well you can put multiple copies of the function in the same .js file, but give each function a different name, such as...
showPlayer1()
showPlayer2()
showPlayer3()
...and so on, and change the name of the Flash movie to be shown in each one. Then, in your script tags in your web page where you call the function, just call the one you want to display in that particular spot by referencing the correct function name. _________________ Lou Zucaro
http://www.voicehero.com
"Well, yeah, there's my favorite leaf!" |
|
Back to top |
|
|
Jeffrey Kafer Assistant Zookeeper
Joined: 09 Dec 2006 Posts: 4931 Location: Location, Location!
|
Posted: Wed Apr 18, 2007 11:19 pm Post subject: |
|
|
You only need one .js file which will hold multiple functions. Each function loads a new instance of the player to play a different demo. Here is my .js file:
function commercial()
{
document.write('<script language="JavaScript" src="http://JeffreyKafer.com/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://JeffreyKafer.com/player.swf" id="audioplayer1" height="24" width="290"><param name="movie" value="http://JeffreyKafer.com/player.swf"><param name="FlashVars" value="playerID=1&soundFile=http://JeffreyKafer.com/Jeffrey_Kafer_commercials.mp3"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>');
}
function Narration()
{
document.write('<script language="JavaScript" src="http://JeffreyKafer.com/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://JeffreyKafer.com/player.swf" id="audioplayer2" height="24" width="290"><param name="movie" value="http://JeffreyKafer.com/player.swf"><param name="FlashVars" value="playerID=2&soundFile=http://JeffreyKafer.com/Jeffrey_Kafer_commercial_corporate.mp3"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>');
}
function cartoon()
{
document.write('<script language="JavaScript" src="http://JeffreyKafer.com/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://JeffreyKafer.com/player.swf" id="audioplayer3" height="24" width="290"><param name="movie" value="http://JeffreyKafer.com/player.swf"><param name="FlashVars" value="playerID=3&soundFile=http://JeffreyKafer.com/Jeffrey_Kafer_games_cartoons.mp3"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>');
}
function talkinghouse()
{
document.write('<script language="JavaScript" src="http://JeffreyKafer.com/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://JeffreyKafer.com/player.swf" id="audioplayer4" height="24" width="290"><param name="movie" value="http://JeffreyKafer.com/player.swf"><param name="FlashVars" value="playerID=4&soundFile=http://JeffreyKafer.com/Jeffrey_Kafer_talkinghouse.mp3"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>');
}
function audiobook()
{
document.write('<script language="JavaScript" src="http://JeffreyKafer.com/audio-player.js"></script><object type="application/x-shockwave-flash" data="http://JeffreyKafer.com/player.swf" id="audioplayer5" height="24" width="290"><param name="movie" value="http://JeffreyKafer.com/player.swf"><param name="FlashVars" value="playerID=5&soundFile=http://JeffreyKafer.com/Jeffrey_Kafer_audiobooks.mp3"><param name="quality" value="high"><param name="menu" value="false"><param name="wmode" value="transparent"></object>');
}
Then in the HTML, it looks like:
<script type="text/javascript">commercial();</script>
<br>
<br>
<script type="text/javascript">Narration();</script>
<br>
<br>
<script type="text/javascript">cartoon();</script>
<br>
<br>
<script type="text/javascript">TalkingHouse();</script>
<br>
<br>
<script type="text/javascript">audiobook();</script>
Each function in the .js file just sits there waiting to be called. The HTML then calls the function, which then executes giving me 5 players each playing different files.
Make more sense? _________________ Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com |
|
Back to top |
|
|
bobsouer Frequent Flyer
Joined: 15 Jul 2006 Posts: 9883 Location: Pittsburgh, PA
|
Posted: Thu Apr 19, 2007 6:48 am Post subject: |
|
|
Jeffrey,
That's exactly the clarification I needed. Thank you. Perfect. _________________ Be well,
Bob Souer (just think of lemons)
The second nicest guy in voiceover.
+1-724-613-2749
Source Connect, phone patch, pony express |
|
Back to top |
|
|
gkarnes Guest
|
Posted: Thu Apr 19, 2007 8:01 am Post subject: |
|
|
Holy Crap Batman!
This thread is giving me IT flashbacks of days I thought I had left behind. |
|
Back to top |
|
|
Jeffrey Kafer Assistant Zookeeper
Joined: 09 Dec 2006 Posts: 4931 Location: Location, Location!
|
|
Back to top |
|
|
bobbinbeamo M&M
Joined: 05 Mar 2007 Posts: 2468 Location: Wherever I happen to be
|
Posted: Thu Apr 19, 2007 8:07 pm Post subject: |
|
|
Wow- I think I picked up on about half of this. Are we trying to get some java to work playing demos here? What is this about. Sorry to sound like such a dork. I am experimenting with audio razor, with little success at this point., and wondering if this is what you are referring to? _________________ Bobbin Beam
www.bobbinbeam.com
blog.bobbinbeam.com |
|
Back to top |
|
|
Deirdre Czarina Emeritus
Joined: 10 Nov 2004 Posts: 13016 Location: East Jesus, Maine
|
|
Back to top |
|
|
Jeffrey Kafer Assistant Zookeeper
Joined: 09 Dec 2006 Posts: 4931 Location: Location, Location!
|
Posted: Thu Apr 19, 2007 9:16 pm Post subject: |
|
|
To get you up to speed, Bobbin, have you ever noticed that in internet Explorer, anytime there's a Flash animation or an embedded player, you have to click on it once to get rid of the "Click to activate this control" and then click again to actually control it as you should?
That initial "click to activate" message is what this code gets rid of.
It has nothing to do with Java. Javascript and Java are two completely unrelated things. _________________ Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com |
|
Back to top |
|
|
bobbinbeamo M&M
Joined: 05 Mar 2007 Posts: 2468 Location: Wherever I happen to be
|
Posted: Fri Apr 20, 2007 7:37 am Post subject: |
|
|
Hi Jeff. So this code is what gets rid of that "Active X" control? (the little bar at the top of the screen?)I thought that annoying thing was from my anti-virus/firewall software.
Also, DB- thanks for the thread. I'll be following both . _________________ Bobbin Beam
www.bobbinbeam.com
blog.bobbinbeam.com |
|
Back to top |
|
|
Jeffrey Kafer Assistant Zookeeper
Joined: 09 Dec 2006 Posts: 4931 Location: Location, Location!
|
Posted: Fri Apr 20, 2007 9:23 am Post subject: |
|
|
I'm not sure what bar at the top of the screen you're referring to. But in the browser, you have to click once on a Flash animation or player to be activate it. The code above works around that so the user doesn't have to click on the animation before it works. _________________ Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com |
|
Back to top |
|
|
jrodriguez315 A Hundred Dozen
Joined: 26 Sep 2006 Posts: 1202 Location: New Jersey
|
|
Back to top |
|
|
|