There is a new version of Mp3 flash audio player extension for BlogEngine 1.3 available for download. Please note that it will not work with BE 1.2 because it uses Extension Manager. The new in this version is an admin page that will let you to change how player looks. You’ll be able to change colors and sizes through the settings interface. I did this as an exercise to show how you can use your own admin page AND still take advantage of some of the Extension Manager features. You can refer to the source code for details, but here is a brief overview steps that you can follow. First, Extension Manager need to know that you want to use custom admin page for your extension, and this is done by using SetAdminPage method:

public mp3player()
{
    // subscribe for post serving event
    Post.Serving += new EventHandler<ServingEventArgs>(Post_Serving);
 
    // set page that Extension Manager will use  
    // instead of default settings page
    ExtensionManager.SetAdminPage("mp3player", "~/audio/Admin.aspx");
 
    // set default setting values
    SetDefaultSettings();
}

Then you set default settings. These settings will be serialized to XML first time Extension Manager will see your extension on application start for future use.

protected void SetDefaultSettings()
{
    ExtensionSettings settings = new ExtensionSettings(_ext);
 
    settings.AddParameter(_width);
    settings.AddParameter(_height);
    settings.AddParameter(_bgColor);
    //more...
    settings.AddValue(_width, "290");
    settings.AddValue(_height, "24");
    settings.AddValue(_bgColor, "ffffff");
    //more...   
    settings.IsScalar = true;
    ExtensionManager.ImportSettings(settings);
    _settings = ExtensionManager.GetSettings(_ext);
}

You can retrieve these settings back by using GetSingleValue method of the ExtensionSettings object:

protected void BindForm()
{
    Control_width.Text = _settings.GetSingleValue(_width);
    Control_height.Text = _settings.GetSingleValue(_height);
    Control_background.Text = _settings.GetSingleValue(_bgColor);
    // more...
}

And, in your own admin page, you can save settings to Extension Manager like so:

protected void SaveSettings()
{
    _settings.UpdateScalarValue(_width, Control_width.Text);
    _settings.UpdateScalarValue(_height, Control_height.Text);
    _settings.UpdateScalarValue(_bgColor, Control_background.Text);
    // more...
 
    ExtensionManager.SaveSettings(_ext, _settings);
}

This way, you not forced into using standard default settings page, and yet you can use Extension Manager as your data access layer to make your custom admin code cleaner and simpler.

Happy coding in the New Year!

Signature

Related posts

Comments

1/3/2008 4:52:02 PM

Hi
Can you just check the code in Opera it is not working. I updated the object tag with an Embed tag inside.
http://krishnan.co.in/blog/post/BlogEnginenet-Extensions.aspx here is the link, can you check and if you find some other good methods then please inform me

regards
Krishhan

Krishnan

1/4/2008 1:35:27 AM

Thanks Krishhan, I'll check it out and let you know when it fixed.

rtur.net

1/4/2008 3:38:34 PM

Krishhan, what exactly is not working for you? I've checked it in Opera 9.24 and it is doing just fine. The only difference I've noticed is that I had to refresh post page after changing settings to make it use new color. What version are you using?

rtur.net

1/4/2008 4:55:26 PM

Version
9.25
Build
8827
Platform
Win32
System
Windows XP
Java
Sun Java Runtime Environment version 1.6
XHTML+Voice
IBM Multimodal Runtime Environment, Version: 4.1.3, Build: 20050506.01.1

Krishnan

1/5/2008 1:28:27 PM

Upgraded to 9.25, created new post, added mp3, went to admin and changed player color. Back to post, refresh, new color is there. So what exactly is not working?

rtur.net

1/27/2008 9:17:30 AM

I can not get this to work to save my life. All i get is text in the post of [mp3:test.mp3]. I can go into extensions and change the look etc. It says it is enabled I just can not get it too show in a post

rick

1/29/2008 5:46:28 PM

Hi Rick

Did you tried [mp3:song.mp3]

Remember "No space", try that. also confirm that the MP3 file is in the folder named "audio"

Krishnan

1/30/2008 2:19:14 AM

Hi Rick

Did you tried [mp3:song.mp3]

Remember "No space", try that. also confirm that the MP3 file is in the folder named "audio"


Actually, it was a problem with the theme, not an extension. One of the templates was missing required placeholder, as side effect none of the events needed for any extension to work were never fired. It works now.

rtur

Add comment


 

  Country flag

biuquoteimg
Loading



<<  July 2008  >>
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789
Enhanced with Snapshots

Subscribe to Rtur.net