Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
How do I use this random wmv script?
Old 05-09-2008, 12:52 AM How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
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 *************
Capt Quirk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-09-2008, 12:45 PM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
Seriously, anybody? What is the proper coding to use this? Please?
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-10-2008, 10:08 AM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
Anybody?
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-11-2008, 11:44 AM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
Anybody at all?
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-11-2008, 08:52 PM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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!
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-11-2008, 09:45 PM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
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?
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-11-2008, 10:29 PM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-11-2008, 10:32 PM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
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.
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-11-2008, 10:35 PM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
Code:
<script type="text/javascript">renderMovie();</script>
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-11-2008, 10:56 PM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
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>
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-11-2008, 11:03 PM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
Post your code as it is now and we'll try to correct it. That's probably the easiest way.
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-11-2008, 11:08 PM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
<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 *************
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-11-2008, 11:23 PM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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>
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-11-2008, 11:41 PM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
http://guitargarage.tv/playList.html
Sorry Nick, I'm still not getting it.
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-12-2008, 12:23 AM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
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 *************
HTML
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>
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-12-2008, 07:20 AM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
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.
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Old 05-12-2008, 09:13 AM Re: How do I use this random wmv script?
Plugin-Developer's Avatar
Weightlifting CS Student

Posts: 504
Name: Nick Ohrn
Trades: 0
If you do a line-by-line comparison, you'll see they're not the same. I added some lines to the JavaScript file.
__________________

Please login or register to view this content. Registration is FREE
- Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
Plugin-Developer is offline
Reply With Quote
View Public Profile Visit Plugin-Developer's homepage!
 
Old 05-12-2008, 09:32 AM Re: How do I use this random wmv script?
Capt Quirk's Avatar
Extreme Talker

Posts: 223
Location: Flordidian
Trades: 0
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...
Capt Quirk is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How do I use this random wmv script?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.60980 seconds with 12 queries