![]() |
|
|
How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
I'm trying to play random wmv files, and this is the closest I have found to a script or method. I filled in the files and locations... but now what? How do I call it up?
// ************ Start of randomMovie.js ************* // Our playlist array. playlist[0] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Back_In_The_Days.wmv' playlist[1] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Strangers.wmv' playlist[2] = ''http://www.GuitarGarage.tv/music/Billy_Chapman/Scattered_Man.wmv' playlist[3] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Fall_In_Love.wmv' playlist[4] = 'http://www.GuitarGarage.tv/music/Keevers/Farside_Banks_Of_Jordan.wmv' playlist[5] = 'http://www.GuitarGarage.tv/music/Keevers/Coat_Of_Many_Colors.wmv' playlist[6] = 'http://www.GuitarGarage.tv/music/Send_A_Message_To_My_Heart.wmv' playlist[7] = 'http://www.GuitarGarage.tv/music/Swamp_Fox/Trash_Man.wmv' playlist[8] = 'http://www.GuitarGarage.tv/music/Swamp_Fox/Seven_Day_Fool.wmv' // Find the length of thr array var arrayLen = playlist.length; // Get a random number var randomMovie = Math.round(Math.random()*(arrayLen-1)); function renderMovie(){ document.writeln('<OBJECT id="VIDEO" width="320" height="240"'); document.writeln('CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"'); document.writeln('type="application/x-oleobject">'); document.writeln('<PARAM NAME="URL" VALUE="'+ playlist[randomMovie] +'">'); document.writeln('<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">'); document.writeln('<PARAM NAME="AutoStart" VALUE="True">'); document.writeln('<PARAM name="uiMode" value="none">'); document.writeln('<PARAM name="PlayCount" value="9999">'); document.writeln('</OBJECT>'); } // ************ End of randomMovie.js *************
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
| Sponsored Links (We share ad revenue): |
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
Seriously, anybody? What is the proper coding to use this? Please?
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
Anybody?
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
Anybody at all?
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
Capt Quirk - Posting "Anybody" 3 times isn't going to get you anywhere. This script can pretty much be read verbatim and understood. All you have to do is sit down with it for less time then it took to make those 3 above posts and you should be able to do it.
Experiment and have fun, that's what programming is about!
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
I'm sorry, but I am not code friendly. If you can speak javascript in you sleep, great! I can't, which is why I am asking. I'm sorry if this isn't a political post, or a religious post, or a Last Person to post post. I'm here because I need some help. This is something I have been trying to get to work for a while, so can you help?
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
All right, let's step through this by reading through the code:
1. Adding things to an array 2. Getting the length of the array (the number of items) 3. Generating a random number between 0 and the size of the array 4. Creating a function that writes the stuff for the player to the browser document So, what do you do next? Call the function anywhere after it is defined. That's it.
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
And calling the function is where I must be doing it wrong. function renderMovie(){ is what I use to call it? How does it need to be stated to call the script? Sometimes I can cut and paste, this isn't one of them.
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
Code:
<script type="text/javascript">renderMovie();</script>
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
I'm sorry Nick, I still seem to be doing something wrong, so let me take this step by step-
1) take above text and save as playList.js in the root directory. 2) between the head tags, I place <SCRIPT language="JavaScript"> 3) in the Body, I place this where I want it to appear on the page? <script type="text/javascript">renderMovie();</script>
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
Post your code as it is now and we'll try to correct it. That's probably the easiest way.
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <SCRIPT language="JavaScript"> </head> <body> <script type="text/javascript">renderMovie();</script> </body> </html> and then I have this saved as playList.js in the root directory- // ************ Start of randomMovie.js ************* // Our playlist array. playlist[0] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Back_In_The_Days.wmv' playlist[1] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Strangers.wmv' playlist[2] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Scattered_Man.wmv' playlist[3] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Fall_In_Love.wmv' playlist[4] = 'http://www.GuitarGarage.tv/music/Keevers/Farside_Banks_Of_Jordan.wmv' playlist[5] = 'http://www.GuitarGarage.tv/music/Keevers/Coat_Of_Many_Colors.wmv' playlist[6] = 'http://www.GuitarGarage.tv/music/Send_A_Message_To_My_Heart.wmv' playlist[7] = 'http://www.GuitarGarage.tv/music/Swamp_Fox/Trash_Man.wmv' playlist[8] = 'http://www.GuitarGarage.tv/music/Swamp_Fox/Seven_Day_Fool.wmv' // Find the length of thr array var arrayLen = playlist.length; // Get a random number var randomMovie = Math.round(Math.random()*(arrayLen-1)); function renderMovie(){ document.writeln('<OBJECT id="VIDEO" width="320" height="240"'); document.writeln('CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"'); document.writeln('type="application/x-oleobject">'); document.writeln('<PARAM NAME="URL" VALUE="'+ playlist[randomMovie] +'">'); document.writeln('<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">'); document.writeln('<PARAM NAME="AutoStart" VALUE="True">'); document.writeln('<PARAM name="uiMode" value="none">'); document.writeln('<PARAM name="PlayCount" value="9999">'); document.writeln('</OBJECT>'); } // ************ End of randomMovie.js *************
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
Code:
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript" src="randomMovie.js"></script> </head> <body> <script type="text/javascript">renderMovie();</script> </body> </html>
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
http://guitargarage.tv/playList.html
Sorry Nick, I'm still not getting it.
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
Javascript File
Code:
// ************ Start of randomMovie.js *************
// Our playlist array
var playlist =new Array();
playlist[0] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Back_In_The_Days.wmv'
playlist[1] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Strangers.wmv'
playlist[2] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Scattered_Man.wmv'
playlist[3] = 'http://www.GuitarGarage.tv/music/Billy_Chapman/Fall_In_Love.wmv'
playlist[4] = 'http://www.GuitarGarage.tv/music/Keevers/Farside_Banks_Of_Jordan.wmv'
playlist[5] = 'http://www.GuitarGarage.tv/music/Keevers/Coat_Of_Many_Colors.wmv'
playlist[6] = 'http://www.GuitarGarage.tv/music/Send_A_Message_To_My_Heart.wmv'
playlist[7] = 'http://www.GuitarGarage.tv/music/Swamp_Fox/Trash_Man.wmv'
playlist[8] = 'http://www.GuitarGarage.tv/music/Swamp_Fox/Seven_Day_Fool.wmv'
// Find the length of thr array
var arrayLen = playlist.length;
// Get a random number
var randomMovie = Math.round(Math.random()*(arrayLen-1));
function renderMovie(){
document.writeln('<OBJECT id="VIDEO" width="320" height="240"');
document.writeln('CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"');
document.writeln('type="application/x-oleobject">');
document.writeln('<PARAM NAME="FileName" VALUE="'+ playlist[randomMovie] +'">');
document.writeln('<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">');
document.writeln('<PARAM NAME="AutoStart" VALUE="True">');
document.writeln('<PARAM name="uiMode" value="none">');
document.writeln('<PARAM name="PlayCount" value="9999">');
document.writeln('<EMBED TYPE="application/x-mplayer2" SRC="' + playlist[randomMovie] + '" NAME="MediaPlayer" WIDTH="192" HEIGHT="190" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED>');
document.writeln('</OBJECT>');
}
// ************ End of randomMovie.js *************
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript" src="randomMovie.js"></script> </head> <body> <script type="text/javascript">renderMovie();</script> </body> </html>
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
Now I am totally confused... you posted what I posted? It looks identical, but either way, you helped me get it working. Thank you Nick.
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Weightlifting CS Student
Posts: 495
Name: Nick Ohrn
|
If you do a line-by-line comparison, you'll see they're not the same. I added some lines to the JavaScript file.
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: How do I use this random wmv script? |
|
Extreme Talker
Posts: 189
Location: Flordidian
|
Ok, yeah... I do see a couple differences now that you mention it. Again, thanks for your help. Like I said, I just don't do code. It was the same thing with algebra for me, I just see random strings that don't make sense. HTML is about as close to coding as I can get, but I still rely on a WYSIWYG.
Now all I need to do is get the player to be sleeker, and get some live stuff going... ![]()
__________________
http://GuitarGarage.tv , up and limping along. |
|
|
|
| Sponsored Links (We share ad revenue): |
| Thread Tools | |
|
|
| Webmaster Resources Marketplace: |
| Software Development Company | Webhosting.UK.com |
| Web Templates | Text Link Brokers | Stock Photos |