News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

How can I play the .WMA music on my topic?

Started by Hellen, March 11, 2005, 09:26:38 PM

Previous topic - Next topic

Hellen

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:


// An email address they just typed in

Before this line, add:

// 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:


'flash' => array

Below this line, add:

'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.

Kirby

there is no [wma] BBCode by default now, but it wouldnt be too hard :)

Hellen

Quote from: Kirby on March 11, 2005, 09:29:56 PM
there is no [wma] BBCode by default now, but it wouldnt be too hard :)

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

Kirby

Yes, but it'll require some PHP and HTML knowledge :)

Hellen

Quote from: Kirby on March 11, 2005, 09:47:27 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!
:)

Louis (CSpotkill)

#5
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]
	
	
	
'~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i' => isset($disabled['wma']) ? 'WMA: $1' '<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>',


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.)
My SMF Mods:

Hellen


Hellen

#7
Quote from: CSpotkill 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]
	
	
	
'~\[wma\](?:<br />)*(.+?)(?:<br />)*\[/wma\]~i' => isset($disabled['wma']) ? 'WMA: $1' '<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>',


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 ?!



Louis (CSpotkill)

#8
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:

// 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'];
My SMF Mods:

Hellen

 :) :) :)

Now I already can play the wma on my Topic ! 

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




Louis (CSpotkill)

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

Hellen


Louis (CSpotkill)

Quote from: Hellen on March 13, 2005, 12:13:03 AM
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]
	
	
	
'~\[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="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>',


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

Hellen

#13
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


// 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]

}
$context['random_news_line'] ']= $context

Louis (CSpotkill)

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:

Hellen

#15
Quote from: Louis (CSpotkill) 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?

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 !   :)

Louis (CSpotkill)

#16
Quote from: Hellen on March 16, 2005, 11:54:05 PM
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
My SMF Mods:

Hellen

Quote from: Louis (CSpotkill) on March 17, 2005, 12:00:08 AM
Quote from: Hellen on March 16, 2005, 11:54:05 PM
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 ?

Hellen

#18
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:


// An email address they just typed in

Before this line, add:

// 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:


'flash' => array

Below this line, add:

'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.



Advertisement: