Configure Width and Background Color?

Jan 14, 2010 at 4:20 PM

Really like the simple audio player layout.

Unfortunately, the default width is too wide for the space I'd like this to live in, and my page background color is different from the player default, so it shows up with a white background. Any chance that either or both of these properties might eventually be configurable? I know I can always pull down the code and do the tweaks, but if it's something you're considering I might wait.

Thanks!

Coordinator
Jan 22, 2010 at 2:44 PM

hi, I'm afraid I haven't had any time to work on this recently. I'll bear your feature request in mind for the future though

Jan 22, 2010 at 5:49 PM

Thanks…appreciate the response. And I understand completely.

From: markheath [mailto:notifications@codeplex.com]
Sent: Friday, January 22, 2010 10:45 AM
To: G. Andrew Duthie
Subject: Re: Configure Width and Background Color? [slaudioplayer:80849]

From: markheath

hi, I'm afraid I haven't had any time to work on this recently. I'll bear your feature request in mind for the future though

Read the full discussion online.

To add a post to this discussion, reply to this email (slaudioplayer@discussions.codeplex.com)

To start a new discussion for this project, email slaudioplayer@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com

Apr 17, 2010 at 4:17 AM

Hi Mark,

I found a workaround for the background and width issues. On the background, I had forgotten that it's possible to simply set the background on the <object> tag itself, like so:

<param name='background' value='#00000000'></param>


The param element above makes the background transparent by including the alpha channel. Note that this requires the "windowless" param to be set to "true".

For the width issue, I simply added a new initParam called ExpandOnPlay, and check the value in the Play method. If it's set to "false" I don't call Begin on the expand animation. Granted, it's a bit of a hack, since it means you don't get the progress bar or the text, but when you need a very compact version of the player, it's a simple enough way of doing that.

I'd be happy to contribute the code if you like...it's pretty straightforward.

Apr 17, 2010 at 6:02 PM

Another update...decided that I wanted a richer option than just hacking the control to not expand, so I wrapped the control in a Viewbox, and used an initParam to set up the width of the Viewbox, if it's set by the <object> element (I've simplified the markup for clarity...the additional Canvas element is necessary since the Viewbox can only have one child):

SimplePlayer.xaml:

     <my1:Viewbox x:Name="TheViewbox">
            <Canvas Width="300" Height="100">
                <Rectangle x:Name="hiddenRect" />

                <Canvas x:Name="MidCanvas" >
                    ...
                </Canvas>

                <Canvas x:Name="LeftCanvas" >
                    ...
                </Canvas>
        
                <Canvas x:Name="rightCanvas" >
                    ...
                </Canvas>
                <Canvas >
                    ...
                </Canvas>
        </Canvas>
     </my1:Viewbox>

Added the following to Application_Startup in App.xaml.cs:

this.Resources.Add("playerWidth", double.Parse(GetInitParam(e.InitParams, "PlayerWidth", "0")));

And added the following to Page_Loaded in SimplePlayer.xaml.cs:

if (App.Current.Resources["playerWidth"].ToString() != "0") {
   TheViewbox.Width = (double)App.Current.Resources["playerWidth"];
}


I'm betting there's probably a more elegant way to pull it off, but this works for me, and gives me all of what I was looking for, without sacrificing any of the player functionality. You can see it in action at http://www.communitymegaphone.com/ (click the "Podcast" tab in the left hand pane to see the inline players).

Coordinator
May 6, 2010 at 2:28 PM
cool, thanks for sharing. perhaps next time I get round to working on the code I'll see if I can incorporate your changes Mark
May 6, 2010 at 2:44 PM

My pleasure...I appreciate you making the player code available!