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!

Share/Save/Bookmark
Signature

Comments

1/4/2008 12:52:02 AM #

Krishnan

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 9:35:27 AM #

rtur.net

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

rtur.net |

1/4/2008 11:38:34 PM #

rtur.net

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/5/2008 12:55:26 AM #

Krishnan

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 9:28:27 PM #

rtur.net

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 5:17:30 PM #

rick

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/30/2008 1:46:28 AM #

Krishnan

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 10:19:14 AM #

rtur

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 |

8/29/2008 3:52:31 PM #

Daniel Becker

I´m trying to use MP3 Player in blogengine 1.4 but it didnt work. Why is not working? Thanks

Daniel Becker |

9/4/2008 5:25:18 PM #

fenomen

BlogEngine.NET 1.4.5 ?

fenomen |

9/10/2008 12:25:47 PM #

Daniel Becker

Yes, BlogEngine.NET 1.4.5

Daniel Becker |

9/17/2008 6:54:59 AM #

Green Energy

Thanks for the post, this is a great extension.

Green Energy |

10/8/2008 6:13:37 AM #

Darragh

I'm also trying to use the mp3 plug in with blog engine 1.4.5.  I know it's likely a lot of work to upgrade this but it would be really appreciated.

Thanks again.

Darragh |

10/18/2008 9:30:12 AM #

Dusan Stupar

Hi Ruslan,

I lelt my question in the contact, but I believe it should be here...

I have a bit of a problem with the MP3 extension:

It works in IE (ver 6), Opera (ver. 9.6) but not inb Firefox ver 3.03

Any ideas?

Thanks in advance

and thanks for your work on BE!

Dusan

Dusan Stupar |

10/18/2008 6:35:42 PM #

rtur.net

Dusan, I'm using FF 3.03 and have no problem using extension on your site. Try it from different computer, if it does not work only on your box, may be you don't have javascript enabled or something like this.

http://farm4.static.flickr.com/3294/2952301561_0eb0a6e1b3.jpg?v=0

rtur.net |

11/9/2008 1:34:37 AM #

seo test

Really amazing post and tips thanks.

seo test |

1/23/2009 1:48:28 AM #

Air Purifier

This is definitely a good information. Good work. I hope I'll learn something from you

Air Purifier |

Comments are closed
<<  March 2010  >>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Enhanced with Snapshots

Subscribe to Rtur.net