Advertisement:

Author Topic: How can I play the .WMA music on my topic?  (Read 22016 times)

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
How can I play the .WMA music on my topic?
« on: March 11, 2005, 09:26:38 PM »
I put the link such as

 [wma]http://www.ruyimiracle.net/music/mystory/preciousluck/_APerfectIndian.wma[/wma]

but it does not work on my topic.

Whether you suppot the .wma music online play or not? If you support, how can I do?

Expecting your reply, thanks a lot!
???



The summary for wma online player automatically and add the WMA Player button on the compose page.  :)

Thank Louis (CSpotkill) very much!!!!



If you want wma online player automatically:

In Source/subs.php


find out:


Code: [Select]
// An email address they just typed in
Before this line, add:

Code: [Select]
// WMA [wma]example.wma[/wma]
'~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i' => isset($disabled['wma']) ? 'WMA: $1' : '<object type="audio/x-ms-wma" height="69" width="300"><param name="filename" value="$1" /><param name="Autostart" value="1" /><param name="ShowControls" value="1" /><param name="ShowPositionControls" value="0" /><param name="ShowStatusBar" value="1" /><param name="ShowDisplay" value="0" /><param name="ShowTracker" value="1" /><param name="ShowAudioControls" value="1" /><param name="pluginspage" value="http://www.microsoft.com/windowsmedia/" /></object>',


If you want add the WMA Player button on the compose page too:

In Themes/default (or your using theme name)/post.template.php


Find out:


Code: [Select]
'flash' => array
Below this line, add:

Code: [Select]
'wma' => array('code' => 'wma', 'before' => '[wma]', 'after' => '[/wma]', 'description' => 'Windows Media Player'),
And please sure that there is the image for the button in  Themes\default (or your using theme name)\images\bbc\ named wma.gif  . For best appearance, make sure the icon image is 23 px (w) by 22 px (h).

eg.
« Last Edit: March 17, 2005, 01:36:34 AM by Hellen »

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
Re: How can I play the .WMA music on my topic?
« Reply #1 on: March 11, 2005, 09:29:56 PM »
there is no [wma] BBCode by default now, but it wouldnt be too hard :)

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #2 on: March 11, 2005, 09:36:32 PM »
there is no [wma] BBCode by default now, but it wouldnt be too hard :)

Could I activate the [wma] BBCode by hand ? ???

Offline Kirby

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,040
  • Gender: Male
Re: How can I play the .WMA music on my topic?
« Reply #3 on: March 11, 2005, 09:47:27 PM »
Yes, but it'll require some PHP and HTML knowledge :)

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #4 on: March 11, 2005, 10:00:57 PM »
Yes, but it'll require some PHP and HTML knowledge :)


Can you tell me how can  I do it? My hosting provider is lycos.co.uk

General Info:

SMF: 1.0.2
PHP: 4.3.10
MySQL: 4.0.18-log
Hosting: Apache (UNIX)
GD: 2.0 or higher


Thanks macho!
:)

Offline Louis (CSpotkill)

  • Jr. Member
  • **
  • Posts: 154
  • Gender: Male
  • Geek with Style
    • LSTA
Re: How can I play the .WMA music on my topic?
« Reply #5 on: March 11, 2005, 10:44:34 PM »
Add the following to subs.php - search for // An email address they just typed in. then insert the two lines just above that comment.

	
	
	
// WMA [wma]example.wma[/wma]
	
	
	
&
#39;~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i&#39; => isset($disabled[&#39;wma&#39;]) ? &#39;WMA: $1&#39; : &#39;<object type="audio/x-ms-wma" height="63" width="300"><param name="Filename" value="$1" /><param name="uiMode" value="mini" /><!--[if IE]><object type="audio/x-ms-wma" height="63" width="300" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codetype="audio/x-ms-wma"><param name="URL" value="$1" /><param name="uiMode" value="mini" /></object><![endif]--></object>&#39;,


Example at: http://www.cszen.com/testforum/index.php?topic=1.msg6#msg6 [A test forum, so it might get erased eventually.]

Perhaps I should make a "Media BBCode" mod for SMF that inserts bbcode for common media types, as they seem to be requested quite often.

Edit: Updated the code, so it worked in both browsers. (So what if I had to resort to a non-standard conditional comment, it's Microsoft's own fault for forcing you to use a classid specific to IE and Windows. At least this way, there's a hope for non-Windows browsers, including IE for Mac.)
« Last Edit: March 11, 2005, 11:29:26 PM by CSpotkill »
My SMF Mods:

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #6 on: March 11, 2005, 11:20:30 PM »
Thanks mucho! I am trying it! :)

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #7 on: March 11, 2005, 11:41:35 PM »
Add the following to subs.php - search for // An email address they just typed in. then insert the two lines just above that comment.

	
	
	
// WMA [wma]example.wma[/wma]
	
	
	
&
#39;~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i&#39; => isset($disabled[&#39;wma&#39;]) ? &#39;WMA: $1&#39; : &#39;<object type="audio/x-ms-wma" height="63" width="300"><param name="Filename" value="$1" /><param name="uiMode" value="mini" /><!--[if IE]><object type="audio/x-ms-wma" height="63" width="300" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codetype="audio/x-ms-wma"><param name="URL" value="$1" /><param name="uiMode" value="mini" /></object><![endif]--></object>&#39;,


Example at: http://www.cszen.com/testforum/index.php?topic=1.msg6#msg6 [A test forum, so it might get erased eventually.]

Perhaps I should make a "Media BBCode" mod for SMF that inserts bbcode for common media types, as they seem to be requested quite often.

Edit: Updated the code, so it worked in both browsers. (So what if I had to resort to a non-standard conditional comment, it's Microsoft's own fault for forcing you to use a classid specific to IE and Windows. At least this way, there's a hope for non-Windows browsers, including IE for Mac.)


It seems a new terrible problem!!!   


Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /data/members/paid/r/u/ruyimiracle.net/htdocs/www/bbs/Sources/Subs.php on line 1593


From Line 1592 -1602

}
       $context['random_news_line'] ']']']']= $context['news_lines'][rand(0, count($context['news_lines']) - 1)];

   if (!$user_info['is_guest'])
   {
      $context['user']['messages'] ']']']']= &$user_info['messages'];
      $context['user']['unread_messages'] ']']']']= &$user_info['unread_messages'];

      '];'];'];'];// Personal message popup...
      if ($user_info['unread_messages'] > (isset($_SESSION['unread_messages']) ? $_SESSION['unread_messages'] : 0))
         $context['user']['popup_messages'] = true;



What's Wrong with it ?!


« Last Edit: March 11, 2005, 11:52:13 PM by ruyi_forever »

Offline Louis (CSpotkill)

  • Jr. Member
  • **
  • Posts: 154
  • Gender: Male
  • Geek with Style
    • LSTA
Re: How can I play the .WMA music on my topic?
« Reply #8 on: March 11, 2005, 11:55:34 PM »
Umm ... Good question. The lines you just printed above are in a completely different part of the script, the setupThemeContext function. The two lines I gave you are supposed to go in the parsecode function, inside the $code_to_from array, somewhere around line 952.

I've got exactly the same setup, except it's Apache on Windows. The code I gave you seems to work flawlessly on my test forum.

That code you copied and pasted seems a little odd. I don't think it should have ']']']'] everywhere. Here's what my subs.php looks like around those lines:

Code: [Select]
// Sets up the basic theme context stuff.
function setupThemeContext()
{
global $modSettings, $user_info, $scripturl, $context, $settings, $options, $txt, $maintenance;

// Get some news...
$context['news_lines'] = explode("\n", str_replace("\r", '', trim(addslashes($modSettings['news']))));
$context['fader_news_lines'] = array();
for ($i = 0, $n = count($context['news_lines']); $i < $n; $i++)
{
if (trim($context['news_lines'][$i]) == '')
continue;

// Clean it up for presentation ;).
$context['news_lines'][$i] = doUBBC(stripslashes(trim($context['news_lines'][$i])));

// Gotta be special for the javascript.
$context['fader_news_lines'][$i] = strtr(addslashes($context['news_lines'][$i]), array('/' => '\/', '<a href=' => '<a hre" + "f='));
}
$context['random_news_line'] = $context['news_lines'][rand(0, count($context['news_lines']) - 1)];

if (!$user_info['is_guest'])
{
$context['user']['messages'] = &$user_info['messages'];
$context['user']['unread_messages'] = &$user_info['unread_messages'];

// Personal message popup...
if ($user_info['unread_messages'] > (isset($_SESSION['unread_messages']) ? $_SESSION['unread_messages'] : 0))
$context['user']['popup_messages'] = true;
else
$context['user']['popup_messages'] = false;
$_SESSION['unread_messages'] = $user_info['unread_messages'];
« Last Edit: March 11, 2005, 11:59:40 PM by CSpotkill »
My SMF Mods:

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #9 on: March 12, 2005, 12:20:42 AM »
 :) :) :)

Now I already can play the wma on my Topic ! 

BUT : Why there are  two WM Players working on the same time? ???




Offline Louis (CSpotkill)

  • Jr. Member
  • **
  • Posts: 154
  • Gender: Male
  • Geek with Style
    • LSTA
Re: How can I play the .WMA music on my topic?
« Reply #10 on: March 12, 2005, 12:36:27 AM »
Ahh... hmm. I haven't seen that in my browser, as when I loaded just the code for the first player, it displayed a red 'x' instead of the player, in IE. So I added the stuff between <!--[if IE]> and <![endif]-->, which you can remove to get rid of the "second player".

Edit: I found my problem, I'd never let Windows Media Player associate itself with the wma file type. After adding that, it showed both. So yes, to fix the "double player" problem, use this code instead:

	
	
	
// WMA [wma]example.wma[/wma]
	
	
	
&
#39;~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i&#39; => isset($disabled[&#39;wma&#39;]) ? &#39;WMA: $1&#39; : &#39;<object type="audio/x-ms-wma" height="63" width="300"><param name="Filename" value="$1" /><param name="uiMode" value="mini" /></object>&#39;,
My SMF Mods:

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #11 on: March 12, 2005, 12:47:59 AM »
NOW EVERYTHING IS O.K., THANKS A LOT !




Offline Louis (CSpotkill)

  • Jr. Member
  • **
  • Posts: 154
  • Gender: Male
  • Geek with Style
    • LSTA
Re: How can I play the .WMA music on my topic?
« Reply #12 on: March 13, 2005, 12:39:30 PM »
It better that the player can show the details of the documents which is been playing such as Author,Title, Album and so on!
Yay :) I've fixed that problem too ;)

Use this instead:
	
	
	
// WMA [wma]example.wma[/wma]
	
	
	
&
#39;~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i&#39; => isset($disabled[&#39;wma&#39;]) ? &#39;WMA: $1&#39; : &#39;<object type="audio/x-ms-wma" height="69" width="300"><param name="filename" value="$1" /><param name="Autostart" value="0" /><param name="ShowControls" value="1" /><param name="ShowPositionControls" value="0" /><param name="ShowStatusBar" value="1" /><param name="ShowDisplay" value="0" /><param name="ShowTracker" value="1" /><param name="ShowAudioControls" value="1" /><param name="pluginspage" value="http://www.microsoft.com/windowsmedia/" /></object>&#39;,


It will look like this: http://www.cszen.com/testforum/index.php?topic=1.msg6#msg6
My SMF Mods:

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #13 on: March 13, 2005, 03:31:23 PM »
IT DOES NOT WORK AGAIN!

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /data/members/paid/r/u/ruyimiracle.net/htdocs/www/bbs/Sources/Subs.php on line 1595

From Line1576-1607


Code: [Select]
// Sets up the basic theme context stuff.
function setupThemeContext()
{
global $modSettings, $user_info, $scripturl, $context, $settings, $options, $txt, $maintenance;

// Get some news...
$context['news_lines'] = explode("\n", str_replace("\r", '', trim(addslashes($modSettings['news']))));
$context['fader_news_lines'] = array();
for ($i = 0, $n = count($context['news_lines']); $i < $n; $i++)
{
if (trim($context['news_lines'][$i]) == '')
continue;

// Clean it up for presentation ;).
$context['news_lines'][$i] = doUBBC(stripslashes(trim($context['news_lines'][$i])));

// Gotta be special for the javascript.
$context['fader_news_lines'][$i] = strtr(addslashes($context['news_lines'][$i]), array('/' => '\/', '<a href=' => '<a hre" + "f='));
}
$context['random_news_line'] ']= $context['news_lines'][rand(0, count($context['news_lines']) - 1)];

if (!$user_info['is_guest'])
{
$context['user']['messages'] ']= &$user_info['messages'];
$context['user']['unread_messages'] ']= &$user_info['unread_messages'];

'];// Personal message popup...
if ($user_info['unread_messages'] > (isset($_SESSION['unread_messages']) ? $_SESSION['unread_messages'] : 0))
$context['user']['popup_messages'] = true;
else
$context['user']['popup_messages'] = false;
$_SESSION['unread_messages'] = $user_info['unread_messages'];

It always has some problems on the line where has[color]

Code: [Select]
}
$context['random_news_line'] ']= $context
« Last Edit: March 13, 2005, 03:34:51 PM by Hellen »

Offline Louis (CSpotkill)

  • Jr. Member
  • **
  • Posts: 154
  • Gender: Male
  • Geek with Style
    • LSTA
Re: How can I play the .WMA music on my topic?
« Reply #14 on: March 13, 2005, 07:59:00 PM »
Again, you've an extra '] on that line, and in this one:

$context['user']['messages'] ']= &$user_info['messages'];

I don't know why - I never told you to edit anything near there. Maybe it's a bug in your editor?
My SMF Mods:

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #15 on: March 16, 2005, 11:54:05 PM »
Again, you've an extra '] on that line, and in this one:

$context['user']['messages'] ']= &$user_info['messages'];

I don't know why - I never told you to edit anything near there. Maybe it's a bug in your editor?

I use the Dreamweaver MX 2004……

And now it is O.K. .

And would you like amend the Code appreciably again? I want let the player play automatically.   (Now you need  play it by hand.)

Thanks a lot !   :)
« Last Edit: March 16, 2005, 11:55:44 PM by Hellen »

Offline Louis (CSpotkill)

  • Jr. Member
  • **
  • Posts: 154
  • Gender: Male
  • Geek with Style
    • LSTA
Re: How can I play the .WMA music on my topic?
« Reply #16 on: March 17, 2005, 12:00:08 AM »
I use the Dreamweaver MX 2004……And now it is O.K. .

And would you like amend the Code appreciably again? I want let the player play automatically.  (Now you need  play it by hand.)
Dreamweaver MX and Dreamweaver MX 2004 have known bugs which cause errors like this (according to Unknown).

Tip: Don't use Dreamweaver on long PHP files like Subs.php, if possible. There are many good, free editors for PHP and other types of files, like my current favourite, PSPad. (Or try the excellent Zend Studio, if you've some cash and regularly edit/make PHP scripts, as the syntax highlighting and debugging integration is fantastic.)

As for the autostart, change <param name="Autostart" value="0" /> to <param name="Autostart" value="1" /> and you're done. :D
« Last Edit: March 17, 2005, 12:02:23 AM by Louis (CSpotkill) »
My SMF Mods:

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #17 on: March 17, 2005, 12:59:56 AM »
I use the Dreamweaver MX 2004……And now it is O.K. .

And would you like amend the Code appreciably again? I want let the player play automatically.  (Now you need  play it by hand.)
Dreamweaver MX and Dreamweaver MX 2004 have known bugs which cause errors like this (according to Unknown).

Tip: Don't use Dreamweaver on long PHP files like Subs.php, if possible. There are many good, free editors for PHP and other types of files, like my current favourite, PSPad. (Or try the excellent Zend Studio, if you've some cash and regularly edit/make PHP scripts, as the syntax highlighting and debugging integration is fantastic.)

As for the autostart, change <param name="Autostart" value="0" /> to <param name="Autostart" value="1" /> and you're done. :D


Thanks a lot!

Now I had downloaded the PS Pad.

And If I want to let the realone player play automatically, I just need change

<param name="autostart" value="false" />

to

<param name="autostart" value="true" />

don't that ?

Offline Hellen

  • Semi-Newbie
  • *
  • Posts: 37
  • Gender: Female
    • Ruyi Miracle
Re: How can I play the .WMA music on my topic?
« Reply #18 on: March 17, 2005, 01:31:58 AM »
The summary for wma online player automatically and add the WMA Player button on the compose page.  :)

Thank Louis (CSpotkill) very much!!!!



If you want wma online player automatically:

In Source/subs.php


find out:


Code: [Select]
// An email address they just typed in
Before this line, add:

Code: [Select]
// WMA [wma]example.wma[/wma]
'~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i' => isset($disabled['wma']) ? 'WMA: $1' : '<object type="audio/x-ms-wma" height="69" width="300"><param name="filename" value="$1" /><param name="Autostart" value="1" /><param name="ShowControls" value="1" /><param name="ShowPositionControls" value="0" /><param name="ShowStatusBar" value="1" /><param name="ShowDisplay" value="0" /><param name="ShowTracker" value="1" /><param name="ShowAudioControls" value="1" /><param name="pluginspage" value="http://www.microsoft.com/windowsmedia/" /></object>',


If you want add the WMA Player button on the compose page too:

In Themes/default (or your using theme name)/post.template.php


Find out:


Code: [Select]
'flash' => array
Below this line, add:

Code: [Select]
'wma' => array('code' => 'wma', 'before' => '[wma]', 'after' => '[/wma]', 'description' => 'Windows Media Player'),
And please sure that there is the image for the button in  Themes\default (or your using theme name)\images\bbc\ named wma.gif  . For best appearance, make sure the icon image is 23 px (w) by 22 px (h).

eg.


« Last Edit: March 17, 2005, 01:34:29 AM by Hellen »