|
|
Rank: Member
Joined: 11/20/2007 Posts: 24 Location: vn
|
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
|
|
|
 Rank: YAF Forumling
Joined: 7/1/2008 Posts: 6 Location: Portland OR
|
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.
|
|
|
Rank: Member
Joined: 11/20/2007 Posts: 24 Location: vn
|
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
|
|
|
 Rank: YAF Forumling
Joined: 7/1/2008 Posts: 6 Location: Portland OR
|
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" ) : Code: 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" ) : Code: // 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" });
|
|
|
 Rank: YAF Forumling
Joined: 7/1/2008 Posts: 6 Location: Portland OR
|
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: Code:[mp3wma]http://www.somewebserver.com/media/music.mp3[/mp3wma]
|
|
|
 Rank: YAF Forumling
Joined: 7/16/2008 Posts: 8 Location: Manila
|
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....
|
|
|
 Rank: YAF Head Dude

Joined: 10/10/2004 Posts: 2,963 Location: Honolulu, HI
|
All these features are in the new version of YAF. "When you are grateful, fear disappears and abundance appears”." 
|
|
|
Rank: Advanced Member
Joined: 1/23/2008 Posts: 70 Location: Italy
|
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
|
|
|
| Users browsing this topic |
|
Guest
|
YAFPro Theme Created by Jaben Cargman (Tiny Gecko)Powered by YAF 1.9.3 RC2 |
YAF © 2003-2008, Yet Another Forum.NETThis page was generated in 0.131 seconds.