sinbad911
  •  sinbad911
  • 64.4% (Friendly)
  • YAF Forumling Topic Starter
2008-06-28T07:51:12Z
how to create a new bbcode such as [audio][/audio] or [video][/video] to play a media file (*.mp3,*.wma, *.avi, *.wmv)
i want to post media file on my forum to view online, can u help me:?:
Diễn đàn đại học Công Nghiệp TPHCM: http://congnghiep4.com 
Sponsor
jhawley
2008-06-30T15:16:13Z
The code to add a bbcode is the easy part.The hard part is knowing what the HTML code is that the bbcode translates into.

Do you know what the HTML is to add the file types your looking for? If so, post it here.
sinbad911
  •  sinbad911
  • 64.4% (Friendly)
  • YAF Forumling Topic Starter
2008-06-30T16:19:46Z
this code for mp3, wma files:
Quote:

<OBJECT id=Player
codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
type=application/x-oleobject height=62 width=420
classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6>
<PARAM NAME="URL" VALUE="music.mp3">
</OBJECT>


this code for avi, wmv files:
Quote:

<OBJECT id=Player
codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701
type=application/x-oleobject height=420 width=420
classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6>
<PARAM NAME="URL" VALUE="music.avi">
</OBJECT>



width and height can optional (as [img][/img] tag)
Diễn đàn đại học Công Nghiệp TPHCM: http://congnghiep4.com 
jhawley
2008-07-01T11:43:01Z
Please note: I changed the tag names to [mp3wma] and [aviwmv] because there are a ton of video/audio formats, and this will probably not work for all of them(quicktime and realaudio come to mind).

You need to edit the bbcode.cs file, add the following code, recompile it, then copy the new binarys onto your web server.

This goes around line 84 (just before the line with "r_youtube" ) :
        static private Regex r_mp3wma = new Regex(@"\[mp3wma\](?<inner>(.*?))\[/mp3wma\]", m_options);
        static private Regex r_aviwmv = new Regex(@"\[aviwmv\](?<inner>(.*?))\[/aviwmv\]", m_options);


This goes around line 187 (just before "// youtube" ) :
                // mp3wma
                NestedReplace(ref bbcode, r_mp3wma, "<!-- BEGIN audio player --><OBJECT id=Player codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 type=application/x-oleobject height=62 width=420 classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME=\"URL\" VALUE=\"${inner}\"></OBJECT><!-- END audio player --><br />", new string[] { "inner" });
                // aviwmv
                NestedReplace(ref bbcode, r_aviwmv, "<!-- BEGIN video player --><OBJECT id=Player codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 type=application/x-oleobject height=420 width=420 classid=CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6><PARAM NAME=\"URL\" VALUE=\"${inner}\"></OBJECT><!-- END video player --><br />", new string[] { "inner" });
jhawley
2008-07-01T12:24:15Z
Oh one more thing.. when using these, it would be best to provide a full url to the file, not just the filename like the one you listed in the sample code.

something like:
[mp3wma]http://www.somewebserver.com/media/music.mp3[/mp3wma]
trigun
  •  trigun
  • 54.8% (Neutral)
  • YAF Forumling
2008-07-24T13:38:38Z
Hi,

I can't open the solution/project in Visual Studio 2005. Is there a particular version that I should use to recompile the project for the newly added bbcodes?

One more thing is that how can I display the [BB/] icon beside the other tools? In my forum, I can use the tags [youtube] [/youtube] to embed youtube videos on posts but I type it manually because the [BB/] button is not visible.

www.itchytech.com 


Please help.

Thanks in advance....
Jaben
  •  Jaben
  • 100% (Exalted)
  • YAF Developer
2008-07-24T14:07:32Z
All these features are in the new version of YAF.
continienzo
2008-07-25T02:55:37Z
Jaben wrote:

All these features are in the new version of YAF.



I still can't see the [bb/] button in the 1.9.3 beta released... Even if I update the forum with the repository version 😞
juju
  •  juju
  • 72.2% (Friendly)
  • YAF Lover
2009-11-24T22:45:56Z
Very newbie here. Is there a way to hide/disable click on the spoiler bbcode if the user is not authenticated?

Thanks all.
hmmmm.... click thanks if my posts are useful
NELSON Bahe
2010-01-13T04:39:49Z
are bbcodes used in these kind or media files or embed codes?
johncocyan09
2010-01-24T15:19:06Z
BBCode includes tags to allow you to quickly change the basic style of your text. This is achieved in the following ways:
To make a piece of text bold enclose it in , e.g.

Hello

will become Hello
For underlining use , for example:

Good Morning

becomes Good Morning
To italicise text use , e.g.

This is Great!

would give This is Great!

About Us

The YAF.NET is an open source .NET forum project. YAF.NET is supported by an team of international developers who are build community by building community software.

Powered by Resharper Donate with PayPal button

Project Twitter Updates

Copyright © YetAnotherForum.NET & Ingo Herbote. All rights reserved