HighDots Forums  

Wmp html Codes

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Wmp html Codes in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dj Psycho
 
Posts: n/a

Default Wmp html Codes - 06-01-2006 , 04:12 PM






Well i got a embed list to embe wmp in my site one thing i want it to shuffle
the playlist like everytime when someon comes on my site my mediaplayer must
randomize the playlist. its about 200 songs so its gonna be boring if someon
hear the same numbers everytime they wanna listen music
someon know the command or Param of it??


Reply With Quote
  #2  
Old   
(_seb_)
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 04:24 PM






Dj Psycho wrote:
Quote:
Well i got a embed list to embe wmp in my site one thing i want it to shuffle
the playlist like everytime when someon comes on my site my mediaplayer must
randomize the playlist. its about 200 songs so its gonna be boring if someon
hear the same numbers everytime they wanna listen music
someon know the command or Param of it??

You would have to use javascript to generate the wmp embed code, so that each time the page loads, a
new target song is written within the embed code.
The basic method would be to create a javascript array with all the songs, then a javacsript
function that randomly picks one, then a javsacript function that generates the embed code with the
choosen song.
Don't know javascript enough to give you a code example, but you can Google that, or else, wait for
some javascript guru to answer.


--
seb ( --- (AT) webtrans1 (DOT) com)
http://webtrans1.com | high-end web design
Downloads: Slide Show, Directory Browser, Mailing List


Reply With Quote
  #3  
Old   
(_seb_)
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 04:27 PM



(_seb_) wrote:
Quote:
Dj Psycho wrote:

Well i got a embed list to embe wmp in my site one thing i want it to
shuffle the playlist like everytime when someon comes on my site my
mediaplayer must randomize the playlist. its about 200 songs so its
gonna be boring if someon hear the same numbers everytime they wanna
listen music
someon know the command or Param of it??


You would have to use javascript to generate the wmp embed code, so that
each time the page loads, a new target song is written within the embed
code.
The basic method would be to create a javascript array with all the
songs, then a javacsript function that randomly picks one, then a
javsacript function that generates the embed code with the choosen song.
Don't know javascript enough to give you a code example, but you can
Google that, or else, wait for some javascript guru to answer.


you can also use any server-side language, following the same method. The advantage of a server side
language will be that you won't need to manually write down the array containing all the songs,
server-side code can automatically go look into your folder containing all the songs and create an
array from all the files inside it. So you could add songs or remove songs from the folder and the
array will always be accurate.
If you can use PHP I can give you a code example of how that would be done...

--
seb ( --- (AT) webtrans1 (DOT) com)
http://webtrans1.com | high-end web design
Downloads: Slide Show, Directory Browser, Mailing List


Reply With Quote
  #4  
Old   
Dj Psycho
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 05:44 PM



well i dont know what you mean with the java script.. and PHP pff i dont know how it works.. i already searched for java scripts and bulshit diddent find a shuffle playlit param with it..

Reply With Quote
  #5  
Old   
(_seb_)
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 05:59 PM



Dj Psycho wrote:
Quote:
well i dont know what you mean with the java script.. and PHP pff i dont know how it works.. i already searched for java scripts and bulshit diddent find a shuffle playlit param with it..
no, you probably won't find a "javascript playlist shuffle" on Google...
But you can find what a "javascript array" is, and how to pick a "random value in the array", and
how to write the embed code... These are the 3 functionalities you need.

You're trying to do something that requires a little research, maybe a lot if you know nothing about
javascript.

As for PHP, all you need to know, is whether your host supports it or not, and if it does, I could
then help you concretely with some code examples (I don't know javascript that well, but I know PHP).

See if your host supports PHP, and come back here with an answer.

--
seb ( --- (AT) webtrans1 (DOT) com)
http://webtrans1.com | high-end web design
Downloads: Slide Show, Directory Browser, Mailing List


Reply With Quote
  #6  
Old   
Dj Psycho
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 06:07 PM



jes my host provides PHP and i will be pleased if you could help me :-)

Reply With Quote
  #7  
Old   
(_seb_)
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 06:48 PM



Dj Psycho wrote:
Quote:
jes my host provides PHP and i will be pleased if you could help me :-)
ok, so I'll try to give you a step by step instruction:

first, put all your audio files in one folder, within your main site folder, and call that folder
"audio".

Second, change the extension of the page in which you will have the songs playing, from htm to php.
I will assume this page is also in the main site folder. If it's called 'index.html', change it to
'index.php'.

Third, in code view, paste the following code, above all the rest of the code (above the doctype).
Code to paste start with "<?php" and ends with "?>".

<?php
// GENERATE ARRAY WITH ALL AUDIO FILES
if ($handle = opendir('audio')){
while (false !== ($file = readdir($handle))){
if (is_file($path.'/'.$file) && $file !== '.' && $file !== '..' && $file !== '.DS_Store'){
$files[] = $file;
}
}
}

// COUNT THE FILES
$songsNum = count($files);

// GENERATE RANDOM NUMBER FROM 0 TO THE NUMBER OF FILES
$rand = rand(0,$songsNum-1);
?>

Third, find in your code the part that concerns the embedding of window media player. It should look
something like this:

<object id="MediaPlayer" width="500" height="400"
classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player
components..." type="application/x-oleobject"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">
<param name="filename" value="folder/song1.mp3">
<param name="stretchtofit" value="true">
<param name="Showcontrols" value="True">
<param name="autoStart" value="True">
<embed type="application/x-mplayer2" src="folder/song1.mp3" name="MediaPlayer"></embed>
</object>

In any case, in this code, there are two occurences of the link to your audio file. In the above
example, these two occurences are:
<param name="filename" value="folder/song1.mp3">
and:
<embed type="application/x-mplayer2" src="folder/song1.mp3" name="MediaPlayer">

In both occurences, replace "folder/song1.mp3" with: <?php echo 'audio/'.$files[$rand]; ?>

so that the lines will be changed to:

<param name="filename" value="<?php echo 'audio/'.$files[$rand]; ?>">
and:
<embed type="application/x-mplayer2" src="<?php echo 'audio/'.$files[$rand]; ?>" name="MediaPlayer">

That's all. The PHP code will look into your audio folder, and select one audio file at random each
time you reload the page.
Note that if you preview the page locally, it won't work. It will only work ONLINE, once you upload
the page and the folder containing all the audio files.

Let me know if that's clear and if it works.


--
seb ( --- (AT) webtrans1 (DOT) com)
http://webtrans1.com | high-end web design
Downloads: Slide Show, Directory Browser, Mailing List


Reply With Quote
  #8  
Old   
(_seb_)
 
Posts: n/a

Default Re: Wmp html Codes - 06-01-2006 , 06:55 PM



and oh, yes, if your page was 'index.htm' and you've changed it to 'index.php', when you type your
site address, it is still index.htm that will show, not index.php. To see index.php, type:

http://yoursite.com/index.php

If the page works properly, you can delete 'index.htm' from your remote site.

(_seb_) wrote:
Quote:
Dj Psycho wrote:

jes my host provides PHP and i will be pleased if you could help me :-)


ok, so I'll try to give you a step by step instruction:

first, put all your audio files in one folder, within your main site
folder, and call that folder "audio".

Second, change the extension of the page in which you will have the
songs playing, from htm to php. I will assume this page is also in the
main site folder. If it's called 'index.html', change it to 'index.php'.

Third, in code view, paste the following code, above all the rest of the
code (above the doctype). Code to paste start with "<?php" and ends with
"?>".

?php
// GENERATE ARRAY WITH ALL AUDIO FILES
if ($handle = opendir('audio')){
while (false !== ($file = readdir($handle))){
if (is_file($path.'/'.$file) && $file !== '.' && $file !== '..'
&& $file !== '.DS_Store'){
$files[] = $file;
}
}
}

// COUNT THE FILES
$songsNum = count($files);

// GENERATE RANDOM NUMBER FROM 0 TO THE NUMBER OF FILES
$rand = rand(0,$songsNum-1);
?

Third, find in your code the part that concerns the embedding of window
media player. It should look something like this:

object id="MediaPlayer" width="500" height="400"
classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading
Windows Media Player components..." type="application/x-oleobject"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"

param name="filename" value="folder/song1.mp3"
param name="stretchtofit" value="true"
param name="Showcontrols" value="True"
param name="autoStart" value="True"
embed type="application/x-mplayer2" src="folder/song1.mp3"
name="MediaPlayer"></embed
/object

In any case, in this code, there are two occurences of the link to your
audio file. In the above example, these two occurences are:
param name="filename" value="folder/song1.mp3"
and:
embed type="application/x-mplayer2" src="folder/song1.mp3"
name="MediaPlayer"

In both occurences, replace "folder/song1.mp3" with: <?php echo
'audio/'.$files[$rand]; ?

so that the lines will be changed to:

param name="filename" value="<?php echo 'audio/'.$files[$rand]; ?>"
and:
embed type="application/x-mplayer2" src="<?php echo
'audio/'.$files[$rand]; ?>" name="MediaPlayer"

That's all. The PHP code will look into your audio folder, and select
one audio file at random each time you reload the page.
Note that if you preview the page locally, it won't work. It will only
work ONLINE, once you upload the page and the folder containing all the
audio files.

Let me know if that's clear and if it works.



--
seb ( --- (AT) webtrans1 (DOT) com)
http://webtrans1.com | high-end web design
Downloads: Slide Show, Directory Browser, Mailing List


Reply With Quote
  #9  
Old   
Dj Psycho
 
Posts: n/a

Default Re: Wmp html Codes - 06-02-2006 , 04:58 PM



nope not working at all is there a other why beside php ??
<a target=_blank class=ftalternatingbarlinklarge href="http://radiots.atspace.us/index.php">Link to php adress</a>

Reply With Quote
  #10  
Old   
(_seb_)
 
Posts: n/a

Default Re: Wmp html Codes - 06-02-2006 , 08:01 PM



Dj Psycho wrote:
Quote:
nope not working at all is there a other why beside php ??
a target=_blank class=ftalternatingbarlinklarge href="http://radiots.atspace.us/index.php">Link to php adress</a
it should work. give a url to your page please.

--
seb ( --- (AT) webtrans1 (DOT) com)
http://webtrans1.com | high-end web design
Downloads: Slide Show, Directory Browser, Mailing List


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.