<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: JavaScript media player</title>
	<atom:link href="http://www.equivalence.co.uk/archives/1194/feed" rel="self" type="application/rss+xml" />
	<link>http://www.equivalence.co.uk/archives/1194</link>
	<description>Technical Blog for Software Developers</description>
	<lastBuildDate>Thu, 08 Jul 2010 05:20:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Gregg</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-1209</link>
		<dc:creator>Gregg</dc:creator>
		<pubDate>Mon, 07 Jun 2010 13:17:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-1209</guid>
		<description>Hi James. Sounds really cool what you have done with this. Glad you have found some good use for it. I was hoping that others would fine some great ways to extend it.</description>
		<content:encoded><![CDATA[<p>Hi James. Sounds really cool what you have done with this. Glad you have found some good use for it. I was hoping that others would fine some great ways to extend it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James W. Friedman</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-1204</link>
		<dc:creator>James W. Friedman</dc:creator>
		<pubDate>Sat, 15 May 2010 13:45:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-1204</guid>
		<description>I&#039;ve modified the player to track play counts and to load the player with tracks in ascending play count order.  Each track&#039;s play count is incremented at the completion of that track&#039;s play.  The player and mp3&#039;s are currently on a flash drive yet through some clever mechanisms the flash drive communicates with a PHP/MySQL complex on a server.  It is remote complex that records the play counts after each track play and that provides the play order to the player when it is enabled (or refreshed).  I&#039;m currently running a single play list but choosing one from among many playlists will be implemented as will combining playlists.  Eventually I&#039;ll put all the mp3 tracks on a web server too and the player also.  Unless Apples does the right thing with the its buy-out and closing of Lala.com this will be my day-to-day media player. My site will not be public but I will gladly share the configurations that I have implemented to anyone...its basically a combination of Ajax and \pseudo-Ajax\, the latter being requesting images whose url contains the data to be communicated in its query string.  An .hta file is used as well.  The .hta gets the server play order and writes it to a local .js file which other javascript uses to populate the players play options (tracks).  Functionally integrating HTA files and Ajax technology (http requests of any form, really) enable communication between the local file system and a remote server.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve modified the player to track play counts and to load the player with tracks in ascending play count order.  Each track&#8217;s play count is incremented at the completion of that track&#8217;s play.  The player and mp3&#8242;s are currently on a flash drive yet through some clever mechanisms the flash drive communicates with a PHP/MySQL complex on a server.  It is remote complex that records the play counts after each track play and that provides the play order to the player when it is enabled (or refreshed).  I&#8217;m currently running a single play list but choosing one from among many playlists will be implemented as will combining playlists.  Eventually I&#8217;ll put all the mp3 tracks on a web server too and the player also.  Unless Apples does the right thing with the its buy-out and closing of Lala.com this will be my day-to-day media player. My site will not be public but I will gladly share the configurations that I have implemented to anyone&#8230;its basically a combination of Ajax and \pseudo-Ajax\, the latter being requesting images whose url contains the data to be communicated in its query string.  An .hta file is used as well.  The .hta gets the server play order and writes it to a local .js file which other javascript uses to populate the players play options (tracks).  Functionally integrating HTA files and Ajax technology (http requests of any form, really) enable communication between the local file system and a remote server.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SirLamer</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-551</link>
		<dc:creator>SirLamer</dc:creator>
		<pubDate>Tue, 13 Oct 2009 17:29:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-551</guid>
		<description>&lt;a href=&quot;#comment-549&quot; rel=&quot;nofollow&quot;&gt;@Gregg&lt;/a&gt; 

Wow, thank you very much for this!

I have tested this new version and it works great!  Unfortunately, I tested it in the unique platform I hoped to use it and it&#039;s not going to work there.  It&#039;s at no fault of your own; it seems the in-game web browser in Team Fortress 2 and other Source engine games doesn&#039;t support JavaScript.  I&#039;m surprised, since they do support Flash applications!  Very well, then...

So, I&#039;m sorry I cannot put it to use like I hoped.  I&#039;ll keep an eye on things, though, and if they ever add JavaScript support I&#039;ll put your great program to use.</description>
		<content:encoded><![CDATA[<p><a href="#comment-549" rel="nofollow">@Gregg</a> </p>
<p>Wow, thank you very much for this!</p>
<p>I have tested this new version and it works great!  Unfortunately, I tested it in the unique platform I hoped to use it and it&#8217;s not going to work there.  It&#8217;s at no fault of your own; it seems the in-game web browser in Team Fortress 2 and other Source engine games doesn&#8217;t support JavaScript.  I&#8217;m surprised, since they do support Flash applications!  Very well, then&#8230;</p>
<p>So, I&#8217;m sorry I cannot put it to use like I hoped.  I&#8217;ll keep an eye on things, though, and if they ever add JavaScript support I&#8217;ll put your great program to use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gregg</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-549</link>
		<dc:creator>Gregg</dc:creator>
		<pubDate>Sun, 11 Oct 2009 23:57:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-549</guid>
		<description>For those looking for the ability to select a song to auto play on load, and set volume of the first song at start up, then I have created another version of the media player. This can be downloaded from &lt;a href=&quot;http://www.equivalence.co.uk/wp-content/uploads/2009/10/myplayer.1.01.zip&quot; rel=&quot;nofollow&quot;&gt;HERE&lt;/a&gt;.

At the moment I have not got round to including the ability to set the position of the song on the first track but I will hopefully get to this at some point soon.

For those who want to enable these new features then you need, first to download the file from the link above, then to add the following code to a &lt;code&gt;script&lt;/code&gt; tag in your html file - this replaces the code shown in line 7 above, i.e. this replaces the old variable &lt;code&gt;_MyPlayerLocation_&lt;/code&gt; :
&lt;code&gt;           
    var _MyPlayerSettings_ = {
location: &quot;myplayer&quot;, 
startTrackClass: &quot;play_me_first&quot;,
                               startVolume: 19
                            };
&lt;/code&gt;

If in doubt what to do just check the included &lt;code&gt;index.html&lt;/code&gt; file.

I&#039;ll write a more detailed description of this on a blog post soon but I just wanted to get this stuff out there to those who need it.</description>
		<content:encoded><![CDATA[<p>For those looking for the ability to select a song to auto play on load, and set volume of the first song at start up, then I have created another version of the media player. This can be downloaded from <a href="http://www.equivalence.co.uk/wp-content/uploads/2009/10/myplayer.1.01.zip" rel="nofollow">HERE</a>.</p>
<p>At the moment I have not got round to including the ability to set the position of the song on the first track but I will hopefully get to this at some point soon.</p>
<p>For those who want to enable these new features then you need, first to download the file from the link above, then to add the following code to a <code>script</code> tag in your html file &#8211; this replaces the code shown in line 7 above, i.e. this replaces the old variable <code>_MyPlayerLocation_</code> :<br />
<code><br />
    var _MyPlayerSettings_ = {<br />
location: "myplayer",<br />
startTrackClass: "play_me_first",<br />
                               startVolume: 19<br />
                            };<br />
</code></p>
<p>If in doubt what to do just check the included <code>index.html</code> file.</p>
<p>I&#8217;ll write a more detailed description of this on a blog post soon but I just wanted to get this stuff out there to those who need it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gregg</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-548</link>
		<dc:creator>Gregg</dc:creator>
		<pubDate>Fri, 09 Oct 2009 22:35:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-548</guid>
		<description>Hi SirLamer,

I&#039;ve been having a look over the things that you were looking for tonight, and I think that I should be able to implement at least the first two pretty quickly - I&#039;ve actually got most of it done. I&#039;ve not had a change to look at your third point yet but I&#039;ll look into it more tomorrow. 

On your first point though, I had a quick try and it seems to me that the &lt;code&gt;$(’.myplayer_mp3′).click()&lt;/code&gt; does play a track, however it plays the last track on the list! Anyway, if you want to wait until tomorrow, I&#039;ll release something that allows you to specify a css class that selects the first song to play, and you can see if it works from there. 

To address your second point would, as you suggested, break the current UI for the player. However, I&#039;ve created something that sets the volume you specify regardless - it will however set you to the nearest increment the first time you click the plus or minus buttons.

I&#039;ll post an updated version of the plugin that addresses some of the things that you were looking for tomorrow. 

Anyway, thanks for using and commenting, and check back soon.</description>
		<content:encoded><![CDATA[<p>Hi SirLamer,</p>
<p>I&#8217;ve been having a look over the things that you were looking for tonight, and I think that I should be able to implement at least the first two pretty quickly &#8211; I&#8217;ve actually got most of it done. I&#8217;ve not had a change to look at your third point yet but I&#8217;ll look into it more tomorrow. </p>
<p>On your first point though, I had a quick try and it seems to me that the <code>$(’.myplayer_mp3′).click()</code> does play a track, however it plays the last track on the list! Anyway, if you want to wait until tomorrow, I&#8217;ll release something that allows you to specify a css class that selects the first song to play, and you can see if it works from there. </p>
<p>To address your second point would, as you suggested, break the current UI for the player. However, I&#8217;ve created something that sets the volume you specify regardless &#8211; it will however set you to the nearest increment the first time you click the plus or minus buttons.</p>
<p>I&#8217;ll post an updated version of the plugin that addresses some of the things that you were looking for tomorrow. </p>
<p>Anyway, thanks for using and commenting, and check back soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SirLamer</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-546</link>
		<dc:creator>SirLamer</dc:creator>
		<pubDate>Fri, 09 Oct 2009 05:11:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-546</guid>
		<description>I am trying to implement some extra features, like Iain was.  The context is that this player will play MP3s for Source engine mods (video games based off of Half-Life 2&#039;s technology) in the background.  The user cannot immediately see the controller so the script&#039;s PHP and Javascript needs to do some things on the user&#039;s behalf.

1. I need the script to automatically play when it loads.  I followed your advice to Iain, but adding $(&#039;.myplayer_mp3&#039;).click() as described does not work in Chrome nor IE.  Can you suggest a better way?

2. I need to be able to set the playback volume on load by passing a variable into Javascript via PHP sort of like how the _MyPlayerLocation_ variable is passed.  Value can be passed as percentage from max out of 100 or whatever is appropriate.  Because of how your volume meter works, this might be tricky to do without breaking the meter.  If this is an issue, then it would be okay to change the volume without updating the volume meter, as in most contexts the user cannot see the interface.

3. I need to be able to define the starting position of the first track before playback begins, passing a variable like described about.  The value can be passed as the number of milliseconds into the track or whatever is appropriate.

I know that the SoundManager2 API supports these things, but I know very little of JavaScript and have a hard time figuring out how to modify your code to achieve these things.  FYI, since the user will indeed see the interface when loaded from an alternate website-based system, so I&#039;d like to retain the integrity and usability of your interface after applying these things.

Also, a couple comments about your program:
- There is a small glitch that prevents the user from dragging the track position slider all the way to the end of the song.  It seems the art for the slider object, which enlarges when selected, prevents it from going all the way to the end.
- I would prefer more finite, variable control of the volume over rigid interval selections.  That&#039;s my personal preference, though.

I very much appreciate your help with all my questions.  Thanks for this great plugin!</description>
		<content:encoded><![CDATA[<p>I am trying to implement some extra features, like Iain was.  The context is that this player will play MP3s for Source engine mods (video games based off of Half-Life 2&#8242;s technology) in the background.  The user cannot immediately see the controller so the script&#8217;s PHP and Javascript needs to do some things on the user&#8217;s behalf.</p>
<p>1. I need the script to automatically play when it loads.  I followed your advice to Iain, but adding $(&#8216;.myplayer_mp3&#8242;).click() as described does not work in Chrome nor IE.  Can you suggest a better way?</p>
<p>2. I need to be able to set the playback volume on load by passing a variable into Javascript via PHP sort of like how the _MyPlayerLocation_ variable is passed.  Value can be passed as percentage from max out of 100 or whatever is appropriate.  Because of how your volume meter works, this might be tricky to do without breaking the meter.  If this is an issue, then it would be okay to change the volume without updating the volume meter, as in most contexts the user cannot see the interface.</p>
<p>3. I need to be able to define the starting position of the first track before playback begins, passing a variable like described about.  The value can be passed as the number of milliseconds into the track or whatever is appropriate.</p>
<p>I know that the SoundManager2 API supports these things, but I know very little of JavaScript and have a hard time figuring out how to modify your code to achieve these things.  FYI, since the user will indeed see the interface when loaded from an alternate website-based system, so I&#8217;d like to retain the integrity and usability of your interface after applying these things.</p>
<p>Also, a couple comments about your program:<br />
- There is a small glitch that prevents the user from dragging the track position slider all the way to the end of the song.  It seems the art for the slider object, which enlarges when selected, prevents it from going all the way to the end.<br />
- I would prefer more finite, variable control of the volume over rigid interval selections.  That&#8217;s my personal preference, though.</p>
<p>I very much appreciate your help with all my questions.  Thanks for this great plugin!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iain</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-526</link>
		<dc:creator>Iain</dc:creator>
		<pubDate>Thu, 10 Sep 2009 20:13:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-526</guid>
		<description>Thanks! I&#039;ll let you know how I get on.</description>
		<content:encoded><![CDATA[<p>Thanks! I&#8217;ll let you know how I get on.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gregg</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-525</link>
		<dc:creator>Gregg</dc:creator>
		<pubDate>Wed, 09 Sep 2009 22:14:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-525</guid>
		<description>To get the song to play first I think the best way would be to just add a little bit of JavaScript that find the first track and send a click event to it. Maybe something like:
&lt;code&gt;
$(&#039;.myplayer_mp3&#039;).click();
&lt;/code&gt;

You would probably have to add this to the function &lt;code&gt;whenInitComplete&lt;/code&gt; (line 608) in the file &lt;code&gt;myplayer/myplayer.js&lt;/code&gt;. The code for this function would then look something like:
&lt;code&gt;
function whenInitComplete()
{
    // Wait for both the auto layout to have finished and
    // the soundManager has loaded before we setup the
    // player
    toComplete--;
    if(toComplete == 0) {
        var myPlayer = new MyPlayer();
        myPlayer.init();
        $(&#039;.myplayer_mp3&#039;).click();
    }
}
&lt;/code&gt;

I&#039;m not 100% sure this would work but you can give it a try. I should probably have created a better way to hooking in this functionality but I never really thought about it at the time. One for the future I think!</description>
		<content:encoded><![CDATA[<p>To get the song to play first I think the best way would be to just add a little bit of JavaScript that find the first track and send a click event to it. Maybe something like:<br />
<code><br />
$('.myplayer_mp3').click();<br />
</code></p>
<p>You would probably have to add this to the function <code>whenInitComplete</code> (line 608) in the file <code>myplayer/myplayer.js</code>. The code for this function would then look something like:<br />
<code><br />
function whenInitComplete()<br />
{<br />
    // Wait for both the auto layout to have finished and<br />
    // the soundManager has loaded before we setup the<br />
    // player<br />
    toComplete--;<br />
    if(toComplete == 0) {<br />
        var myPlayer = new MyPlayer();<br />
        myPlayer.init();<br />
        $('.myplayer_mp3').click();<br />
    }<br />
}<br />
</code></p>
<p>I&#8217;m not 100% sure this would work but you can give it a try. I should probably have created a better way to hooking in this functionality but I never really thought about it at the time. One for the future I think!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Iain</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-523</link>
		<dc:creator>Iain</dc:creator>
		<pubDate>Tue, 08 Sep 2009 23:43:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-523</guid>
		<description>Thanks - in fact I was having a dumb (and tired) moment, forgot to spell color the American way...duh! You;re right of course, this only works in IE so far as I know.

My new challenge is to get the player to play the first song automatically when the page launches; if you have any pointers on that I&#039;d appreciate it.
 
I Love the band, also. If you&#039;re ever gigging in the north east of England, please do let us know!</description>
		<content:encoded><![CDATA[<p>Thanks &#8211; in fact I was having a dumb (and tired) moment, forgot to spell color the American way&#8230;duh! You;re right of course, this only works in IE so far as I know.</p>
<p>My new challenge is to get the player to play the first song automatically when the page launches; if you have any pointers on that I&#8217;d appreciate it.</p>
<p>I Love the band, also. If you&#8217;re ever gigging in the north east of England, please do let us know!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gregg</title>
		<link>http://www.equivalence.co.uk/archives/1194/comment-page-1#comment-522</link>
		<dc:creator>Gregg</dc:creator>
		<pubDate>Tue, 08 Sep 2009 22:00:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.equivalence.co.uk/?p=1194#comment-522</guid>
		<description>Hi Iain, thanks for the comment. The scroll bar colour can only be changed in IE - if I remember correctly. Changing it is not supported in Firefox or Chrome. However, if you are happy for the coloured scroll bar just to display in IE then you need to override (or update) the CSS style for #myplayer_player_container. To do this you either add something like below to your CSS file and change the colours to the ones you would like:

&lt;code&gt;
#myplayer_playlist_container {
  scrollbar-highlight-color: #272525; 
    scrollbar-3dlight-color: #272525; 
    scrollbar-shadow-color: #272525; 
    scrollbar-darkshadow-color: #272525; 
    scrollbar-track-color: #272525; 
    scrollbar-arrow-color: #272525;
}
&lt;/code&gt;
Or, you search through the CSS file that is included with the files you downloaded from my site (it can be found in myplayer/player.css). You can then search for the word &quot;scrollbar&quot; in the file, where you will find a set of lines that look similar to that above. You can then change the colour values to the values that you require.

Alternatively if you just want to stop the scroll bars from displaying then you can just change the height attribute of the above style to make it big enough to accommodate all your tracks.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi Iain, thanks for the comment. The scroll bar colour can only be changed in IE &#8211; if I remember correctly. Changing it is not supported in Firefox or Chrome. However, if you are happy for the coloured scroll bar just to display in IE then you need to override (or update) the CSS style for #myplayer_player_container. To do this you either add something like below to your CSS file and change the colours to the ones you would like:</p>
<p><code><br />
#myplayer_playlist_container {<br />
  scrollbar-highlight-color: #272525;<br />
    scrollbar-3dlight-color: #272525;<br />
    scrollbar-shadow-color: #272525;<br />
    scrollbar-darkshadow-color: #272525;<br />
    scrollbar-track-color: #272525;<br />
    scrollbar-arrow-color: #272525;<br />
}<br />
</code><br />
Or, you search through the CSS file that is included with the files you downloaded from my site (it can be found in myplayer/player.css). You can then search for the word &#8220;scrollbar&#8221; in the file, where you will find a set of lines that look similar to that above. You can then change the colour values to the values that you require.</p>
<p>Alternatively if you just want to stop the scroll bars from displaying then you can just change the height attribute of the above style to make it big enough to accommodate all your tracks.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
