VO-BB - 19 YEARS OLD! Forum Index VO-BB - 19 YEARS OLD!
Where A.I. is a four-letter word.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Kafer's Code
Goto page 1, 2  Next
 
Post new topic   Reply to topic    VO-BB - 19 YEARS OLD! Forum Index -> Research and Development
View previous topic :: View next topic  
Author Message
Jeffrey Kafer
Assistant Zookeeper


Joined: 09 Dec 2006
Posts: 4931
Location: Location, Location!

PostPosted: Wed Apr 18, 2007 12:59 pm    Post subject: Reply with quote

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&amp;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
View user's profile Send private message Send e-mail Visit poster's website
bobsouer
Frequent Flyer


Joined: 15 Jul 2006
Posts: 9882
Location: Pittsburgh, PA

PostPosted: Wed Apr 18, 2007 1:04 pm    Post subject: Reply with quote

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
ISDN, Source Connect, phone patch
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
Jeffrey Kafer
Assistant Zookeeper


Joined: 09 Dec 2006
Posts: 4931
Location: Location, Location!

PostPosted: Wed Apr 18, 2007 2:45 pm    Post subject: Reply with quote

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! Smile
_________________
Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bobsouer
Frequent Flyer


Joined: 15 Jul 2006
Posts: 9882
Location: Pittsburgh, PA

PostPosted: Wed Apr 18, 2007 9:04 pm    Post subject: Reply with quote

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
ISDN, Source Connect, phone patch
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
louzucaro
The Gates of Troy


Joined: 13 Jul 2006
Posts: 1915
Location: Chicago area

PostPosted: Wed Apr 18, 2007 10:11 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Jeffrey Kafer
Assistant Zookeeper


Joined: 09 Dec 2006
Posts: 4931
Location: Location, Location!

PostPosted: Wed Apr 18, 2007 11:19 pm    Post subject: Reply with quote

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&amp;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&amp;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&amp;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&amp;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&amp;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
View user's profile Send private message Send e-mail Visit poster's website
bobsouer
Frequent Flyer


Joined: 15 Jul 2006
Posts: 9882
Location: Pittsburgh, PA

PostPosted: Thu Apr 19, 2007 6:48 am    Post subject: Reply with quote

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
ISDN, Source Connect, phone patch
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address MSN Messenger
gkarnes
Guest





PostPosted: Thu Apr 19, 2007 8:01 am    Post subject: Reply with quote

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!

PostPosted: Thu Apr 19, 2007 9:52 am    Post subject: Reply with quote

yeah I know it's a bit nerdy. But getting rid of that message is worth it in my book.
_________________
Jeff
http://JeffreyKafer.com
Voice-overload Web comic: http://voice-overload.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bobbinbeamo
M&M


Joined: 05 Mar 2007
Posts: 2468
Location: Wherever I happen to be

PostPosted: Thu Apr 19, 2007 8:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Deirdre
Czarina Emeritus


Joined: 10 Nov 2004
Posts: 13016
Location: East Jesus, Maine

PostPosted: Thu Apr 19, 2007 8:17 pm    Post subject: Reply with quote

Bobbin-- this thread split off from this one:
http://www.vo-bb.com/phpBB2/viewtopic.php?t=3249
_________________
DBCooperVO.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jeffrey Kafer
Assistant Zookeeper


Joined: 09 Dec 2006
Posts: 4931
Location: Location, Location!

PostPosted: Thu Apr 19, 2007 9:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
bobbinbeamo
M&M


Joined: 05 Mar 2007
Posts: 2468
Location: Wherever I happen to be

PostPosted: Fri Apr 20, 2007 7:37 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Jeffrey Kafer
Assistant Zookeeper


Joined: 09 Dec 2006
Posts: 4931
Location: Location, Location!

PostPosted: Fri Apr 20, 2007 9:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
jrodriguez315
A Hundred Dozen


Joined: 26 Sep 2006
Posts: 1202
Location: New Jersey

PostPosted: Mon Apr 23, 2007 9:41 pm    Post subject: Reply with quote

This is an enormous help but where do you get the player.swf file? Does everyone refer to it from your site?
_________________
Joe Rodriguez, Bilingual Voice Actor | The Voiceover Thespian Blog
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    VO-BB - 19 YEARS OLD! Forum Index -> Research and Development All times are GMT - 7 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group